mirror of
https://github.com/actions/setup-java.git
synced 2024-12-26 08:52:11 -05:00
Add "Contents/Home" postfix on macOS if provider creates it (#139)
* Update e2e-versions.yml * Update e2e-versions.yml * implement fix * Update e2e-versions.yml * Update installer.ts * fix filter logic * Update e2e-versions.yml * remove extra logic * Update e2e-versions.yml
This commit is contained in:
parent
804a60faf9
commit
502a6650cd
4 changed files with 21 additions and 8 deletions
6
.github/workflows/e2e-versions.yml
vendored
6
.github/workflows/e2e-versions.yml
vendored
|
@ -88,6 +88,9 @@ jobs:
|
||||||
with:
|
with:
|
||||||
java-version: ${{ matrix.version }}
|
java-version: ${{ matrix.version }}
|
||||||
distribution: zulu
|
distribution: zulu
|
||||||
|
- name: Verify Java
|
||||||
|
run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
setup-java-ea-versions-adopt:
|
setup-java-ea-versions-adopt:
|
||||||
name: adopt ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
|
name: adopt ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
|
||||||
|
@ -107,6 +110,9 @@ jobs:
|
||||||
with:
|
with:
|
||||||
java-version: ${{ matrix.version }}
|
java-version: ${{ matrix.version }}
|
||||||
distribution: adopt
|
distribution: adopt
|
||||||
|
- name: Verify Java
|
||||||
|
run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
setup-java-custom-package-type:
|
setup-java-custom-package-type:
|
||||||
name: ${{ matrix.distribution }} ${{ matrix.version }} (${{ matrix.java-package }}-x64) - ${{ matrix.os }}
|
name: ${{ matrix.distribution }} ${{ matrix.version }} (${{ matrix.java-package }}-x64) - ${{ matrix.os }}
|
||||||
|
|
11
dist/setup/index.js
vendored
11
dist/setup/index.js
vendored
|
@ -3951,10 +3951,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.JavaBase = void 0;
|
exports.JavaBase = void 0;
|
||||||
const tc = __importStar(__webpack_require__(139));
|
const tc = __importStar(__webpack_require__(139));
|
||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
|
const fs = __importStar(__webpack_require__(747));
|
||||||
const semver_1 = __importDefault(__webpack_require__(876));
|
const semver_1 = __importDefault(__webpack_require__(876));
|
||||||
const path_1 = __importDefault(__webpack_require__(622));
|
const path_1 = __importDefault(__webpack_require__(622));
|
||||||
const httpm = __importStar(__webpack_require__(539));
|
const httpm = __importStar(__webpack_require__(539));
|
||||||
const util_1 = __webpack_require__(322);
|
const util_1 = __webpack_require__(322);
|
||||||
|
const constants_1 = __webpack_require__(211);
|
||||||
class JavaBase {
|
class JavaBase {
|
||||||
constructor(distribution, installerOptions) {
|
constructor(distribution, installerOptions) {
|
||||||
this.distribution = distribution;
|
this.distribution = distribution;
|
||||||
|
@ -3978,6 +3980,11 @@ class JavaBase {
|
||||||
foundJava = yield this.downloadTool(javaRelease);
|
foundJava = yield this.downloadTool(javaRelease);
|
||||||
core.info(`Java ${foundJava.version} was downloaded`);
|
core.info(`Java ${foundJava.version} was downloaded`);
|
||||||
}
|
}
|
||||||
|
// 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.existsSync(macOSPostfixPath)) {
|
||||||
|
foundJava.path = macOSPostfixPath;
|
||||||
|
}
|
||||||
core.info(`Setting Java ${foundJava.version} as the default`);
|
core.info(`Setting Java ${foundJava.version} as the default`);
|
||||||
this.setJavaDefault(foundJava.version, foundJava.path);
|
this.setJavaDefault(foundJava.version, foundJava.path);
|
||||||
return foundJava;
|
return foundJava;
|
||||||
|
@ -26861,7 +26868,6 @@ const fs_1 = __importDefault(__webpack_require__(747));
|
||||||
const path_1 = __importDefault(__webpack_require__(622));
|
const path_1 = __importDefault(__webpack_require__(622));
|
||||||
const semver_1 = __importDefault(__webpack_require__(876));
|
const semver_1 = __importDefault(__webpack_require__(876));
|
||||||
const base_installer_1 = __webpack_require__(83);
|
const base_installer_1 = __webpack_require__(83);
|
||||||
const constants_1 = __webpack_require__(211);
|
|
||||||
const util_1 = __webpack_require__(322);
|
const util_1 = __webpack_require__(322);
|
||||||
class AdoptDistribution extends base_installer_1.JavaBase {
|
class AdoptDistribution extends base_installer_1.JavaBase {
|
||||||
constructor(installerOptions) {
|
constructor(installerOptions) {
|
||||||
|
@ -26907,9 +26913,6 @@ class AdoptDistribution extends base_installer_1.JavaBase {
|
||||||
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
|
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
|
||||||
const version = this.getToolcacheVersionName(javaRelease.version);
|
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||||
javaPath = yield tc.cacheDir(archivePath, this.toolcacheFolderName, version, this.architecture);
|
javaPath = yield tc.cacheDir(archivePath, this.toolcacheFolderName, version, this.architecture);
|
||||||
if (process.platform === 'darwin') {
|
|
||||||
javaPath = path_1.default.join(javaPath, constants_1.MACOS_JAVA_CONTENT_POSTFIX);
|
|
||||||
}
|
|
||||||
return { version: javaRelease.version, path: javaPath };
|
return { version: javaRelease.version, path: javaPath };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,10 +67,6 @@ export class AdoptDistribution extends JavaBase {
|
||||||
|
|
||||||
javaPath = await tc.cacheDir(archivePath, this.toolcacheFolderName, version, this.architecture);
|
javaPath = await tc.cacheDir(archivePath, this.toolcacheFolderName, version, this.architecture);
|
||||||
|
|
||||||
if (process.platform === 'darwin') {
|
|
||||||
javaPath = path.join(javaPath, MACOS_JAVA_CONTENT_POSTFIX);
|
|
||||||
}
|
|
||||||
|
|
||||||
return { version: javaRelease.version, path: javaPath };
|
return { version: javaRelease.version, path: javaPath };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
import * as fs from 'fs';
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as httpm from '@actions/http-client';
|
import * as httpm from '@actions/http-client';
|
||||||
import { getToolcachePath, getVersionFromToolcachePath, isVersionSatisfies } from '../util';
|
import { getToolcachePath, getVersionFromToolcachePath, isVersionSatisfies } from '../util';
|
||||||
import { JavaDownloadRelease, JavaInstallerOptions, JavaInstallerResults } from './base-models';
|
import { JavaDownloadRelease, JavaInstallerOptions, JavaInstallerResults } from './base-models';
|
||||||
|
import { MACOS_JAVA_CONTENT_POSTFIX } from '../constants';
|
||||||
|
|
||||||
export abstract class JavaBase {
|
export abstract class JavaBase {
|
||||||
protected http: httpm.HttpClient;
|
protected http: httpm.HttpClient;
|
||||||
|
@ -40,6 +42,12 @@ export abstract class JavaBase {
|
||||||
core.info(`Java ${foundJava.version} was downloaded`);
|
core.info(`Java ${foundJava.version} was downloaded`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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 the default`);
|
core.info(`Setting Java ${foundJava.version} as the default`);
|
||||||
this.setJavaDefault(foundJava.version, foundJava.path);
|
this.setJavaDefault(foundJava.version, foundJava.path);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue