Skip to content

feat: check the app target before xtool-build (alpha.8, plan 2) - #40

Merged
WillyAntunez merged 56 commits into
mainfrom
feature/alpha-8-precheck
Nov 10, 2026
Merged

WillyAntunez merged 56 commits into
mainfrom
feature/alpha-8-precheck

Conversation

@WillyAntunez

Copy link
Copy Markdown
Owner

Check the app target before xtool-build (alpha.8, plan 2)

build now checks the app's own sources before xtool-build starts, so an error in the app target stops the build in seconds instead of minutes. Two checks: at the start of build (and in doctor --project, with no toolchain) the app's own includes are resolved as generate will copy them; then a new precheck step between generate and xtool-build plans the generated package with SwiftPM, resolves the includes again with the App target's full include list, type-checks the Swift files with swiftc -typecheck and syntax-checks every C-family file with clang -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

  • Misses of the app's own headers stop build at the start: one ✖ per include, naming the file and line, the places the app target's copy searched and, when ios/ 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 --project prints the same app-includes lines.
  • A precheck step that stops before xtool-build with the compilers' first ten errors and their include stacks, every command and its output in ios-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 to xtool-build, with an ℹ or ⚠ line.
  • --skip-precheck on build and run leaves the step out and turns the start-of-build misses into ⚠ lines; every stop of the step names it. doctor --report records whether the last build ran or skipped the precheck.
  • Target-shape warnings: an .xcconfig that 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

  • The include scanner and the resolver have unit tests per preprocessor form (#if/#ifdef/#elif, __has_include, comments, #if 0, line splicing, CRLF), and the resolver is tested against the virtual copy generate makes.
  • The command lines are compared with Swift Build's (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's clang/swiftc lines 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.
  • Seeded faults on an Objective-C app: a deleted app header stops at build start in 0.3 s; dropped React Native include folders, an older C++ standard and an @import in a header without modules each stop in the precheck in 4.5–6.8 s, naming the first error and its include stack.
  • Seven reference apps build with zero false stops (bare 0.85, 0.86, 0.87, 0.88, the Objective-C app, Expo SDK 57 and 58): the precheck takes 3–11 s with a cold module cache and 0.6–7 s warm (two series, loaded machine); Expo's Swift files are left to xtool-build as 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:mentions and npm run scan:private are clean.

Merge gate

  • CI green.
  • The maintainer's own test: the packed tarball installed locally and built with his Objective-C app, with no hand fix (✔ app-includes in doctor --project, ✔ precheck in build).

Maintainer notes

  • The precheck's fidelity rests on the Swift Build capture of 2026-11-09 (swiftly 6.4.1); a drift watch that compares a real build's argv after xtool-build is deferred to alpha.9 (spec row 40b).
  • The App target as rn-xtool generates it does not define 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.
  • Group B's CHANGELOG entries sit under [Unreleased] until the version that carries them is chosen.

@WillyAntunez
WillyAntunez merged commit 2856d0b into main Nov 10, 2026
3 checks passed
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