Move distributionArchitecture method to base class

They are mostly all the same, and this can still be overridden when needed
This commit is contained in:
Wes Morgan 2022-09-13 08:43:08 -06:00
parent 46869be4a8
commit f21b8ec265
No known key found for this signature in database
GPG key ID: 5639E4CBFA17DC84
2 changed files with 17 additions and 15 deletions

View file

@ -151,6 +151,22 @@ export abstract class JavaBase {
}
protected distributionArchitecture(): string {
// 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;
}
}
}

View file

@ -152,18 +152,4 @@ export class TemurinDistribution extends JavaBase {
return process.platform;
}
}
protected distributionArchitecture(): string {
// Temurin has own architecture names so need to map them
switch (this.architecture) {
case 'amd64':
return 'x64';
case 'ia32':
return 'x32';
case 'arm64':
return 'aarch64';
default:
return this.architecture;
}
}
}