Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ versions follow [Semantic Versioning](https://semver.org/) with `alpha` prerelea

## [Unreleased]

### Upgrading from 0.1.0-alpha.6
- The scaffolder is now revision 7, so every scaffold patch rn-xtool persisted in your `patches/` before this release
gets a warning at each `build`: "⚠ patches/<name> was written by an older rn-xtool scaffolder (revision 4, now 7);
delete it so rn-xtool regenerates it (also remove node_modules/<package> and reinstall: that copy still has the old
Package.swift)". Do what it says. A scaffolded library without a persisted patch is scaffolded again by itself.
- A `pods.<pod>.forwardHeaders` entry in `rn-xtool.config.json` that lists modules is refused: list the pod's public
headers instead (see Changed).

### Changed
- `pods.<pod>.forwardHeaders` maps a forwarded header to the pod's public headers to include, as paths under the
public header directories of its SwiftPM targets (`["OIDAuthState.h", "iOS/OIDAuthState+IOS.h", …]`), instead of
module names; a module name is refused with a message saying to list the headers. rn-xtool's AppAuth entry lists
the headers of AppAuth-iOS 3.0.0's umbrella header.

### Fixed
- A bare app target with an Objective-C `main.m` (the React Native templates before 0.77) builds, instead of stopping
in SwiftPM with "library product 'App' should not contain executable targets (it has 'App')": the file is compiled
Expand All @@ -15,6 +29,28 @@ versions follow [Semantic Versioning](https://semver.org/) with `alpha` prerelea
compile: every header the project references under `ios/`, outside `Pods/`, is copied with its forward in
`Sources/App/include`. A referenced header that does not exist is skipped with an `ℹ` line instead of stopping the
build.
- A bare app target's Objective-C sources and bridging header find React Native's headers by bare name
(`#import <RCTAppDelegate.h>`) and the pod table's `<Pod/Header.h>` forwards (`#import <AppAuth/AppAuth.h>`), as with
CocoaPods, instead of stopping with "'RCTAppDelegate.h' file not found"; the app's own headers still come first.
- A bare app target's Objective-C++ and C++ files (an `AppDelegate.mm` importing `<RCTAppDelegate.h>`) compile with
the project's `CLANG_CXX_LANGUAGE_STANDARD` (C++20 when unset), instead of clang's default, which stopped on React
Native's C++20 headers with "unknown type name 'Hashable'" in `react/utils/hash_combine.h`.
- An Objective-C++ file that imports a pod table forward (a bare app's `AppDelegate.mm` with
`#import <AppAuth/AppAuth.h>`) compiles, instead of stopping with "use of '@import' when modules are disabled": the
scaffold's forwarder `#import`s the pod's public headers instead of `@import`ing its modules.
- A library that was also built for Android gets its scaffold persisted, instead of "⚠ Did not persist <library>'s
scaffold: the patch would contain a binary file (node_modules/<library>/android/build/…/BuildConfig.dex)" and a new
scaffold at every build: the patch holds the files the scaffold wrote and those its existing patch held.
- react-native-screens 4.24.0 scaffolds with its `ios/` sources, instead of a target with only its C++ and an app that
crashed at start: the podspec reader evaluates Ruby locals, interpolation, `ENV` lookups, ternaries, `if`/`unless`
blocks, `push` on a local array, hashes and the library's `package.json`, and leaves out the branches a condition
rules out; a source glob, `compiler_flags`, `header_dir` or `frameworks` value it cannot evaluate stops that
library's scaffold with the podspec, the field and the expression, and an xcconfig flag it cannot evaluate is left
out with a warning that names it. react-native-worklets 0.8.3 keeps its `WORKLETS_VERSION` and
`REACT_NATIVE_MINOR_VERSION` defines.
- `build` and `install` stop, and remove the packed app, when a class React Native's codegen providers name is not in
the app, naming the class, its component or module and its library, instead of installing an app that would crash
at start in `+[RCTThirdPartyComponentsProvider thirdPartyFabricComponents]`.

## [0.1.0-alpha.6] - 2026-11-05

Expand Down
36 changes: 35 additions & 1 deletion data/pods.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,41 @@
"url": "https://github.com/openid/AppAuth-iOS",
"exact": "3.0.0",
"products": ["AppAuth"],
"forwardHeaders": { "AppAuth/AppAuth.h": ["AppAuthCore", "AppAuth"] }
"forwardHeaders": {
"AppAuth/AppAuth.h": [
"OIDAuthState.h",
"OIDAuthStateChangeDelegate.h",
"OIDAuthStateErrorDelegate.h",
"OIDAuthorizationRequest.h",
"OIDAuthorizationResponse.h",
"OIDAuthorizationService.h",
"OIDError.h",
"OIDErrorUtilities.h",
"OIDExternalUserAgent.h",
"OIDExternalUserAgentRequest.h",
"OIDExternalUserAgentSession.h",
"OIDGrantTypes.h",
"OIDIDToken.h",
"OIDRegistrationRequest.h",
"OIDRegistrationResponse.h",
"OIDResponseTypes.h",
"OIDScopes.h",
"OIDScopeUtilities.h",
"OIDServiceConfiguration.h",
"OIDServiceDiscovery.h",
"OIDTokenRequest.h",
"OIDTokenResponse.h",
"OIDTokenUtilities.h",
"OIDURLSessionProvider.h",
"OIDEndSessionRequest.h",
"OIDEndSessionResponse.h",
"iOS/OIDAuthState+IOS.h",
"iOS/OIDAuthorizationService+IOS.h",
"iOS/OIDExternalUserAgentIOS.h",
"iOS/OIDExternalUserAgentIOSCustomBrowser.h",
"iOS/OIDExternalUserAgentCatalyst.h"
]
}
},
"GTMSessionFetcher": {
"url": "https://github.com/google/gtm-session-fetcher",
Expand Down
14 changes: 13 additions & 1 deletion docs/bare-react-native.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,26 @@ remove `main.swift` from the app target.
If the target compiles any `.m`, `.mm`, `.c` or `.cpp` file, it is built as one mixed-language target, the same
mechanism as the scaffolded mixed libraries (the two manifests described in
[How it works](how-it-works.md#mixed-language-manifests)). The bridging header is passed with `-import-objc-header`
and your header search paths and defines are applied. Verified on a device with an Objective-C module next to a Swift
and your header search paths and defines are applied. The target's `.mm` and `.cpp` files compile with the project's
`CLANG_CXX_LANGUAGE_STANDARD` (C++20 when unset), passed to them as `-std=` because Swift Build does not apply the
package's `cxxLanguageStandard` to a mixed target. Verified on a device with an Objective-C module next to a Swift
module.

Swift Build names the generated Swift header `App-Swift.h` (the SwiftPM target is `App`), so `build` also writes
`Sources/App/include/<Module>-Swift.h`, which imports it: Objective-C keeps `#import "<Module>-Swift.h"` as in Xcode,
where `<Module>` is `PRODUCT_MODULE_NAME`, or `PRODUCT_NAME` with characters other than letters, digits and `_` turned
into `_`.

React Native's public Objective-C headers are importable by their bare name (`#import <RCTAppDelegate.h>`) as well as by
module (`#import <React/RCTAppDelegate.h>`), as CocoaPods' per-pod header search paths allow, and so are the
`<Pod/Header.h>` spellings of the pod table's `forwardHeaders` (`#import <AppAuth/AppAuth.h>`, in `.m` and `.mm` files
alike: the forwarder `#import`s the pod's public headers, since Objective-C++ compiles without modules). The app's
Objective-C sources and its bridging header search the app's own headers and `HEADER_SEARCH_PATHS` first, then
`ios/build/xcframeworks/ReactHeadersTarget/include/React`, then each per-module directory of
`ReactNativeHeaders.xcframework` that its module map names (`React_RCTAppDelegate`, `RCTImage`, `yoga`, …), then each
autolinked library's `rn-spm-pod-headers`, so an app header with the same name wins. React Native's C++ headers keep
their path spelling (`<react/debug/flags.h>`, `<jsi/jsi.h>`).

## Resources

The Resources phase is copied to `ios-xtool/Resources` (by file name; `*.lproj/` and `*.bundle/` stay whole) and listed
Expand Down
39 changes: 34 additions & 5 deletions docs/how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,40 @@ patch above is what makes that scaffolder work for real-world podspecs.
`Scaffolding <library> failed: <reason>`, followed by that library's own warnings, one block per failed library.
Nothing is persisted for a failed library, and React Native does not run a second time
([troubleshooting.md](troubleshooting.md#scaffolded-libraries)).
- The scaffolder reads a podspec with `pod ipc spec` when CocoaPods is installed, and otherwise with its own reader,
which runs the podspec's statements over the subset of Ruby podspecs use for their fields: locals (`name = …`, `+=`,
`||=`; the last assignment that runs wins), single- and double-quoted strings with `#{…}` interpolation, arrays and
`%w[…]`, `ENV['…']` and `ENV.fetch` (`RCT_NEW_ARCH_ENABLED` and `RCT_HERMES_V1_ENABLED` are `1`, as React Native's
CocoaPods setup sets them, and every other variable is unset, whatever the shell says), `==`, `!=`, `!`, `&&`,
`||`, ternaries, `+` on strings and arrays, `join`, `if`/`elsif`/`else`/`unless` blocks and `if`/`unless`
modifiers, and `push`, `<<` and `concat` on a local array. A branch its condition rules out is left out, as
CocoaPods leaves it out; both branches of a condition it cannot evaluate (a method call such as
`respond_to?(:install_modules_dependencies, true)`) are read. It also reads the library's own `package.json`
(`JSON.parse(File.read(File.join(__dir__, "package.json")))`) and hashes. A `source_files`, `exclude_files`,
`compiler_flags`, `header_dir`, `header_mappings_dir`, `frameworks` or `libraries` value that uses anything else (a
method call, a local it could not evaluate) fails that library's scaffold, with a reason that names the podspec,
the field and the expression, since a target built from the part it could read would lack some of the library's
files or settings; an xcconfig value it cannot evaluate in part is left out with a `Left out of …` warning that
names it
([fix 28](upstream/react-native-scaffolder.md#28-scriptsspmread-podspecjs-source-globs-built-from-ruby-locals-and-conditions-are-read-in-part)).
- After `xtool-build`, `build` checks that every class React Native's codegen providers name
(`ios/build/generated/ios/ReactCodegen/RCTThirdPartyComponentsProvider.mm` and `RCTModuleProviders.mm`) is defined
in the App binary or an embedded framework; `install` checks the app xtool builds again before it installs it. A
missing component class would crash the app at start in `+[RCTThirdPartyComponentsProvider
thirdPartyFabricComponents]`, so rn-xtool removes the packed app and stops, naming the class, the component or
module and the library ([troubleshooting.md](troubleshooting.md#rctthirdpartycomponentsprovider-thirdpartyfabriccomponents)).
- The scaffolded `Package.swift` holds no resources. rn-xtool builds the library's unconditional `resource_bundles`
whose names and globs are plain strings as `<name>.bundle` at the root of `App.app` (react-native-svg's
`RNSVGFilters.bundle`, react-native-device-info's privacy bundle; [CocoaPods binaries](#cocoapods-binaries)). After
`rn-spm`, `build` prints one `ℹ Not copied into the app: …` line naming what still does not arrive: plain
`resources`, and bundles whose name or files are Ruby code.

- rn-xtool persists the generated file in your project's `patches/` with patch-package: commit those files.
- rn-xtool persists the generated file in your project's `patches/` with patch-package: commit those files. A
persisted patch holds the files the scaffold wrote (the scaffold step lists them) and the files the library's
existing patch already held, so a fix of your own in that patch stays, and build outputs under the package (Gradle's
`android/build` and `.cxx`) never enter it. When rn-xtool cannot read which files the existing patch holds (or the
list would not fit in one argument), it diffs the whole package, as patch-package does by itself, and says so in an
`ℹ` line.
- On every build the `patches` step applies rn-xtool's own patches and then your project's `patches/` (when present),
so a fresh `node_modules` gets those Package.swift files back. A patch whose package is not installed is left out
with a `⚠` line, and the others apply
Expand Down Expand Up @@ -407,11 +434,13 @@ The scaffolder classifies each `s.dependency` on an unconditional line of a pods
**The pod table** is merged per pod, field by field, in this order, the later winning: the scaffolder's own baseline
(SwiftUIIntrospect), rn-xtool's `data/pods.json` (AppAuth, and the source pods ML Kit reaches), then the `pods` of
`rn-xtool.config.json`. rn-xtool writes the merged table to `ios/build/rn-xtool-pods.json`, with the binary pods the
`pods` step resolved, and names it in `RN_SPM_POD_TABLE` for every React Native run of the `rn-spm` step; without it
the scaffolder falls back to its baseline. A mapped pod's `forwardHeaders` become
`rn-spm-pod-headers/<Dir/Header.h>` files in the library, each holding `@import <module>;` lines, on the library's
`pods` step resolved, and names it in `RN_SPM_POD_TABLE` for every React Native run of the `rn-spm` step; without it the
scaffolder falls back to its baseline. A mapped pod's `forwardHeaders` become `rn-spm-pod-headers/<Dir/Header.h>` files
in the library, each holding one `#import <header>` per public header the pod's umbrella includes, on the library's
header search path: AppAuth's umbrella header is outside its SwiftPM targets, and react-native-app-auth imports it as
`<AppAuth/AppAuth.h>`. Each manifest records the pods it pins on a marker line, `// rn-xtool-pods: AppAuth=3.0.0`.
`<AppAuth/AppAuth.h>`. The forwarder is textual because Objective-C++ compiles without C++ modules
(`-fmodules -fno-cxx-modules`, Xcode's default), where `@import` is an error. Each manifest records the pods it pins
on a marker line, `// rn-xtool-pods: AppAuth=3.0.0`.

**Before the build.** `doctor --project` and `build` run the same classifier, loaded from rn-xtool's vendored copy of
the scaffolder, never the project's. They read podspecs as text, with no `pod ipc` and no network. The linked
Expand Down
Loading
Loading