mirror of
https://github.com/actions/setup-java.git
synced 2025-04-21 02:16:45 +00:00
Map OS arch to distro arch for other distros
This commit is contained in:
parent
f21b8ec265
commit
0b04eaf6bb
5 changed files with 32 additions and 18 deletions
|
@ -88,7 +88,7 @@ export class AdoptDistribution extends JavaBase {
|
||||||
|
|
||||||
private async getAvailableVersions(): Promise<IAdoptAvailableVersions[]> {
|
private async getAvailableVersions(): Promise<IAdoptAvailableVersions[]> {
|
||||||
const platform = this.getPlatformOption();
|
const platform = this.getPlatformOption();
|
||||||
const arch = this.architecture;
|
const arch = this.distributionArchitecture();
|
||||||
const imageType = this.packageType;
|
const imageType = this.packageType;
|
||||||
const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
|
const versionRange = encodeURI('[1.0,100.0]'); // retrieve all available versions
|
||||||
const releaseType = this.stable ? 'ga' : 'ea';
|
const releaseType = this.stable ? 'ga' : 'ea';
|
||||||
|
|
|
@ -68,7 +68,7 @@ export class CorrettoDistribution extends JavaBase {
|
||||||
|
|
||||||
private async getAvailableVersions(): Promise<ICorettoAvailableVersions[]> {
|
private async getAvailableVersions(): Promise<ICorettoAvailableVersions[]> {
|
||||||
const platform = this.getPlatformOption();
|
const platform = this.getPlatformOption();
|
||||||
const arch = this.architecture;
|
const arch = this.distributionArchitecture();
|
||||||
const imageType = this.packageType;
|
const imageType = this.packageType;
|
||||||
|
|
||||||
console.time('coretto-retrieve-available-versions');
|
console.time('coretto-retrieve-available-versions');
|
||||||
|
|
|
@ -10,7 +10,7 @@ import path from 'path';
|
||||||
|
|
||||||
const supportedPlatform = `'linux', 'linux-musl', 'macos', 'solaris', 'windows'`;
|
const supportedPlatform = `'linux', 'linux-musl', 'macos', 'solaris', 'windows'`;
|
||||||
|
|
||||||
const supportedArchitecture = `'x86', 'x64', 'armv7', 'aarch64', 'ppc64le'`;
|
const supportedArchitectures = `'x86', 'x64', 'armv7', 'aarch64', 'ppc64le'`;
|
||||||
|
|
||||||
export class LibericaDistributions extends JavaBase {
|
export class LibericaDistributions extends JavaBase {
|
||||||
constructor(installerOptions: JavaInstallerOptions) {
|
constructor(installerOptions: JavaInstallerOptions) {
|
||||||
|
@ -110,7 +110,8 @@ export class LibericaDistributions extends JavaBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private getArchitectureOptions(): ArchitectureOptions {
|
private getArchitectureOptions(): ArchitectureOptions {
|
||||||
switch (this.architecture) {
|
const arch = this.distributionArchitecture();
|
||||||
|
switch (arch) {
|
||||||
case 'x86':
|
case 'x86':
|
||||||
return { bitness: '32', arch: 'x86' };
|
return { bitness: '32', arch: 'x86' };
|
||||||
case 'x64':
|
case 'x64':
|
||||||
|
@ -123,7 +124,7 @@ export class LibericaDistributions extends JavaBase {
|
||||||
return { bitness: '64', arch: 'ppc' };
|
return { bitness: '64', arch: 'ppc' };
|
||||||
default:
|
default:
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Architecture '${this.architecture}' is not supported. Supported architectures: ${supportedArchitecture}`
|
`Architecture '${this.architecture}' is not supported. Supported architectures: ${supportedArchitectures}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,4 +155,14 @@ export class LibericaDistributions extends JavaBase {
|
||||||
}
|
}
|
||||||
return mainVersion;
|
return mainVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected distributionArchitecture(): string {
|
||||||
|
let arch = super.distributionArchitecture();
|
||||||
|
switch (arch) {
|
||||||
|
case 'arm':
|
||||||
|
return 'armv7';
|
||||||
|
default:
|
||||||
|
return arch;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,8 @@ export class MicrosoftDistributions extends JavaBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async findPackageForDownload(range: string): Promise<JavaDownloadRelease> {
|
protected async findPackageForDownload(range: string): Promise<JavaDownloadRelease> {
|
||||||
if (this.architecture !== 'x64' && this.architecture !== 'aarch64') {
|
const arch = this.distributionArchitecture();
|
||||||
|
if (arch !== 'x64' && arch !== 'aarch64') {
|
||||||
throw new Error(`Unsupported architecture: ${this.architecture}`);
|
throw new Error(`Unsupported architecture: ${this.architecture}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,9 +54,8 @@ export class MicrosoftDistributions extends JavaBase {
|
||||||
|
|
||||||
const opts = this.getPlatformOption();
|
const opts = this.getPlatformOption();
|
||||||
const availableVersions = availableVersionsRaw.map(item => ({
|
const availableVersions = availableVersionsRaw.map(item => ({
|
||||||
url: `https://aka.ms/download-jdk/microsoft-jdk-${item.version.join('.')}-${opts.os}-${
|
url: `https://aka.ms/download-jdk/microsoft-jdk-${item.version.join('.')}-${opts.os}-${arch
|
||||||
this.architecture
|
}.${opts.archive}`,
|
||||||
}.${opts.archive}`,
|
|
||||||
version: this.convertVersionToSemver(item)
|
version: this.convertVersionToSemver(item)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ export class MicrosoftDistributions extends JavaBase {
|
||||||
];
|
];
|
||||||
|
|
||||||
// M1 is only supported for Java 16 & 17
|
// M1 is only supported for Java 16 & 17
|
||||||
if (process.platform !== 'darwin' || this.architecture !== 'aarch64') {
|
if (process.platform !== 'darwin' || this.distributionArchitecture() !== 'aarch64') {
|
||||||
jdkVersions.push({
|
jdkVersions.push({
|
||||||
version: [11, 0, 13, 8, 1]
|
version: [11, 0, 13, 8, 1]
|
||||||
});
|
});
|
||||||
|
|
|
@ -129,14 +129,17 @@ export class ZuluDistribution extends JavaBase {
|
||||||
hw_bitness: string;
|
hw_bitness: string;
|
||||||
abi: string;
|
abi: string;
|
||||||
} {
|
} {
|
||||||
if (this.architecture == 'x64') {
|
const arch = this.distributionArchitecture();
|
||||||
return { arch: 'x86', hw_bitness: '64', abi: '' };
|
switch (arch) {
|
||||||
} else if (this.architecture == 'x86') {
|
case 'x64':
|
||||||
return { arch: 'x86', hw_bitness: '32', abi: '' };
|
return { arch: 'x86', hw_bitness: '64', abi: '' };
|
||||||
} else if (this.architecture == 'arm64') {
|
case 'x86':
|
||||||
return { arch: 'arm', hw_bitness: '64', abi: '' };
|
return { arch: 'x86', hw_bitness: '32', abi: '' };
|
||||||
} else {
|
case 'aarch64':
|
||||||
return { arch: this.architecture, hw_bitness: '', abi: '' };
|
case 'arm64':
|
||||||
|
return { arch: 'arm', hw_bitness: '64', abi: '' };
|
||||||
|
default:
|
||||||
|
return { arch: arch, hw_bitness: '', abi: '' };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue