ReviewOS

also looking at this

craft-native/craft

feat: add Linux and Windows named-window routing

#325
Merged glennmichael123 wants to merge codex/multi-window-linux-windows into main
29 files +2250 -200
.github/workflows/ci.ymlmodified+62-2
Changes to .github/workflows/ci.yml
@@ -51,7 +51,7 @@ jobs:
5151 if: runner.os == 'Linux'
5252 run: |
5353 sudo apt-get update
54 sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev
54 sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev xvfb xauth
5555
5656 - name: First-party Zig dependencies
5757 uses: ./.github/actions/first-party-zig-deps
@@ -79,6 +79,66 @@ jobs:
7979 ls -lh packages/zig/zig-out/bin/
8080 size packages/zig/zig-out/bin/craft
8181
82 # The host matrix never analyzes windows.zig. Exercise the same target
83 # as release.yml here so multi-window WebView2 changes cannot wait until
84 # a tag to reveal a cross-compilation failure.
85 - name: Cross-build Windows CLI
86 if: runner.os == 'Linux'
87 working-directory: packages/zig
88 run: |
89 VERSION="$(bun -p "require('../../package.json').version")"
90 zig build -Doptimize=ReleaseSafe -Dversion="$VERSION" -Dtarget=x86_64-windows
91 test -f zig-out/bin/craft.exe
92
93 - name: Smoke Linux multi-window bridge
94 if: runner.os == 'Linux'
95 run: bun scripts/verify-desktop-multi-window.ts packages/zig/zig-out/bin/craft
96
97 windows-multi-window:
98 runs-on: windows-2025
99 timeout-minutes: 20
100
101 steps:
102 - uses: actions/checkout@v6
103
104 - name: Setup Pantry (provides Bun and Zig)
105 uses: pantry-pm/pantry/packages/action@235036fa0f48bae99b2293df5a3dc35c809b1777 # pinned: last SHA whose bundled typescript resolves on linux-x64
106
107 - name: First-party Zig dependencies
108 uses: ./.github/actions/first-party-zig-deps
109
110 - name: Build Windows CLI
111 shell: pwsh
112 run: |
113 # The Pantry .bin shim can print zig version but cannot locate Zig's
114 # lib directory during a build. Run the locked package binary itself.
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 }
125 bun run build:core
126
127 - name: Stage pinned WebView2 loader
128 shell: pwsh
129 run: |
130 $version = '1.0.4191.47'
131 $expected = 'f492bbf547d0da329553b6727435b677579b1e9f91cc9e4a1ad029366d5f23d0'
132 $archive = Join-Path $env:RUNNER_TEMP 'microsoft.web.webview2.zip'
133 $package = Join-Path $env:RUNNER_TEMP 'microsoft.web.webview2'
134 Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/microsoft.web.webview2/$version/microsoft.web.webview2.$version.nupkg" -OutFile $archive
135 if ((Get-FileHash $archive -Algorithm SHA256).Hash.ToLowerInvariant() -ne $expected) { throw 'WebView2 NuGet package digest mismatch' }
136 Expand-Archive -LiteralPath $archive -DestinationPath $package
137 Copy-Item (Join-Path $package 'build/native/x64/WebView2Loader.dll') 'packages/zig/zig-out/bin/WebView2Loader.dll'
138
139 - name: Smoke Windows multi-window bridge
140 run: bun scripts/verify-desktop-multi-window.ts packages/zig/zig-out/bin/craft.exe
141
82142 typescript-sdk:
83143 runs-on: ubuntu-latest
84144
@@ -375,7 +435,7 @@ jobs:
375435 run: bun run verify
376436
377437 publish-commit:
378 needs: [zig-core, typescript-sdk, ios-builder, ios-native-templates, android-builder, create-craft, ts-maps, lint, integration]
438 needs: [zig-core, windows-multi-window, typescript-sdk, ios-builder, ios-native-templates, android-builder, create-craft, ts-maps, lint, integration]
379439 runs-on: ubuntu-latest
380440
381441 steps: