mirror of
https://github.com/actions/setup-java.git
synced 2025-04-19 17:36:45 +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 javaVersion = this.version;
|
||||
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 = {
|
||||
version: javaVersion,
|
||||
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`);
|
||||
this.setJavaDefault(foundJava.version, foundJava.path);
|
||||
return foundJava;
|
||||
|
|
|
@ -46,20 +46,18 @@ 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, MACOS_JAVA_CONTENT_POSTFIX))
|
||||
) {
|
||||
javaPath = path.join(javaPath, MACOS_JAVA_CONTENT_POSTFIX);
|
||||
}
|
||||
|
||||
foundJava = {
|
||||
version: javaVersion,
|
||||
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`);
|
||||
|
||||
this.setJavaDefault(foundJava.version, foundJava.path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue