mirror of
https://github.com/actions/setup-java.git
synced 2025-04-21 10:26:46 +00:00
Refactor arch mapping to distributionArchitecture method
This commit is contained in:
parent
cca7653671
commit
e169777d50
2 changed files with 9 additions and 5 deletions
|
@ -149,4 +149,8 @@ export abstract class JavaBase {
|
||||||
core.setOutput('path', toolPath);
|
core.setOutput('path', toolPath);
|
||||||
core.setOutput('version', version);
|
core.setOutput('version', version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected distributionArchitecture(): string {
|
||||||
|
return this.architecture;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ export class TemurinDistribution extends JavaBase {
|
||||||
private readonly jvmImpl: TemurinImplementation
|
private readonly jvmImpl: TemurinImplementation
|
||||||
) {
|
) {
|
||||||
super(`Temurin-${jvmImpl}`, installerOptions);
|
super(`Temurin-${jvmImpl}`, installerOptions);
|
||||||
installerOptions.architecture = this.osArchToDistributionArch(installerOptions.architecture);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async findPackageForDownload(version: string): Promise<JavaDownloadRelease> {
|
protected async findPackageForDownload(version: string): Promise<JavaDownloadRelease> {
|
||||||
|
@ -87,7 +86,7 @@ export class TemurinDistribution extends JavaBase {
|
||||||
|
|
||||||
private async getAvailableVersions(): Promise<ITemurinAvailableVersions[]> {
|
private async getAvailableVersions(): Promise<ITemurinAvailableVersions[]> {
|
||||||
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';
|
||||||
|
@ -154,8 +153,9 @@ export class TemurinDistribution extends JavaBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private osArchToDistributionArch(osArch: string): string {
|
protected distributionArchitecture(): string {
|
||||||
switch (osArch) {
|
// Temurin has own architecture names so need to map them
|
||||||
|
switch (this.architecture) {
|
||||||
case 'amd64':
|
case 'amd64':
|
||||||
return 'x64';
|
return 'x64';
|
||||||
case 'ia32':
|
case 'ia32':
|
||||||
|
@ -163,7 +163,7 @@ export class TemurinDistribution extends JavaBase {
|
||||||
case 'arm64':
|
case 'arm64':
|
||||||
return 'aarch64';
|
return 'aarch64';
|
||||||
default:
|
default:
|
||||||
return osArch;
|
return this.architecture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue