Skip to content

Objective-C app targets: every header the project references - #34

Merged
WillyAntunez merged 2 commits into
mainfrom
fix/bare-project-headers
Nov 6, 2026
Merged

WillyAntunez merged 2 commits into
mainfrom
fix/bare-project-headers

Conversation

@WillyAntunez

@WillyAntunez WillyAntunez commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

Objective-C app targets: every header the project references

Follow-up to #33. Past the main.m fix, a bare React Native app whose main.m, AppDelegate.h and AppDelegate.mm are direct children of the Xcode project's main group (the app-named group holding only the asset catalog, Info.plist, launch screen and privacy manifest) failed compiling Sources/App/AppMain.m with 'AppDelegate.h' file not found: rn-xtool copied only the headers of the Sources phase and of the group of the app folder (the folder of INFOPLIST_FILE). Xcode has no such limit: its header map makes every header the project references importable as #import "X.h" from any source of the target. Not a release: the notes stay under [Unreleased].

What users get

  • Every header the project references under ios/ is copied. The single-group rule is replaced by a walk of the whole group tree from the main group: each header (.h, .hpp) whose reference resolves under ios/ is copied to Sources/App (keeping its path from the app folder, or from ios/ when it is elsewhere: ios/AppDelegate.h lands at Sources/App/AppDelegate.h) with its forward in Sources/App/include. Left out: the Pods group (by path or name) and anything under Pods/, build/ or DerivedData/, headers inside a .framework/.xcframework, the Products group, references in trees rn-xtool cannot place (BUILT_PRODUCTS_DIR, SDKROOT), and headers outside ios/ (not copied, no error). Sources-phase headers come first, then those under the app folder, then the rest, so a header of the app folder keeps winning a name shared with another header; the existing ℹ Two app headers are named X.h line reports such a clash.
  • A referenced header that does not exist is skipped with ℹ Skipped <path>: the Xcode project references this header, but the file does not exist, as Xcode builds until a source imports it. Before, a missing header of the app folder stopped the copy with Missing <path>.
  • Docs: the Sources section of docs/bare-react-native.md, a troubleshooting entry keyed by 'AppDelegate.h' file not found, and a CHANGELOG line under [Unreleased] → ### Fixed.

Verified

  • Unit tests, written failing first: a header that is a direct child of the main group is collected (after the app folder's) and copied to Sources/App/AppDelegate.h with include/AppDelegate.h forwarding to it, next to a main.m importing it; headers of other groups, with and without a path, and a SOURCE_ROOT header are collected; headers of the Pods group (by path and by name), under Pods/ and build/, inside a .framework/.xcframework and in the Products group are not; headers outside ios/ (relative, absolute, BUILT_PRODUCTS_DIR) are not collected and raise no error; the app-folder header case still passes; a referenced header missing on disk is skipped with the ℹ line and no forward.
  • Real build: an xtool build of a bare React Native 0.85 app with an Objective-C app target got past SwiftPM with Bare app targets with an Objective-C main.m #33 and stopped at 'AppDelegate.h' file not found, which this change addresses. A build with this change is pending on that app.

Checks

  • npm test (2385 passed, 6 skipped) and npm run lint pass.
  • npm run scan:private is clean on both commits.

@WillyAntunez
WillyAntunez merged commit 591bcf7 into main Nov 6, 2026
1 check passed
@WillyAntunez WillyAntunez changed the title Objective-C app targets: every header the project references Objective-C app targets: project headers and React Native bare includes Nov 6, 2026
@WillyAntunez WillyAntunez changed the title Objective-C app targets: project headers and React Native bare includes Objective-C app targets: every header the project references Nov 6, 2026
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