Skip to content

Commit

Permalink
Disable MSVC feature for javaVersion gte 18.
Browse files Browse the repository at this point in the history
Fixes #32.
  • Loading branch information
fniephaus committed Feb 22, 2024
1 parent ca91f39 commit 0fee1ab
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
13 changes: 10 additions & 3 deletions dist/main/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 src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
16 changes: 14 additions & 2 deletions src/msvc.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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...')

Expand Down

0 comments on commit 0fee1ab

Please sign in to comment.