mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 01:46:46 +00:00
always check postfix "Contents/Home" on macOS
This commit is contained in:
parent
de1bb2b0c5
commit
d242f3f935
2 changed files with 11 additions and 13 deletions
10
dist/setup/index.js
vendored
10
dist/setup/index.js
vendored
|
@ -104417,16 +104417,16 @@ class LocalDistribution extends base_installer_1.JavaBase {
|
||||||
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
|
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
|
||||||
const javaVersion = this.version;
|
const javaVersion = this.version;
|
||||||
let javaPath = yield tc.cacheDir(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaVersion), this.architecture);
|
let javaPath = yield tc.cacheDir(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaVersion), this.architecture);
|
||||||
// for different Java distributions, postfix can exist or not so need to check both cases
|
|
||||||
if (process.platform === 'darwin' &&
|
|
||||||
fs_1.default.existsSync(path_1.default.join(javaPath, constants_1.MACOS_JAVA_CONTENT_POSTFIX))) {
|
|
||||||
javaPath = path_1.default.join(javaPath, constants_1.MACOS_JAVA_CONTENT_POSTFIX);
|
|
||||||
}
|
|
||||||
foundJava = {
|
foundJava = {
|
||||||
version: javaVersion,
|
version: javaVersion,
|
||||||
path: javaPath
|
path: javaPath
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
// JDK folder may contain postfix "Contents/Home" on macOS
|
||||||
|
const macOSPostfixPath = path_1.default.join(foundJava.path, constants_1.MACOS_JAVA_CONTENT_POSTFIX);
|
||||||
|
if (process.platform === 'darwin' && fs_1.default.existsSync(macOSPostfixPath)) {
|
||||||
|
foundJava.path = macOSPostfixPath;
|
||||||
|
}
|
||||||
core.info(`Setting Java ${foundJava.version} as default`);
|
core.info(`Setting Java ${foundJava.version} as default`);
|
||||||
this.setJavaDefault(foundJava.version, foundJava.path);
|
this.setJavaDefault(foundJava.version, foundJava.path);
|
||||||
return foundJava;
|
return foundJava;
|
||||||
|
|
|
@ -46,20 +46,18 @@ export class LocalDistribution extends JavaBase {
|
||||||
this.architecture
|
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, MACOS_JAVA_CONTENT_POSTFIX))
|
|
||||||
) {
|
|
||||||
javaPath = path.join(javaPath, MACOS_JAVA_CONTENT_POSTFIX);
|
|
||||||
}
|
|
||||||
|
|
||||||
foundJava = {
|
foundJava = {
|
||||||
version: javaVersion,
|
version: javaVersion,
|
||||||
path: javaPath
|
path: javaPath
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JDK folder may contain postfix "Contents/Home" on macOS
|
||||||
|
const macOSPostfixPath = path.join(foundJava.path, MACOS_JAVA_CONTENT_POSTFIX);
|
||||||
|
if (process.platform === 'darwin' && fs.existsSync(macOSPostfixPath)) {
|
||||||
|
foundJava.path = macOSPostfixPath;
|
||||||
|
}
|
||||||
|
|
||||||
core.info(`Setting Java ${foundJava.version} as default`);
|
core.info(`Setting Java ${foundJava.version} as default`);
|
||||||
|
|
||||||
this.setJavaDefault(foundJava.version, foundJava.path);
|
this.setJavaDefault(foundJava.version, foundJava.path);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue