Add support for aarch64 builds (#9).

This commit is contained in:
Fabio Niephaus 2022-03-08 10:47:41 +01:00
parent a02f4df8f7
commit b76e2627a2
No known key found for this signature in database
GPG Key ID: F21CF5275F31DFD6
5 changed files with 43 additions and 16 deletions

38
dist/index.js generated vendored
View File

@ -7,17 +7,31 @@ require('./sourcemap-register.js');/******/ (() => { // webpackBootstrap
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = void 0; exports.MANDREL_NAMESPACE = exports.JDK_HOME_SUFFIX = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = void 0;
exports.IS_LINUX = process.platform === 'linux'; exports.IS_LINUX = process.platform === 'linux';
exports.IS_MACOS = process.platform === 'darwin'; exports.IS_MACOS = process.platform === 'darwin';
exports.IS_WINDOWS = process.platform === 'win32'; exports.IS_WINDOWS = process.platform === 'win32';
exports.VERSION_DEV = 'dev'; exports.VERSION_DEV = 'dev';
exports.VERSION_LATEST = 'latest'; exports.VERSION_LATEST = 'latest';
exports.GRAALVM_ARCH = determineGraalVMArchitecture();
exports.GRAALVM_FILE_EXTENSION = exports.IS_WINDOWS ? '.zip' : '.tar.gz'; exports.GRAALVM_FILE_EXTENSION = exports.IS_WINDOWS ? '.zip' : '.tar.gz';
exports.GRAALVM_GH_USER = 'graalvm'; exports.GRAALVM_GH_USER = 'graalvm';
exports.GRAALVM_PLATFORM = exports.IS_WINDOWS ? 'windows' : process.platform; exports.GRAALVM_PLATFORM = exports.IS_WINDOWS ? 'windows' : process.platform;
exports.JDK_HOME_SUFFIX = exports.IS_MACOS ? '/Contents/Home' : ''; exports.JDK_HOME_SUFFIX = exports.IS_MACOS ? '/Contents/Home' : '';
exports.MANDREL_NAMESPACE = 'mandrel-'; exports.MANDREL_NAMESPACE = 'mandrel-';
function determineGraalVMArchitecture() {
switch (process.arch) {
case 'x64': {
return 'amd64';
}
case 'arm64': {
return 'aarch64';
}
default: {
throw new Error(`Unsupported architecture: ${process.arch}`);
}
}
}
/***/ }), /***/ }),
@ -252,7 +266,7 @@ function setUpGraalVMRelease(version, javaVersion) {
} }
exports.setUpGraalVMRelease = setUpGraalVMRelease; exports.setUpGraalVMRelease = setUpGraalVMRelease;
function determineGraalVMIdentifier(version, javaVersion) { function determineGraalVMIdentifier(version, javaVersion) {
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) { function determineToolName(javaVersion) {
return `graalvm-ce-java${javaVersion}-${c.GRAALVM_PLATFORM}`; return `graalvm-ce-java${javaVersion}-${c.GRAALVM_PLATFORM}`;
@ -497,7 +511,7 @@ function setUpMandrelRelease(version, javaVersion) {
}); });
} }
function determineMandrelIdentifier(version, javaVersion) { function determineMandrelIdentifier(version, javaVersion) {
return `mandrel-java${javaVersion}-${c.GRAALVM_PLATFORM}-amd64-${version}`; return `mandrel-java${javaVersion}-${c.GRAALVM_PLATFORM}-${c.GRAALVM_ARCH}-${version}`;
} }
function determineToolName(javaVersion) { function determineToolName(javaVersion) {
return `mandrel-java${javaVersion}-${c.GRAALVM_PLATFORM}`; return `mandrel-java${javaVersion}-${c.GRAALVM_PLATFORM}`;
@ -11241,16 +11255,14 @@ function bytesToUuid(buf, offset) {
var i = offset || 0; var i = offset || 0;
var bth = byteToHex; var bth = byteToHex;
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
return ([ return ([bth[buf[i++]], bth[buf[i++]],
bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-',
bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-',
bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-',
bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-',
bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]],
bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]],
bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]]).join('');
bth[buf[i++]], bth[buf[i++]]
]).join('');
} }
module.exports = bytesToUuid; module.exports = bytesToUuid;

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -7,6 +7,7 @@ export const IS_WINDOWS = process.platform === 'win32'
export const VERSION_DEV = 'dev' export const VERSION_DEV = 'dev'
export const VERSION_LATEST = 'latest' export const VERSION_LATEST = 'latest'
export const GRAALVM_ARCH = determineGraalVMArchitecture()
export const GRAALVM_FILE_EXTENSION = IS_WINDOWS ? '.zip' : '.tar.gz' export const GRAALVM_FILE_EXTENSION = IS_WINDOWS ? '.zip' : '.tar.gz'
export const GRAALVM_GH_USER = 'graalvm' export const GRAALVM_GH_USER = 'graalvm'
export const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform export const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform
@ -16,3 +17,17 @@ export const MANDREL_NAMESPACE = 'mandrel-'
export type LatestReleaseResponse = export type LatestReleaseResponse =
otypes.Endpoints['GET /repos/{owner}/{repo}/releases/latest']['response'] 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}`)
}
}
}

View File

@ -52,7 +52,7 @@ function determineGraalVMIdentifier(
version: string, version: string,
javaVersion: string javaVersion: string
): 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 { function determineToolName(javaVersion: string): string {

View File

@ -54,7 +54,7 @@ function determineMandrelIdentifier(
version: string, version: string,
javaVersion: string javaVersion: string
): 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 { function determineToolName(javaVersion: string): string {