Skip to content

feat: embed runtime binaries for self-contained SDKs#316

Merged
DorianZheng merged 5 commits intomainfrom
feat/embedded-runtime
Feb 28, 2026
Merged

feat: embed runtime binaries for self-contained SDKs#316
DorianZheng merged 5 commits intomainfrom
feat/embedded-runtime

Conversation

@DorianZheng
Copy link
Copy Markdown
Member

Summary

  • Runtime binaries (boxlite-shim, boxlite-guest, native libraries) are now compiled into the library via include_bytes! instead of being shipped in a separate boxlite-runtime/ directory
  • On first use, EmbeddedRuntime extracts and caches binaries to ~/.local/share/boxlite/runtimes/v{VERSION}/, with content-hash cache invalidation for debug builds
  • SDKs become fully self-contained — no external runtime directory needed at deployment time

What changed

  • boxlite/build.rs: EmbeddedManifest generator scans runtime dir, writes include_bytes! manifest, emits content hash env vars
  • boxlite/src/runtime/embedded.rs: New module — extracts embedded files to versioned cache dir with atomic rename, PID-scoped temp dirs, and stale cache cleanup (7-day TTL)
  • binary_finder / configure_library_env: Updated to use embedded cache paths instead of workspace boxlite-runtime/ dir
  • build-runtime.sh / build-shim.sh: Defaults to cargo OUT_DIR; SKIP_SHIM_BUILD support for shim self-build avoidance
  • CI workflows: Build shim+guest on host before SDK builds; remove runtime tarball bundling steps
  • Packaging scripts: Remove boxlite-runtime/ directory from packages
  • SDK Cargo.toml files: Forward embedded-runtime feature flag
  • -sys build scripts: Remove duplicated auto_detect_registry() (already in main build.rs)

Test plan

  • cargo test -p boxlite — unit tests including embedded manifest and versioned dir tests
  • make dev:python && python examples/python/basic/hello.py — Python SDK uses embedded runtime
  • make dev:node && node sdks/node/examples/basic.mjs — Node SDK uses embedded runtime
  • CI build-runtime workflow builds successfully
  • CI build-wheels workflow produces self-contained wheels

Runtime binaries (boxlite-shim, boxlite-guest, libraries) are now compiled
directly into the library using include_bytes! instead of being shipped as
separate files in a boxlite-runtime/ directory. This makes SDKs fully
self-contained — no external runtime directory needed at deployment time.

Key changes:
- build.rs generates EmbeddedManifest with include_bytes! for all runtime artifacts
- New embedded.rs extracts and caches runtime to ~/.local/share/boxlite/runtimes/ on first use
- binary_finder and configure_library_env use embedded cache paths
- SDK Cargo.toml files forward the embedded-runtime feature flag
- CI workflows build shim+guest on host, removing runtime bundling steps
- Packaging scripts no longer include boxlite-runtime directory
- Remove duplicated auto_detect_registry() from -sys build scripts
_ensure-python-deps was triggering a full Rust compilation via maturin
when only dev tools (ruff, pytest) were needed. This caused CI lint to
fail because submodules were not checked out.

Switch to PEP 735 [dependency-groups] + uv, which installs dev deps
without invoking the build backend.
@DorianZheng DorianZheng merged commit ce93dd2 into main Feb 28, 2026
29 of 31 checks passed
@DorianZheng DorianZheng deleted the feat/embedded-runtime branch February 28, 2026 14:04
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