@@ -3,6 +3,7 @@ name: Windows package
33on :
44 push :
55 branches : [main]
6+ pull_request :
67 workflow_dispatch :
78
89permissions :
@@ -34,12 +35,34 @@ jobs:
3435 Invoke-WebRequest https://raw.githubusercontent.com/mackron/miniaudio/0.11.25/miniaudio.c -OutFile .deps/miniaudio/miniaudio.c
3536
3637 - name : Compile native Windows helpers
37- shell : cmd
38+ shell : pwsh
3839 run : |
39- if not exist resources\bin mkdir resources\bin
40- call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
41- cl /nologo /O2 native\windows-fast-paste.c /Fe:resources\bin\windows-fast-paste.exe user32.lib
42- cl /nologo /O2 /I .deps\miniaudio native\record-audio.c .deps\miniaudio\miniaudio.c /Fe:resources\bin\universal-dictate-recorder.exe
40+ $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
41+ if (-not (Test-Path $vswhere)) {
42+ throw "vswhere.exe not found at $vswhere"
43+ }
44+
45+ $vsInstall = (& $vswhere -latest -products '*' -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | Select-Object -First 1)
46+ if (-not $vsInstall) {
47+ throw "No Visual Studio installation with the C++ toolchain was found"
48+ }
49+
50+ $vcvars = Join-Path $vsInstall 'VC\Auxiliary\Build\vcvars64.bat'
51+ if (-not (Test-Path $vcvars)) {
52+ throw "vcvars64.bat not found at $vcvars"
53+ }
54+
55+ $commands = @(
56+ "call `"$vcvars`"",
57+ "if not exist resources\bin mkdir resources\bin",
58+ "cl /nologo /O2 native\windows-fast-paste.c /Fe:resources\bin\windows-fast-paste.exe user32.lib",
59+ "cl /nologo /O2 /I .deps\miniaudio native\record-audio.c .deps\miniaudio\miniaudio.c /Fe:resources\bin\universal-dictate-recorder.exe"
60+ ) -join ' && '
61+
62+ cmd.exe /D /S /C $commands
63+ if ($LASTEXITCODE -ne 0) {
64+ exit $LASTEXITCODE
65+ }
4366
4467 - name : Package VSIX
4568 run : npm run package:vsix
0 commit comments