Skip to content

Commit 64e9662

Browse files
committed
Always attempt MSVC environment setup on Windows
GraalVM native-image (released versions ≤21.0.x) uses a `20\d\d` regex to find Visual Studio installations, which does not match VS 2026's `\18\` directory. Previously, the action skipped MSVC setup for JDK 17+ assuming native-image handles it — but it can't find VS 2026. Now the action always runs vcvarsall.bat on Windows, putting cl.exe on PATH so native-image skips its own detection. For JDK 17+ and dev builds, failures are non-fatal (warning instead of error) since future native-image versions with vswhere support will handle it. Fixes #220
1 parent 809afe6 commit 64e9662

4 files changed

Lines changed: 4 additions & 66 deletions

File tree

__tests__/msvc.test.ts

Lines changed: 0 additions & 27 deletions
This file was deleted.

dist/main.js

Lines changed: 2 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async function run(): Promise<void> {
3232
const isGraalVMforJDK17OrLater = distribution.length > 0 || graalVMVersion.length == 0
3333

3434
if (c.IS_WINDOWS) {
35-
setUpWindowsEnvironment(javaVersion, graalVMVersion, isGraalVMforJDK17OrLater)
35+
setUpWindowsEnvironment()
3636
}
3737
await setUpDependencies(components)
3838
if (enableNativeImageMusl) {

src/msvc.ts

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import * as core from '@actions/core'
22
import { execSync } from 'child_process'
33
import { existsSync } from 'fs'
4-
import { VERSION_DEV } from './constants.js'
5-
64
// Keep in sync with https://github.com/actions/virtual-environments
75
const KNOWN_VISUAL_STUDIO_INSTALLATIONS = [
86
'C:\\Program Files\\Microsoft Visual Studio\\18\\Enterprise', // 'windows-2025' and 'windows-latest'
@@ -26,28 +24,7 @@ function findVcvarsallPath(): string {
2624
throw new Error('Failed to find vcvarsall.bat')
2725
}
2826

29-
export function needsWindowsEnvironmentSetup(
30-
javaVersion: string,
31-
graalVMVersion: string,
32-
isGraalVMforJDK17OrLater: boolean
33-
): boolean {
34-
if (javaVersion === VERSION_DEV || graalVMVersion === VERSION_DEV) {
35-
return false // no longer required in dev builds
36-
} else if (isGraalVMforJDK17OrLater) {
37-
return false // no longer required in GraalVM for JDK 17 and later.
38-
}
39-
return true
40-
}
41-
42-
export function setUpWindowsEnvironment(
43-
javaVersion: string,
44-
graalVMVersion: string,
45-
isGraalVMforJDK17OrLater: boolean
46-
): void {
47-
if (!needsWindowsEnvironmentSetup(javaVersion, graalVMVersion, isGraalVMforJDK17OrLater)) {
48-
return
49-
}
50-
27+
export function setUpWindowsEnvironment(): void {
5128
core.startGroup('Updating Windows environment...')
5229

5330
const vcvarsallPath = findVcvarsallPath()

0 commit comments

Comments
 (0)