-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(cli): isolate release target builds #10935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6cab5f1
8295ab3
254b070
7afef4a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@kilocode/cli": patch | ||
| "kilo-code": patch | ||
| --- | ||
|
|
||
| Prevent the macOS Apple Silicon CLI from failing to start because of malformed bundled exports. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -193,6 +193,14 @@ const allTargets: { | |
| }, | ||
| ] | ||
|
|
||
| // kilocode_change start - isolate target builds because repeated Bun.build calls can corrupt shared chunks | ||
| const arg = process.argv.find((item) => item.startsWith("--target=")) | ||
| const value = arg?.slice("--target=".length) | ||
| const selection = value !== undefined && /^(0|[1-9]\d*)$/.test(value) ? Number(value) : -1 | ||
| const isolated = selection >= 0 && selection < allTargets.length | ||
| if (arg !== undefined && !isolated) throw new Error(`Invalid isolated build target: ${arg}`) | ||
| // kilocode_change end | ||
|
|
||
| const targets = singleFlag | ||
| ? allTargets.filter((item) => { | ||
| if (item.os !== process.platform || item.arch !== process.arch) { | ||
|
|
@@ -213,10 +221,12 @@ const targets = singleFlag | |
| return true | ||
| }) | ||
| : allTargets | ||
| if (isolated) targets.splice(0, targets.length, allTargets[selection]!) // kilocode_change - select one target in child | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SUGGESTION: if (isolated) targets.splice(0, targets.length, allTargets[selection]!)Could be rewritten as: const targets = isolated
? [allTargets[selection]!]
: singleFlag
? allTargets.filter(...)
: allTargetsor simply |
||
|
|
||
| await $`rm -rf dist` // kilocode_change | ||
|
|
||
| const kiloConsoleDist = await buildKiloConsole() // kilocode_change | ||
| // kilocode_change start - isolated children reuse the parent's prepared output tree | ||
| if (!isolated) await $`rm -rf dist` | ||
| const kiloConsoleDist = isolated ? path.resolve(dir, "../kilo-console/dist") : await buildKiloConsole() | ||
| // kilocode_change end | ||
|
|
||
| const binaries: Record<string, string> = {} | ||
| if (!skipInstall) { | ||
|
|
@@ -234,6 +244,15 @@ for (const item of targets) { | |
| ] | ||
| .filter(Boolean) | ||
| .join("-") | ||
|
|
||
| // kilocode_change start - isolate Bun's shared-chunk state between cross-platform targets | ||
| if (!isolated && targets.length > 1) { | ||
| await $`${process.execPath} run script/build.ts --target=${allTargets.indexOf(item)} --skip-install` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SUGGESTION: The child subprocess only receives Consider forwarding extra flags explicitly or documenting that multi-target builds don't support const extraFlags = sourcemapsFlag ? ["--sourcemaps"] : []
await $`${process.execPath} run script/build.ts --target=${allTargets.indexOf(item)} --skip-install ${extraFlags}` |
||
| binaries[name] = Script.version | ||
| continue | ||
| } | ||
| // kilocode_change end | ||
|
|
||
| console.log(`building ${name}`) | ||
| await $`mkdir -p dist/${name}/bin` | ||
|
|
||
|
|
@@ -347,6 +366,8 @@ for (const item of targets) { | |
| binaries[name] = Script.version | ||
| } | ||
|
|
||
| if (isolated) process.exit(0) // kilocode_change - isolated target children leave archive upload to parent | ||
|
|
||
| if (Script.release) { | ||
| const archives: string[] = [] // kilocode_change | ||
| for (const key of Object.keys(binaries)) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SUGGESTION: The
validate-darwin-arm64job (andvalidate-linuxbelow) is missingif: github.repository == 'Kilo-Org/kilocode'that every other job in this file has (version,build-cli,build-vscode,smoke-test,publish). In practice it doesn't matter since this workflow is only triggered from the main repo, but it breaks the established pattern and could cause confusion in forks.