Skip to content

feat(cross): Move embedder build to --prepare step - #195

Open
MEverett90 wants to merge 4 commits into
mainfrom
me/prepare-embedder
Open

feat(cross): Move embedder build to --prepare step#195
MEverett90 wants to merge 4 commits into
mainfrom
me/prepare-embedder

Conversation

@MEverett90

Copy link
Copy Markdown
Collaborator

Description

  • --prepare now builds the embedder, not just augments. Previously --prepare only built augment overlay libraries; --build would then rebuild them redundantly. Now --prepare calls a new _buildEmbedder method that runs both augments and the CMake/meson embedder build, returning an _EmbedderResult. When --prepare and --build are combined in one invocation, the result is passed directly to _build, skipping the second embedder build entirely.
  • Skip-if-built fast path for --build. When --build runs standalone (after a prior --prepare), it checks whether the source tree has changed and all backend binaries are present before re-running cmake/meson. The check uses a content-based SHA-256 fingerprint of the source tree written to .emb-source-stamp on a successful build, so edits, adds, deletes, and renames are all detected reliably — including across git checkout and on filesystems with coarse mtime granularity (HFS+, FAT32).

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

…ter. When --prepare --build are combined, the result from --prepare is passed through directly, skipping the second _buildEmbedder call entirely — no redundant augment rebuild.
When --build falls back to _buildEmbedder(skipIfBuilt: true), check a
.emb-source-stamp file in the build root against a SHA256 fingerprint of
the embedder source tree (file paths + sizes + mtimes). If the stamp
matches and all backend binaries are present, the cmake/meson step is
skipped entirely; otherwise the build runs and a new stamp is written.

Without this, skipIfBuilt only checks for the presence of built
binaries — source edits between --prepare and --build would be silently
ignored because cmake is never invoked to notice them.
Replace the mtime-based source fingerprint with SHA-256 content hashing
so that git checkout, cp -a, and coarse-granularity filesystems (HFS+,
FAT32) no longer produce false skip-if-built cache hits.

Also fixes the _EmbedderResult doc comment that was accidentally
concatenated with _StagedLibs's, removes a redundant .where(success)
filter after an exhaustive check, and normalizes path construction to
use p.join consistently.

Adds unit tests for sourceFingerprint covering determinism, content
change detection, file add/remove, hidden-dir exclusion, and
mtime-independence.
@MEverett90
MEverett90 requested a review from jwinarske September 3, 2026 20:52
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.

1 participant