Repository navigation
feat: check the app target before xtool-build (alpha.8, plan 2) - #40
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Check the app target before
xtool-build(alpha.8, plan 2)buildnow checks the app's own sources beforextool-buildstarts, so an error in the app target stops the build in seconds instead of minutes. Two checks: at the start ofbuild(and indoctor --project, with no toolchain) the app's own includes are resolved asgeneratewill copy them; then a newprecheckstep betweengenerateandxtool-buildplans the generated package with SwiftPM, resolves the includes again with the App target's full include list, type-checks the Swift files withswiftc -typecheckand syntax-checks every C-family file withclang -fsyntax-only, using the flags Swift Build gives the same files.Design:
docs/design/specs/2026-11-06-alpha-8-fail-early-design.md(B). Plan:docs/design/plans/2026-11-09-alpha-8-plan-2-precheck.md.What users get
buildat the start: one✖per include, naming the file and line, the places the app target's copy searched and, whenios/holds one, the file of that name that differs only in case, that the target does not list, or that Expo's prebuild does not copy.doctor --projectprints the sameapp-includeslines.precheckstep that stops beforextool-buildwith the compilers' first ten errors and their include stacks, every command and its output inios-xtool/.precheck/precheck.log. Only certain errors stop: an include under a condition the check cannot evaluate, a module SwiftPM builds from Swift, a header a module map provides, or a toolchain detail the check cannot read is left toxtool-build, with anℹor⚠line.--skip-precheckonbuildandrunleaves the step out and turns the start-of-build misses into⚠lines; every stop of the step names it.doctor --reportrecords whether the last build ran or skipped the precheck..xcconfigthat sets a setting rn-xtool reads from the pbxproj gets a⚠; an Xcode 16 synchronized folder as the source of the app target is refused with the fix (Convert to Group).How it was proven
#if/#ifdef/#elif,__has_include, comments,#if 0, line splicing, CRLF), and the resolver is tested against the virtual copygeneratemakes.tests/precheckGolden.test.ts): the argv Swift Build used for the App target of six reference builds (bare React Native 0.85–0.88, an Objective-C app, Expo SDK 58 with a bridging import) is a fixture, and the precheck'sclang/swiftclines must give the same defines, search paths, module maps, language and target flags, in the same include order. The five false stops the first capture found were fixed in the builder, not in the fixtures.buildstart in 0.3 s; dropped React Native include folders, an older C++ standard and an@importin a header without modules each stop in the precheck in 4.5–6.8 s, naming the first error and its include stack.xtool-buildas documented.npm test: 2837 passed, 6 skipped (environment: real slots, a device, the e2e app, the CI-only check);npm run lint,npm run check:mentionsandnpm run scan:privateare clean.Merge gate
✔ app-includesindoctor --project,✔ precheckinbuild).Maintainer notes
xtool-buildis deferred to alpha.9 (spec row 40b).RCT_NEW_ARCH_ENABLED; the check assumes only the compile's defines, so a condition on that macro is left to the compile. Whether CocoaPods defines it for the app target on a Mac is a fidelity question for a later block.[Unreleased]until the version that carries them is chosen.