also looking at this
feat: add Linux and Windows named-window routing
#325
29 files
+2250
-200
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -112,8 +112,16 @@ jobs: | ||
| 112 | 112 | run: | |
| 113 | 113 | # The Pantry .bin shim can print zig version but cannot locate Zig's |
| 114 | 114 | # lib directory during a build. Run the locked package binary itself. |
| 115 | $env:CRAFT_ZIG = Join-Path $env:GITHUB_WORKSPACE 'pantry/ziglang-org/0.17.0-dev.1963_e00c6c439/bin/zig.exe' | |
| 116 | if (-not (Test-Path -LiteralPath $env:CRAFT_ZIG)) { throw "Pinned Zig executable missing: $env:CRAFT_ZIG" } | |
| 115 | $package = Join-Path $env:GITHUB_WORKSPACE 'pantry/ziglang-org/0.17.0-dev.1963_e00c6c439' | |
| 116 | $env:CRAFT_ZIG = '' | |
| 117 | foreach ($candidate in @((Join-Path $package 'zig.exe'), (Join-Path $package 'bin/zig.exe'))) { | |
| 118 | if (Test-Path -LiteralPath $candidate) { $env:CRAFT_ZIG = $candidate; break } | |
| 119 | } | |
| 120 | if (-not $env:CRAFT_ZIG) { | |
| 121 | Get-ChildItem (Join-Path $env:GITHUB_WORKSPACE 'pantry') -Filter zig.exe -Recurse -File | | |
| 122 | Select-Object -ExpandProperty FullName | |
| 123 | throw "Pinned Zig executable missing from $package" | |
| 124 | } | |
| 117 | 125 | bun run build:core |
| 118 | 126 | |
| 119 | 127 | - name: Stage pinned WebView2 loader |
| @@ -31,11 +31,18 @@ test('accepts only the locked snapshot by default, even when PATH shadows it', ( | ||
| 31 | 31 | test('Windows uses the pinned Pantry installation instead of its .bin shim', () => { |
| 32 | 32 | const f = fixture() |
| 33 | 33 | const version = pinnedZigVersion(f.root) |
| 34 | const installed = join(f.root, 'pantry/ziglang-org/0.17.0-dev.1963_e00c6c439/bin/zig.exe') | |
| 34 | const packageDir = join(f.root, 'pantry/ziglang-org/0.17.0-dev.1963_e00c6c439') | |
| 35 | const installed = join(packageDir, 'zig.exe') | |
| 35 | 36 | expect(pinnedPantryZigPath(f.root, version, f.env, 'win32')).toBeNull() |
| 36 | mkdirSync(join(installed, '..'), { recursive: true }) | |
| 37 | mkdirSync(packageDir, { recursive: true }) | |
| 37 | 38 | writeFileSync(installed, '') |
| 38 | 39 | expect(pinnedPantryZigPath(f.root, version, f.env, 'win32')).toBe(installed) |
| 40 | const mirrored = join(packageDir, 'bin/zig.exe') | |
| 41 | mkdirSync(join(packageDir, 'bin')) | |
| 42 | writeFileSync(mirrored, '') | |
| 43 | expect(pinnedPantryZigPath(f.root, version, f.env, 'win32')).toBe(installed) | |
| 44 | rmSync(installed) | |
| 45 | expect(pinnedPantryZigPath(f.root, version, f.env, 'win32')).toBe(mirrored) | |
| 39 | 46 | expect(pinnedPantryZigPath(f.root, version, { ...f.env, CRAFT_ZIG: f.path }, 'win32')).toBeNull() |
| 40 | 47 | expect(pinnedPantryZigPath(f.root, version, f.env, 'darwin')).toBeNull() |
| 41 | 48 | }) |
| @@ -11,8 +11,13 @@ export function pinnedZigVersion(root: string): string { | ||
| 11 | 11 | |
| 12 | 12 | export function pinnedPantryZigPath(root: string, expected: string, env: NodeJS.ProcessEnv, hostPlatform: string): string | null { |
| 13 | 13 | if (hostPlatform !== 'win32' || env.CRAFT_ZIG) return null |
| 14 | const installed = join(root, 'pantry', 'ziglang-org', expected.replace('+', '_'), 'bin', 'zig.exe') | |
| 15 | return existsSync(installed) ? installed : null | |
| 14 | const packageDir = join(root, 'pantry', 'ziglang-org', expected.replace('+', '_')) | |
| 15 | // The official Windows ZIP has zig.exe at its root; the Pantry registry | |
| 16 | // mirror can package it under bin/. Both keep Zig's lib directory nearby. | |
| 17 | for (const installed of [join(packageDir, 'zig.exe'), join(packageDir, 'bin', 'zig.exe')]) { | |
| 18 | if (existsSync(installed)) return installed | |
| 19 | } | |
| 20 | return null | |
| 16 | 21 | } |
| 17 | 22 | |
| 18 | 23 | export function resolveZig(root: string, env: NodeJS.ProcessEnv = process.env, hostPlatform = process.platform): { path: string, version: string, overridden: boolean } { |