mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 09:56:46 +00:00
minor improvements
This commit is contained in:
parent
b2da088220
commit
cfdcd6827b
6 changed files with 15 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
|||
export const macOSJavaContentDir = 'Contents/Home';
|
||||
export const MACOS_JAVA_CONTENT_POSTFIX = 'Contents/Home';
|
||||
export const INPUT_JAVA_VERSION = 'java-version';
|
||||
export const INPUT_ARCHITECTURE = 'architecture';
|
||||
export const INPUT_JAVA_PACKAGE = 'java-package';
|
||||
|
|
|
@ -8,7 +8,7 @@ import semver from 'semver';
|
|||
import { JavaBase } from '../base-installer';
|
||||
import { IAdoptiumAvailableVersions } from './models';
|
||||
import { JavaInstallerOptions, JavaDownloadRelease, JavaInstallerResults } from '../base-models';
|
||||
import { macOSJavaContentDir } from '../../constants';
|
||||
import { MACOS_JAVA_CONTENT_POSTFIX } from '../../constants';
|
||||
import { extractJdkFile, getDownloadArchiveExtension } from '../../util';
|
||||
|
||||
export class AdoptiumDistribution extends JavaBase {
|
||||
|
@ -68,7 +68,7 @@ export class AdoptiumDistribution extends JavaBase {
|
|||
javaPath = await tc.cacheDir(archivePath, this.toolcacheFolderName, version, this.architecture);
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
javaPath = path.join(javaPath, macOSJavaContentDir);
|
||||
javaPath = path.join(javaPath, MACOS_JAVA_CONTENT_POSTFIX);
|
||||
}
|
||||
|
||||
return { version: javaRelease.version, path: javaPath };
|
||||
|
|
|
@ -8,7 +8,7 @@ import semver from 'semver';
|
|||
import { JavaBase } from '../base-installer';
|
||||
import { JavaInstallerOptions, JavaDownloadRelease, JavaInstallerResults } from '../base-models';
|
||||
import { extractJdkFile } from '../../util';
|
||||
import { macOSJavaContentDir } from '../../constants';
|
||||
import { MACOS_JAVA_CONTENT_POSTFIX } from '../../constants';
|
||||
|
||||
export class LocalDistribution extends JavaBase {
|
||||
constructor(installerOptions: JavaInstallerOptions, private jdkFile?: string) {
|
||||
|
@ -48,11 +48,12 @@ export class LocalDistribution extends JavaBase {
|
|||
this.architecture
|
||||
);
|
||||
|
||||
// for different Java distributions, postfix can exist or not so need to check both cases
|
||||
if (
|
||||
process.platform === 'darwin' &&
|
||||
fs.existsSync(path.join(javaPath, macOSJavaContentDir))
|
||||
fs.existsSync(path.join(javaPath, MACOS_JAVA_CONTENT_POSTFIX))
|
||||
) {
|
||||
javaPath = path.join(javaPath, macOSJavaContentDir);
|
||||
javaPath = path.join(javaPath, MACOS_JAVA_CONTENT_POSTFIX);
|
||||
}
|
||||
|
||||
foundJava = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue