Skip to content

Commit

Permalink
Add support for aarch64 builds (graalvm#9).
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Mar 8, 2022
1 parent a02f4df commit b76e262
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 16 deletions.
38 changes: 25 additions & 13 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const IS_WINDOWS = process.platform === 'win32'
export const VERSION_DEV = 'dev'
export const VERSION_LATEST = 'latest'

export const GRAALVM_ARCH = determineGraalVMArchitecture()
export const GRAALVM_FILE_EXTENSION = IS_WINDOWS ? '.zip' : '.tar.gz'
export const GRAALVM_GH_USER = 'graalvm'
export const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform
Expand All @@ -16,3 +17,17 @@ export const MANDREL_NAMESPACE = 'mandrel-'

export type LatestReleaseResponse =
otypes.Endpoints['GET /repos/{owner}/{repo}/releases/latest']['response']

function determineGraalVMArchitecture(): string {
switch (process.arch) {
case 'x64': {
return 'amd64'
}
case 'arm64': {
return 'aarch64'
}
default: {
throw new Error(`Unsupported architecture: ${process.arch}`)
}
}
}
2 changes: 1 addition & 1 deletion src/graalvm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function determineGraalVMIdentifier(
version: string,
javaVersion: string
): string {
return `graalvm-ce-java${javaVersion}-${c.GRAALVM_PLATFORM}-amd64-${version}`
return `graalvm-ce-java${javaVersion}-${c.GRAALVM_PLATFORM}-${c.GRAALVM_ARCH}-${version}`
}

function determineToolName(javaVersion: string): string {
Expand Down
2 changes: 1 addition & 1 deletion src/mandrel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function determineMandrelIdentifier(
version: string,
javaVersion: string
): string {
return `mandrel-java${javaVersion}-${c.GRAALVM_PLATFORM}-amd64-${version}`
return `mandrel-java${javaVersion}-${c.GRAALVM_PLATFORM}-${c.GRAALVM_ARCH}-${version}`
}

function determineToolName(javaVersion: string): string {
Expand Down

0 comments on commit b76e262

Please sign in to comment.