Hive
feat(graph): compile apple_library through starlark rule impl
GitHub issue · Closed
Source
tuist/once #86
Updated
Jun 24, 2026
Domains
Once
Summary
- Move
apple_librarybuild logic out of Rust shell-script placeholders into a starlark rule impl declared incrates/once-frontend/prelude/apple.star. The impl composes a realxcrun-drivenswiftc -emit-library -static -emit-modulecommand line through native globals (xcrun_swiftc,apple_triple,declare_output,run_action) and returns a provider dict. - Add the analysis layer in
once-frontendthat evaluates a rule impl per target with actxdict (label, typed attrs, glob-expanded srcs, dep providers, build_dir), collects the declared actions through a thread-local store, and exposes them asDeclaredActions. State threading uses a thread-local instead ofEvaluator::extrabecause the workspace forbidsunsafe(the latter requires derivingProvidesStaticType). - Add the analysis driver in
once-clithat walks deps for impl-bearing rules, converts eachDeclaredActioninto aonce_core::Actionwith aninput_digestcomposing the swiftc identity, source content digests, and dep action digests, then executes viarun_with_cache. The other apple rule kinds (apple_framework,apple_application,apple_test_bundle) keep their existing placeholder scripts; a smallRULES_WITH_IMPLlist gates the new path. - Add a
fixtures/apple_library/workspace withAppCoreandGreeter(the latter imports the former), plus four new shellspec cases (compile, recursive dep build, cache hit, dep-change invalidation) gated onxcrunavailability. Updatedocs/guide/apple-graph.mdwith the rule-impl ctx surface and note the planned MCP-for-agents follow-up.
Testing
mise exec -- cargo test --workspacemise exec -- cargo clippy --workspace --all-targets -- -D warningsmise exec -- cargo fmt --all -- --checkmise exec -- cargo build --releasemise exec -- shellspec- Manual end-to-end on macOS: built
apps/ios/AppCoreandapps/ios/Greeterfrom the fixture; confirmedAppCore.ais a realcurrent ar archive random library,Greeterresolvesimport AppCorethrough the-Isearch path on the dep’s swiftmodule dir, cache hits on rebuild, and dep-source change invalidates the parent cache slot.
No GitHub comments yet.