also looking at this
fix(build): select the core Zig project explicitly
#383
4 files
+44
-2
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.
| @@ -187,14 +187,14 @@ jobs: | ||
| 187 | 187 | - name: First-party Zig dependencies |
| 188 | 188 | uses: ./.github/actions/first-party-zig-deps |
| 189 | 189 | |
| 190 | - name: Verify pinned compiler core project selection | |
| 191 | run: bun scripts/verify-zig-core-project.ts | |
| 192 | ||
| 193 | 190 | - name: Build Windows CLI |
| 194 | 191 | # scripts/zig.ts resolves the actual managed binary from pantry.lock, |
| 195 | 192 | # including its adjacent standard library on Windows. |
| 196 | 193 | run: bun run build:core |
| 197 | 194 | |
| 195 | - name: Verify pinned compiler core project selection | |
| 196 | run: bun scripts/verify-zig-core-project.ts | |
| 197 | ||
| 198 | 198 | - name: Stage pinned WebView2 loader |
| 199 | 199 | shell: pwsh |
| 200 | 200 | run: | |
| @@ -16,14 +16,6 @@ try { | ||
| 16 | 16 | writeFileSync(join(root, 'build.zig'), 'const std=; pub fn build(b:*std.Build) void {_=b.standardOptimizeOption(.{});}\n') |
| 17 | 17 | writeFileSync(join(core, 'build.zig'), 'const std=; pub fn build(b:*std.Build) void {_=b.standardOptimizeOption(.{}); const version=b.option([]const u8,"version","version") orelse "missing"; std.debug.print("PROJECT_VERSION={s}\\n",.{version});}\n') |
| 18 | 18 | const env = { ...process.env, CRAFT_ZIG: zig.path } |
| 19 | const child = Bun.spawnSync([process.execPath, '-p', 'process.cwd()'], { cwd: core, env, stdout: 'pipe', stderr: 'pipe' }) | |
| 20 | console.log('Requested/observed child cwd:', JSON.stringify({ requested: core, observed: child.stdout.toString().trim(), status: child.exitCode })) | |
| 21 | for (const mode of ['default', 'absolute', 'relative'] as const) { | |
| 22 | const cwd = mode === 'relative' ? root : core | |
| 23 | const args = mode === 'default' ? [] : ['--build-file', mode === 'absolute' ? join(core, 'build.zig') : 'packages/zig/build.zig'] | |
| 24 | const result = Bun.spawnSync([zig.path, 'build', ...args, '-Dversion=1.2.3'], { cwd, env, stdout: 'pipe', stderr: 'pipe' }) | |
| 25 | console.log(JSON.stringify({ mode, cwd, status: result.exitCode, stdout: result.stdout.toString(), stderr: result.stderr.toString() })) | |
| 26 | } | |
| 27 | 19 | const runner = join(root, 'runner.ts') |
| 28 | 20 | writeFileSync(runner, `import {runZig} from ${JSON.stringify(join(source, 'scripts/zig.ts'))};process.exitCode=runZig(${JSON.stringify(root)},['--core','--versioned','build']);\n`) |
| 29 | 21 | const result = Bun.spawnSync([process.execPath, runner], { cwd: root, env, stdout: 'pipe', stderr: 'pipe' }) |