Skip to content

Local release build scripts: macOS native and Windows cross-compile - #2630

Merged
mstomar125 merged 1 commit into
mainfrom
issue-1438-local-release-builds
Sep 15, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
issue-1438-local-release-builds

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Summary

  • bun run build:macos — thin wrapper around the existing tauri:build pipeline.
  • bun run build:windows:quick (Tier 1) — cross-compiles the Windows NSIS installer from macOS via cargo-xwin, no VM required. Checks every prerequisite up front with an actionable install command.
  • bun run build:windows (Tier 2) — drives a pre-configured Parallels VM over SSH for full CI parity (both installer formats). Gracefully errors with setup instructions when Parallels/the VM aren't present, per its own acceptance criteria.
  • scripts/build-skill.ts gained an explicit --target <rust-triple> override so the skill-installer sidecar can be cross-compiled to match a non-host target — every other caller keeps its unchanged host-triple default.
  • All scripts registered in root package.json.
  • docs/development/local-builds.md (in nodespace-docs, see PR #87) documents prerequisites for both tiers and one-time VM setup for Tier 2.

What was actually verified end-to-end vs. structurally only

Tier 1 — fully verified, real build. Ran bun run build:windows:quick to completion on this machine and it produced a genuine, valid NodeSpace_0.2.10_x64-setup.exe (confirmed via file: Nullsoft self-extracting installer). Also verified: the prerequisite-check failure path (empty PATH), CWD independence, partial-binary-copy failure mode, --target edge cases in build-skill.ts, and idempotency (second run reuses cached artifacts).

Running it for real surfaced three real toolchain gaps the issue's own prerequisite list didn't mention, each fixed and documented: lld-link shipping in a separate lld Homebrew formula (no longer bundled with llvm), ninja being required because llama-cpp-sys-2's CMake build forces the Ninja generator when cross-compiling, and makensis (Homebrew formula name, not nsis) being needed for Tauri's NSIS bundler — the Rust build can fully succeed and it still fails at the very last step without it. Also required tauri build --runner cargo-xwin rather than a plain --target, since Tauri CLI's own cargo build for the src-tauri crate otherwise has none of cargo-xwin's cross-compilation environment and fails compiling ring against the host's own compiler.

Tier 2 — structurally verified only. No Parallels VM exists on this machine, so only the graceful-degradation path (missing prlctl/VM) was actually run. The remainder (SSH build, scp artifacts back) is implemented per the issue's technical spec, type-checked and unit-tested where it's pure string-building, but unverified against a live VM — documented explicitly in local-builds.md, with a manual verification checklist for whoever sets up the first VM.

Adversarial review

Dispatched an independent adversarial-review agent against the diff. It found one real bug in copyArtifactsBack() (Tier 2's scp-artifacts-back step): the two remote source paths were built by interpolating a ~-prefixed remote path directly inside Bun's $ shell template, which (a) dropped the user@host: prefix on the second (msi) source entirely, and (b) let Bun's $ tilde-expand the other source against the local Mac host instead of the remote VM, since the default REPO_PATH (~/nodespace-core) starts with ~. Fixed by extracting a pure buildScpSources() helper that builds each complete user@host:path string in plain JS first (mirroring the existing buildRemoteScript pattern), with regression tests. Full review verdict and everything else it tried (mutation-testing, CWD independence, prerequisite-failure paths, idempotency) is in the PR discussion / session notes.

Test plan

  • bun run build:windows:quick run to completion for real — produced a valid NSIS installer
  • bun test scripts/ — 420/420 pass (incl. new tests for all three scripts and the build-skill.ts --target override)
  • bun run quality:scripts:check — clean
  • Full pre-push gate (bun run test:all, cargo build --bin nodespaced, test:e2e) — green

Closes #1438

🤖 Generated with Claude Code

…uild

build:macos wraps the existing tauri:build pipeline for naming/discoverability
consistency with the two Windows scripts.

build:windows:quick (Tier 1) cross-compiles nodespaced/nodespace and the
NSIS installer from macOS via cargo-xwin, no VM required. Checks every
prerequisite up front with an actionable install command -- cargo-xwin,
llvm/clang-cl, lld-link, ninja, and makensis all confirmed required by
actually running the build end-to-end on a clean machine (lld-link and
ninja split out of/required beyond what the source issue's prerequisite
list named; makensis needed because Tauri's NSIS bundler shells out to it
as its last step, after the entire Rust build has already succeeded).
Also required `tauri build --runner cargo-xwin` rather than a plain
--target: without it, Tauri CLI's own cargo invocation for the src-tauri
crate has none of cargo-xwin's CC/CXX/linker environment and fails
compiling `ring` against the host's own compiler. Verified for real:
produces a genuine, valid NodeSpace_<version>_x64-setup.exe.

build-skill.ts gained an explicit `--target <rust-triple>` override
(bunCompileTarget, parseTargetArg) so the skill-installer sidecar can be
cross-compiled to match the target triple rather than always compiling for
the host -- every other caller (dev:tauri, tauri:build, CI) still gets its
unchanged host-triple default.

build:windows (Tier 2) drives a pre-configured Parallels VM over SSH for
full CI parity (both installer formats, real MSVC toolchain). It never
provisions Parallels or the VM -- gracefully exits with actionable setup
instructions when either is missing, which is the only path exercised here
since no VM exists on this machine. Adversarial review of the
structurally-checked-only remainder caught and fixed a real bug in
copyArtifactsBack: its two scp sources were built by interpolating a
~-prefixed remote path directly inside Bun's $ shell template, which both
dropped the user@host: prefix on one source and let $ tilde-expand the
other against the local host instead of the remote one.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@mstomar125
mstomar125 merged commit 95c60d1 into main Sep 15, 2026
@mstomar125
mstomar125 deleted the issue-1438-local-release-builds branch September 15, 2026 11:31
mstomar125 added a commit that referenced this pull request Sep 15, 2026
…ge review (#2635)

A code-review pass on #2630 that arrived after it merged found several
genuine gaps in Tier 2's untested-against-a-real-VM path:

- SSH_HOST/SSH_USER/REPO_PATH used `process.env.X ?? fallback`, which only
  catches null/undefined -- an explicitly-empty-string override (a real
  shell/CI misconfiguration shape) silently produced '' instead of the
  documented default. Added envOrDefault() to treat empty-string as unset too.
- isVmRunning()'s JSON.parse had no try/catch, unlike the near-identical
  call in checkPrerequisites() which is guarded -- an unexpected `prlctl
  list --json` shape threw uncaught instead of failing gracefully.
- copyArtifactsBack() hardcoded the literal Windows target triple instead
  of using the file's own TARGET constant that buildRemoteScript() already
  uses everywhere else.
- `prlctl stop`'s exit code was discarded via bare `.nothrow()` -- a failed
  stop (wedged VM) printed the same message as a successful one. Now checks
  and reports the exit code.
- `prlctl start` ran before the try/finally responsible for stopping the
  VM, so a start that rejects after the VM has actually begun starting left
  nothing to run the cleanup. Moved inside the try.
- buildRemoteScript()'s `cd ${repoPath}` was unquoted in the single command
  line sent to the remote shell -- a repo path containing a space (a real
  shape for an operator-configurable REPO_PATH) would word-split and break
  the very first step of the remote build. Quoted.

Also dropped an unused, misleadingly-named `crate` field from
build-windows-quick.ts's SIDECAR_BINARIES (nodespaced/nodespace are binary
names, not the cargo package names the field's values would suggest to a
future maintainer wiring it into a `-p` flag by analogy with the sibling
build-sidecar-binaries.ts, which does use `crate` for that).

Closes #2634

Co-authored-by: Claude Sonnet 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local release build scripts: macOS native and Windows cross-compile

1 participant