mirror of
https://github.com/graalvm/setup-graalvm.git
synced 2025-01-18 19:26:39 +08:00
Musl support
This commit is contained in:
parent
df4b80eebe
commit
049aa7c191
@ -1,4 +1,5 @@
|
||||
import * as liberica from '../src/liberica'
|
||||
import * as c from '../src/constants'
|
||||
import * as path from 'path'
|
||||
import * as semver from 'semver'
|
||||
import {expect, test} from '@jest/globals'
|
||||
@ -35,18 +36,22 @@ test('find latest JDK version', async () => {
|
||||
}, 30000)
|
||||
|
||||
test('find asset URL', async () => {
|
||||
await expectURL(
|
||||
'17.0.10+13',
|
||||
'core',
|
||||
'bellsoft-liberica-vm-core-openjdk17.0.10'
|
||||
)
|
||||
await expectURL('11.0.22+12', '', 'bellsoft-liberica-vm-openjdk11.0.22')
|
||||
await expectURL('17.0.10+13', 'std', 'bellsoft-liberica-vm-openjdk17.0.10')
|
||||
await expectURL(
|
||||
'21.0.2+14',
|
||||
'core',
|
||||
'bellsoft-liberica-vm-core-openjdk21.0.2'
|
||||
)
|
||||
|
||||
if (!c.IS_LINUX) {
|
||||
// This check can fail on Linux because there's no `full` version for aarch64 and musl
|
||||
await expectURL(
|
||||
'21.0.2+14',
|
||||
'full',
|
||||
'bellsoft-liberica-vm-full-openjdk21.0.2'
|
||||
)
|
||||
await expectURL('21.0.2+14', '', 'bellsoft-liberica-vm-openjdk21.0.2')
|
||||
}
|
||||
}, 10000)
|
||||
|
||||
type verifier = (
|
||||
|
16
dist/main/index.js
generated
vendored
16
dist/main/index.js
generated
vendored
@ -94349,6 +94349,7 @@ const c = __importStar(__nccwpck_require__(9042));
|
||||
const semver = __importStar(__nccwpck_require__(1383));
|
||||
const utils_1 = __nccwpck_require__(1314);
|
||||
const tool_cache_1 = __nccwpck_require__(7784);
|
||||
const child_process_1 = __nccwpck_require__(2081);
|
||||
const LIBERICA_GH_USER = 'bell-sw';
|
||||
const LIBERICA_RELEASES_REPO = 'LibericaNIK';
|
||||
const LIBERICA_JDK_TAG_PREFIX = 'jdk-';
|
||||
@ -94409,9 +94410,22 @@ function determineToolName(javaVersion, version) {
|
||||
return `${LIBERICA_VM_PREFIX}${determineToolVersionPart(version)}openjdk${javaVersion}-${determinePlatformPart()}`;
|
||||
}
|
||||
function determinePlatformPart() {
|
||||
// for linux-musl, return `linux-${c.JDK_ARCH}-musl`
|
||||
if (isMuslBasedLinux()) {
|
||||
return `linux-${c.JDK_ARCH}-musl`;
|
||||
}
|
||||
else {
|
||||
return `${c.JDK_PLATFORM}-${c.GRAALVM_ARCH}`;
|
||||
}
|
||||
}
|
||||
function isMuslBasedLinux() {
|
||||
if (c.IS_LINUX) {
|
||||
const output = (0, child_process_1.spawnSync)('ldd', ['--version']).stderr.toString('utf8');
|
||||
if (output.indexOf('musl') > -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isDigit(c) {
|
||||
return c.charAt(0) >= '0' && c.charAt(0) <= '9';
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import {
|
||||
getMatchingTags
|
||||
} from './utils'
|
||||
import {downloadTool} from '@actions/tool-cache'
|
||||
import {spawnSync} from 'child_process'
|
||||
|
||||
const LIBERICA_GH_USER = 'bell-sw'
|
||||
const LIBERICA_RELEASES_REPO = 'LibericaNIK'
|
||||
@ -96,9 +97,22 @@ function determineToolName(javaVersion: string, version: string) {
|
||||
}
|
||||
|
||||
function determinePlatformPart() {
|
||||
// for linux-musl, return `linux-${c.JDK_ARCH}-musl`
|
||||
if (isMuslBasedLinux()) {
|
||||
return `linux-${c.JDK_ARCH}-musl`
|
||||
} else {
|
||||
return `${c.JDK_PLATFORM}-${c.GRAALVM_ARCH}`
|
||||
}
|
||||
}
|
||||
|
||||
function isMuslBasedLinux() {
|
||||
if (c.IS_LINUX) {
|
||||
const output = spawnSync('ldd', ['--version']).stderr.toString('utf8')
|
||||
if (output.indexOf('musl') > -1) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function isDigit(c: string) {
|
||||
return c.charAt(0) >= '0' && c.charAt(0) <= '9'
|
||||
|
Loading…
x
Reference in New Issue
Block a user