also looking at this
fix(build): select the core Zig project explicitly
#383
4 files
+44
-2
| @@ -59,10 +59,17 @@ export function runZig(root: string, args: string[], env: NodeJS.ProcessEnv = pr | ||
| 59 | 59 | const { version } = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')) |
| 60 | 60 | command.push(`-Dversion=${version}`) |
| 61 | 61 | } |
| 62 | if (core && command[0] === 'build') { | |
| 63 | // Select the core project explicitly. A monorepo has another build.zig | |
| 64 | // at its root; compiler build discovery must not select that wrapper. | |
| 65 | command.splice(1, 0, '--build-file', join(root, 'packages/zig/build.zig')) | |
| 66 | } | |
| 62 | 67 | const zig = resolveZig(root, env) |
| 68 | const cwd = core ? join(root, 'packages/zig') : root | |
| 63 | 69 | console.error(`Zig ${zig.version}: ${zig.path}${zig.overridden ? ' (explicit unpinned override)' : ''}`) |
| 70 | console.error(`Zig project directory: ${cwd}`) | |
| 64 | 71 | const result = Bun.spawnSync([zig.path, ...command], { |
| 65 | cwd: core ? join(root, 'packages/zig') : root, | |
| 72 | cwd, | |
| 66 | 73 | env, |
| 67 | 74 | stdin: 'inherit', |
| 68 | 75 | stdout: 'inherit', |