diff --git a/src/distributions/base-installer.ts b/src/distributions/base-installer.ts index fe5fcdc6..ea63e8aa 100644 --- a/src/distributions/base-installer.ts +++ b/src/distributions/base-installer.ts @@ -151,6 +151,22 @@ export abstract class JavaBase { } protected distributionArchitecture(): string { - return this.architecture; + // 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; + } } } diff --git a/src/distributions/temurin/installer.ts b/src/distributions/temurin/installer.ts index 598cdba9..11658576 100644 --- a/src/distributions/temurin/installer.ts +++ b/src/distributions/temurin/installer.ts @@ -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; - } - } }