Default to runner architecture (#376)

This commit is contained in:
Wes Morgan
2022-10-10 17:47:17 -06:00
committed by GitHub
parent a82e6d0020
commit 3617c43588
16 changed files with 303 additions and 42 deletions

70
dist/setup/index.js vendored
View File

@ -103661,7 +103661,7 @@ class AdoptDistribution extends base_installer_1.JavaBase {
getAvailableVersions() {
return __awaiter(this, void 0, void 0, function* () {
const platform = this.getPlatformOption();
const arch = this.architecture;
const arch = this.distributionArchitecture();
const imageType = this.packageType;
const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
const releaseType = this.stable ? 'ga' : 'ea';
@ -103772,6 +103772,7 @@ const path_1 = __importDefault(__nccwpck_require__(1017));
const httpm = __importStar(__nccwpck_require__(9925));
const util_1 = __nccwpck_require__(2629);
const constants_1 = __nccwpck_require__(9042);
const os_1 = __importDefault(__nccwpck_require__(2037));
class JavaBase {
constructor(distribution, installerOptions) {
this.distribution = distribution;
@ -103780,7 +103781,7 @@ class JavaBase {
maxRetries: 3
});
({ version: this.version, stable: this.stable } = this.normalizeVersion(installerOptions.version));
this.architecture = installerOptions.architecture;
this.architecture = installerOptions.architecture || os_1.default.arch();
this.packageType = installerOptions.packageType;
this.checkLatest = installerOptions.checkLatest;
}
@ -103891,6 +103892,24 @@ class JavaBase {
core.setOutput('version', version);
core.exportVariable(`JAVA_HOME_${majorVersion}_${this.architecture.toUpperCase()}`, toolPath);
}
distributionArchitecture() {
// default mappings of config architectures to distribution architectures
// override if a distribution uses any different names; see liberica for an example
// node's os.arch() - which this defaults to - can return any of:
// 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', and 'x64'
// so we need to map these to java distribution architectures
// 'amd64' is included here too b/c it's a common alias for 'x64' people might use explicitly
switch (this.architecture) {
case 'amd64':
return 'x64';
case 'ia32':
return 'x86';
case 'arm64':
return 'aarch64';
default:
return this.architecture;
}
}
}
exports.JavaBase = JavaBase;
@ -103990,7 +104009,7 @@ class CorrettoDistribution extends base_installer_1.JavaBase {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
const platform = this.getPlatformOption();
const arch = this.architecture;
const arch = this.distributionArchitecture();
const imageType = this.packageType;
if (core.isDebug()) {
console.time('corretto-retrieve-available-versions');
@ -104165,7 +104184,7 @@ const tc = __importStar(__nccwpck_require__(7784));
const fs_1 = __importDefault(__nccwpck_require__(7147));
const path_1 = __importDefault(__nccwpck_require__(1017));
const supportedPlatform = `'linux', 'linux-musl', 'macos', 'solaris', 'windows'`;
const supportedArchitecture = `'x86', 'x64', 'armv7', 'aarch64', 'ppc64le'`;
const supportedArchitectures = `'x86', 'x64', 'armv7', 'aarch64', 'ppc64le'`;
class LibericaDistributions extends base_installer_1.JavaBase {
constructor(installerOptions) {
super('Liberica', installerOptions);
@ -104237,7 +104256,8 @@ class LibericaDistributions extends base_installer_1.JavaBase {
return bundleType;
}
getArchitectureOptions() {
switch (this.architecture) {
const arch = this.distributionArchitecture();
switch (arch) {
case 'x86':
return { bitness: '32', arch: 'x86' };
case 'x64':
@ -104249,7 +104269,7 @@ class LibericaDistributions extends base_installer_1.JavaBase {
case 'ppc64le':
return { bitness: '64', arch: 'ppc' };
default:
throw new Error(`Architecture '${this.architecture}' is not supported. Supported architectures: ${supportedArchitecture}`);
throw new Error(`Architecture '${this.architecture}' is not supported. Supported architectures: ${supportedArchitectures}`);
}
}
getPlatformOption(platform = process.platform) {
@ -104275,6 +104295,15 @@ class LibericaDistributions extends base_installer_1.JavaBase {
}
return mainVersion;
}
distributionArchitecture() {
let arch = super.distributionArchitecture();
switch (arch) {
case 'arm':
return 'armv7';
default:
return arch;
}
}
}
exports.LibericaDistributions = LibericaDistributions;
@ -104447,7 +104476,8 @@ class MicrosoftDistributions extends base_installer_1.JavaBase {
}
findPackageForDownload(range) {
return __awaiter(this, void 0, void 0, function* () {
if (this.architecture !== 'x64' && this.architecture !== 'aarch64') {
const arch = this.distributionArchitecture();
if (arch !== 'x64' && arch !== 'aarch64') {
throw new Error(`Unsupported architecture: ${this.architecture}`);
}
if (!this.stable) {
@ -104460,7 +104490,7 @@ class MicrosoftDistributions extends base_installer_1.JavaBase {
if (!manifest) {
throw new Error('Could not load manifest for Microsoft Build of OpenJDK');
}
const foundRelease = yield tc.findFromManifest(range, true, manifest, this.architecture);
const foundRelease = yield tc.findFromManifest(range, true, manifest, arch);
if (!foundRelease) {
throw new Error(`Could not find satisfied version for SemVer ${range}. ${manifest
.map(item => item.version)
@ -104614,7 +104644,7 @@ class TemurinDistribution extends base_installer_1.JavaBase {
getAvailableVersions() {
return __awaiter(this, void 0, void 0, function* () {
const platform = this.getPlatformOption();
const arch = this.architecture;
const arch = this.distributionArchitecture();
const imageType = this.packageType;
const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
const releaseType = this.stable ? 'ga' : 'ea';
@ -104818,17 +104848,17 @@ class ZuluDistribution extends base_installer_1.JavaBase {
});
}
getArchitectureOptions() {
if (this.architecture == 'x64') {
return { arch: 'x86', hw_bitness: '64', abi: '' };
}
else if (this.architecture == 'x86') {
return { arch: 'x86', hw_bitness: '32', abi: '' };
}
else if (this.architecture == 'arm64') {
return { arch: 'arm', hw_bitness: '64', abi: '' };
}
else {
return { arch: this.architecture, hw_bitness: '', abi: '' };
const arch = this.distributionArchitecture();
switch (arch) {
case 'x64':
return { arch: 'x86', hw_bitness: '64', abi: '' };
case 'x86':
return { arch: 'x86', hw_bitness: '32', abi: '' };
case 'aarch64':
case 'arm64':
return { arch: 'arm', hw_bitness: '64', abi: '' };
default:
return { arch: arch, hw_bitness: '', abi: '' };
}
}
getPlatformOption() {