Hive
refactor(apple): resolve toolchain paths without xcrun
GitHub issue · Closed
What changed
This change introduces resolver records for the Apple toolchain. The records carry the absolute paths for swiftc, clang, clang++, libtool, lipo, and codesign, along with the action cache identity and environment values each action needs.
When xcode_developer_dir is set, the compile and archive resolvers derive tool and platform paths from the standard Xcode developer directory layout. When it is unset, discovery still goes through xcrun, but build actions invoke the resolved tool path directly and pass an explicit software development kit path.
codesign is handled as a system tool rather than a toolchain binary. It is now discovered through xcrun --find codesign in both modes so signing does not pick up a shell search path replacement, while the action still invokes the resolved signer path directly.
The Apple library, framework, application, macro, and test bundle implementations now consume those resolver records. Simulator launch and test runner scripts still resolve xcrun where they need simctl or xctest.
The Apple shellspec fixtures now mock direct swiftc invocation and the platform path queries used by the new resolver shape.
Why
Apple builds were coupled to xcrun even when a manifest pinned xcode_developer_dir. The configured developer directory influenced discovery, but the action command still depended on a host xcrun binary and an xcrun --sdk ... <tool> command line.
That made the Apple rules harder to reuse with an already provisioned Xcode developer directory. The new indirection makes the toolchain path explicit before the build action is declared.
Root cause
The previous helper functions mixed discovery with execution. They returned xcrun and a software development kit name, then call sites reused that tuple to construct build action arguments. That made the wrapper part of the cached action shape.
Approach
Direct mode computes compile and archive paths under Toolchains/XcodeDefault.xctoolchain/usr/bin and Platforms/.../Developer/.... Fallback mode keeps using xcrun --find and xcrun --show-sdk-path only to discover paths.
Toolchain identities still include the resolved tool path, the tool version where available, and the configured developer directory, so separate Xcode installations continue to partition the action cache.
Runtime paths are intentionally narrower in this change. The simulator and test runner flows still ask xcrun for simctl and xctest, because those are execution-time tools rather than compile or archive tools. Signing also asks xcrun to discover codesign, because that tool is supplied by the operating system rather than the selected developer directory.
Impact
Existing macOS users who do not set xcode_developer_dir keep the same discovery behavior. Their build actions become more explicit because they invoke absolute tool paths instead of wrapping every tool through xcrun.
Pinned developer directory builds no longer need xcrun in compile, archive, merge, and signing action arguments. Signing discovery still uses xcrun --find codesign so the selected signer is not controlled by the shell search path.
Simulator launch and test bundle execution still require xcrun until their runner paths get the same treatment.
Validation
mise exec -- cargo fmt --all -- --checkcompleted successfully.mise exec -- cargo test -p once-frontend prelude_resolve_codesign_direct_mode_uses_xcrun_findcompleted successfully.mise exec -- cargo test --workspacecompleted successfully.mise exec -- cargo clippy --workspace --all-targets -- -D warningscompleted successfully.mise exec -- cargo build --releasecompleted successfully.mise exec -- shellspec spec/apple_spec.shcompleted successfully with 33 examples and 0 failures.
Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.
Start a Flight and preserve its objective, outcome, and session here.
No GitHub comments yet.