Skip to content

Commit bbb7b9f

Browse files
authored
Fix bootstrap CI and Windows packaging
Fix VS Code diagnostics API usage, run Windows packaging on pull requests, discover the current MSVC toolchain dynamically, and add repository metadata required by vsce packaging.
1 parent 94e542d commit bbb7b9f

3 files changed

Lines changed: 37 additions & 7 deletions

File tree

.github/workflows/windows-package.yml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Windows package
33
on:
44
push:
55
branches: [main]
6+
pull_request:
67
workflow_dispatch:
78

89
permissions:
@@ -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

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
"private": true,
77
"license": "MIT",
88
"publisher": "gcalpay",
9+
"repository": {
10+
"type": "git",
11+
"url": "https://github.com/gcalpay/vscode-universal-dictate.git"
12+
},
913
"engines": {
1014
"vscode": "^1.96.0"
1115
},

src/extension.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ export function activate(context: vscode.ExtensionContext): void {
3232
const extension = vscode.extensions.getExtension(
3333
'gcalpay.vscode-universal-dictate'
3434
);
35-
const extensionKind = extension?.extensionKind ?? 'unknown';
35+
const declaredKinds = extension?.packageJSON?.extensionKind;
36+
const extensionKind = Array.isArray(declaredKinds)
37+
? declaredKinds.join(',')
38+
: String(declaredKinds ?? 'unspecified');
3639
const remoteName = vscode.env.remoteName ?? 'none';
3740
const nativeHelper = getNativePasteHelperPath(context);
3841

@@ -41,7 +44,7 @@ export function activate(context: vscode.ExtensionContext): void {
4144
`platform=${process.platform}`,
4245
`arch=${process.arch}`,
4346
`remote=${remoteName}`,
44-
`extensionKind=${String(extensionKind)}`,
47+
`extensionKind=${extensionKind}`,
4548
`nativePaste=${fs.existsSync(nativeHelper) ? 'available' : 'fallback'}`
4649
].join(' | '),
4750
{ modal: true }

0 commit comments

Comments
 (0)