Compare commits
3 Commits
fniephaus/
...
v1.1.9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d7ab58c1d | ||
|
|
d3f9e14fc3 | ||
|
|
b03aef7455 |
36
__tests__/msvc.test.ts
Normal file
36
__tests__/msvc.test.ts
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import * as path from 'path'
|
||||||
|
import {expect, test} from '@jest/globals'
|
||||||
|
import {needsWindowsEnvironmentSetup} from '../src/msvc'
|
||||||
|
import {VERSION_DEV, VERSION_LATEST} from '../src/constants'
|
||||||
|
|
||||||
|
process.env['RUNNER_TOOL_CACHE'] = path.join(__dirname, 'TOOL_CACHE')
|
||||||
|
process.env['RUNNER_TEMP'] = path.join(__dirname, 'TEMP')
|
||||||
|
|
||||||
|
test('decide whether Window env must be set up for GraalVM for JDK', async () => {
|
||||||
|
for (var javaVersion of [
|
||||||
|
'17',
|
||||||
|
'17.0.8',
|
||||||
|
'17.0',
|
||||||
|
'21',
|
||||||
|
'22',
|
||||||
|
'22-ea',
|
||||||
|
'23-ea',
|
||||||
|
VERSION_DEV
|
||||||
|
]) {
|
||||||
|
expect(needsWindowsEnvironmentSetup(javaVersion, '', true)).toBe(false)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
test('decide whether Window env must be set up for legacy GraalVM', async () => {
|
||||||
|
for (var combination of [
|
||||||
|
['7', '22.3.0'],
|
||||||
|
['17', '22.3'],
|
||||||
|
['7', '22.3'],
|
||||||
|
['7', VERSION_DEV],
|
||||||
|
['17', VERSION_LATEST]
|
||||||
|
]) {
|
||||||
|
expect(
|
||||||
|
needsWindowsEnvironmentSetup(combination[0], combination[1], false)
|
||||||
|
).toBe(combination[1] !== VERSION_DEV)
|
||||||
|
}
|
||||||
|
})
|
||||||
29
dist/main/index.js
generated
vendored
29
dist/main/index.js
generated
vendored
@@ -93661,7 +93661,7 @@ const assert_1 = __nccwpck_require__(9491);
|
|||||||
const uuid_1 = __nccwpck_require__(5840);
|
const uuid_1 = __nccwpck_require__(5840);
|
||||||
function downloadGraalVMEELegacy(gdsToken, version, javaVersion) {
|
function downloadGraalVMEELegacy(gdsToken, version, javaVersion) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const userAgent = `GraalVMGitHubAction/1.1.8 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`;
|
const userAgent = `GraalVMGitHubAction/1.1.9 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`;
|
||||||
const baseArtifact = yield fetchArtifact(userAgent, 'isBase:True', version, javaVersion);
|
const baseArtifact = yield fetchArtifact(userAgent, 'isBase:True', version, javaVersion);
|
||||||
return downloadArtifact(gdsToken, userAgent, baseArtifact);
|
return downloadArtifact(gdsToken, userAgent, baseArtifact);
|
||||||
});
|
});
|
||||||
@@ -94270,15 +94270,15 @@ function run() {
|
|||||||
const cache = core.getInput(c.INPUT_CACHE);
|
const cache = core.getInput(c.INPUT_CACHE);
|
||||||
const enableCheckForUpdates = core.getInput(c.INPUT_CHECK_FOR_UPDATES) === 'true';
|
const enableCheckForUpdates = core.getInput(c.INPUT_CHECK_FOR_UPDATES) === 'true';
|
||||||
const enableNativeImageMusl = core.getInput(c.INPUT_NI_MUSL) === 'true';
|
const enableNativeImageMusl = core.getInput(c.INPUT_NI_MUSL) === 'true';
|
||||||
|
const isGraalVMforJDK17OrLater = distribution.length > 0 || graalVMVersion.length == 0;
|
||||||
if (c.IS_WINDOWS) {
|
if (c.IS_WINDOWS) {
|
||||||
(0, msvc_1.setUpWindowsEnvironment)(javaVersion, graalVMVersion);
|
(0, msvc_1.setUpWindowsEnvironment)(javaVersion, graalVMVersion, isGraalVMforJDK17OrLater);
|
||||||
}
|
}
|
||||||
yield (0, dependencies_1.setUpDependencies)(components);
|
yield (0, dependencies_1.setUpDependencies)(components);
|
||||||
if (enableNativeImageMusl) {
|
if (enableNativeImageMusl) {
|
||||||
yield (0, musl_1.setUpNativeImageMusl)();
|
yield (0, musl_1.setUpNativeImageMusl)();
|
||||||
}
|
}
|
||||||
// Download GraalVM JDK
|
// Download GraalVM JDK
|
||||||
const isGraalVMforJDK17OrLater = distribution.length > 0 || graalVMVersion.length == 0;
|
|
||||||
let graalVMHome;
|
let graalVMHome;
|
||||||
if (isGraalVMforJDK17OrLater) {
|
if (isGraalVMforJDK17OrLater) {
|
||||||
if (enableCheckForUpdates &&
|
if (enableCheckForUpdates &&
|
||||||
@@ -94570,9 +94570,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.setUpWindowsEnvironment = void 0;
|
exports.setUpWindowsEnvironment = exports.needsWindowsEnvironmentSetup = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const semver = __importStar(__nccwpck_require__(1383));
|
|
||||||
const child_process_1 = __nccwpck_require__(2081);
|
const child_process_1 = __nccwpck_require__(2081);
|
||||||
const fs_1 = __nccwpck_require__(7147);
|
const fs_1 = __nccwpck_require__(7147);
|
||||||
const constants_1 = __nccwpck_require__(9042);
|
const constants_1 = __nccwpck_require__(9042);
|
||||||
@@ -94596,15 +94595,19 @@ function findVcvarsallPath() {
|
|||||||
}
|
}
|
||||||
throw new Error('Failed to find vcvarsall.bat');
|
throw new Error('Failed to find vcvarsall.bat');
|
||||||
}
|
}
|
||||||
function setUpWindowsEnvironment(javaVersion, graalVMVersion) {
|
function needsWindowsEnvironmentSetup(javaVersion, graalVMVersion, isGraalVMforJDK17OrLater) {
|
||||||
if (javaVersion === javaVersion || graalVMVersion === constants_1.VERSION_DEV) {
|
if (javaVersion === constants_1.VERSION_DEV || graalVMVersion === constants_1.VERSION_DEV) {
|
||||||
return; // no longer required in dev builds
|
return false; // no longer required in dev builds
|
||||||
}
|
}
|
||||||
const javaVersionSemVer = semver.coerce(javaVersion);
|
else if (isGraalVMforJDK17OrLater) {
|
||||||
if (javaVersionSemVer &&
|
return false; // no longer required in GraalVM for JDK 17 and later.
|
||||||
semver.valid(javaVersionSemVer) &&
|
}
|
||||||
semver.gte(javaVersionSemVer, '18.0.0')) {
|
return true;
|
||||||
return; // no longer required in GraalVM for JDK 17 and later. JDK 17 builds from 22.3 still need this, so skip 17.X.X
|
}
|
||||||
|
exports.needsWindowsEnvironmentSetup = needsWindowsEnvironmentSetup;
|
||||||
|
function setUpWindowsEnvironment(javaVersion, graalVMVersion, isGraalVMforJDK17OrLater) {
|
||||||
|
if (!needsWindowsEnvironmentSetup(javaVersion, graalVMVersion, isGraalVMforJDK17OrLater)) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
core.startGroup('Updating Windows environment...');
|
core.startGroup('Updating Windows environment...');
|
||||||
const vcvarsallPath = findVcvarsallPath();
|
const vcvarsallPath = findVcvarsallPath();
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-graalvm",
|
"name": "setup-graalvm",
|
||||||
"version": "1.1.8",
|
"version": "1.1.9",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "setup-graalvm",
|
"name": "setup-graalvm",
|
||||||
"version": "1.1.8",
|
"version": "1.1.9",
|
||||||
"license": "UPL",
|
"license": "UPL",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^3.2.3",
|
"@actions/cache": "^3.2.3",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-graalvm",
|
"name": "setup-graalvm",
|
||||||
"version": "1.1.8",
|
"version": "1.1.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "GitHub Action for GraalVM",
|
"description": "GitHub Action for GraalVM",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export async function downloadGraalVMEELegacy(
|
|||||||
version: string,
|
version: string,
|
||||||
javaVersion: string
|
javaVersion: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const userAgent = `GraalVMGitHubAction/1.1.8 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`
|
const userAgent = `GraalVMGitHubAction/1.1.9 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`
|
||||||
const baseArtifact = await fetchArtifact(
|
const baseArtifact = await fetchArtifact(
|
||||||
userAgent,
|
userAgent,
|
||||||
'isBase:True',
|
'isBase:True',
|
||||||
|
|||||||
10
src/main.ts
10
src/main.ts
@@ -30,9 +30,15 @@ async function run(): Promise<void> {
|
|||||||
const enableCheckForUpdates =
|
const enableCheckForUpdates =
|
||||||
core.getInput(c.INPUT_CHECK_FOR_UPDATES) === 'true'
|
core.getInput(c.INPUT_CHECK_FOR_UPDATES) === 'true'
|
||||||
const enableNativeImageMusl = core.getInput(c.INPUT_NI_MUSL) === 'true'
|
const enableNativeImageMusl = core.getInput(c.INPUT_NI_MUSL) === 'true'
|
||||||
|
const isGraalVMforJDK17OrLater =
|
||||||
|
distribution.length > 0 || graalVMVersion.length == 0
|
||||||
|
|
||||||
if (c.IS_WINDOWS) {
|
if (c.IS_WINDOWS) {
|
||||||
setUpWindowsEnvironment(javaVersion, graalVMVersion)
|
setUpWindowsEnvironment(
|
||||||
|
javaVersion,
|
||||||
|
graalVMVersion,
|
||||||
|
isGraalVMforJDK17OrLater
|
||||||
|
)
|
||||||
}
|
}
|
||||||
await setUpDependencies(components)
|
await setUpDependencies(components)
|
||||||
if (enableNativeImageMusl) {
|
if (enableNativeImageMusl) {
|
||||||
@@ -40,8 +46,6 @@ async function run(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Download GraalVM JDK
|
// Download GraalVM JDK
|
||||||
const isGraalVMforJDK17OrLater =
|
|
||||||
distribution.length > 0 || graalVMVersion.length == 0
|
|
||||||
let graalVMHome
|
let graalVMHome
|
||||||
if (isGraalVMforJDK17OrLater) {
|
if (isGraalVMforJDK17OrLater) {
|
||||||
if (
|
if (
|
||||||
|
|||||||
30
src/msvc.ts
30
src/msvc.ts
@@ -28,20 +28,32 @@ function findVcvarsallPath(): string {
|
|||||||
throw new Error('Failed to find vcvarsall.bat')
|
throw new Error('Failed to find vcvarsall.bat')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function needsWindowsEnvironmentSetup(
|
||||||
|
javaVersion: string,
|
||||||
|
graalVMVersion: string,
|
||||||
|
isGraalVMforJDK17OrLater: boolean
|
||||||
|
): boolean {
|
||||||
|
if (javaVersion === VERSION_DEV || graalVMVersion === VERSION_DEV) {
|
||||||
|
return false // no longer required in dev builds
|
||||||
|
} else if (isGraalVMforJDK17OrLater) {
|
||||||
|
return false // no longer required in GraalVM for JDK 17 and later.
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
export function setUpWindowsEnvironment(
|
export function setUpWindowsEnvironment(
|
||||||
javaVersion: string,
|
javaVersion: string,
|
||||||
graalVMVersion: string
|
graalVMVersion: string,
|
||||||
|
isGraalVMforJDK17OrLater: boolean
|
||||||
): void {
|
): void {
|
||||||
if (javaVersion === javaVersion || graalVMVersion === VERSION_DEV) {
|
|
||||||
return // no longer required in dev builds
|
|
||||||
}
|
|
||||||
const javaVersionSemVer = semver.coerce(javaVersion)
|
|
||||||
if (
|
if (
|
||||||
javaVersionSemVer &&
|
!needsWindowsEnvironmentSetup(
|
||||||
semver.valid(javaVersionSemVer) &&
|
javaVersion,
|
||||||
semver.gte(javaVersionSemVer, '18.0.0')
|
graalVMVersion,
|
||||||
|
isGraalVMforJDK17OrLater
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
return // no longer required in GraalVM for JDK 17 and later. JDK 17 builds from 22.3 still need this, so skip 17.X.X
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
core.startGroup('Updating Windows environment...')
|
core.startGroup('Updating Windows environment...')
|
||||||
|
|||||||
Reference in New Issue
Block a user