Disable MSVC feature for javaVersion gte 18.

Fixes #32.
This commit is contained in:
Fabio Niephaus 2024-02-22 11:25:13 +01:00 committed by Fabio Niephaus
parent a2b35c9a1c
commit 7652cc43b3
3 changed files with 15 additions and 3 deletions

BIN
dist/main/index.js generated vendored

Binary file not shown.

View File

@ -31,7 +31,7 @@ async function run(): Promise<void> {
const enableNativeImageMusl = core.getInput(c.INPUT_NI_MUSL) === 'true'
if (c.IS_WINDOWS) {
setUpWindowsEnvironment(graalVMVersion)
setUpWindowsEnvironment(javaVersion, graalVMVersion)
}
await setUpDependencies(components)
if (enableNativeImageMusl) {

View File

@ -1,4 +1,5 @@
import * as core from '@actions/core'
import * as semver from 'semver'
import {execSync} from 'child_process'
import {existsSync} from 'fs'
import {VERSION_DEV} from './constants'
@ -27,10 +28,21 @@ function findVcvarsallPath(): string {
throw new Error('Failed to find vcvarsall.bat')
}
export function setUpWindowsEnvironment(graalVMVersion: string): void {
if (graalVMVersion === VERSION_DEV) {
export function setUpWindowsEnvironment(
javaVersion: string,
graalVMVersion: string
): void {
if (javaVersion === javaVersion || graalVMVersion === VERSION_DEV) {
return // no longer required in dev builds
}
const javaVersionSemVer = semver.coerce(javaVersion)
if (
javaVersionSemVer &&
semver.valid(javaVersionSemVer) &&
semver.gte(javaVersionSemVer, '18.0.0')
) {
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
}
core.startGroup('Updating Windows environment...')