Force RCT_REMOVE_LEGACY_ARCH=1 for the entire OSS iOS framework - WIP !!#56821
Open
christophpurrer wants to merge 1 commit into
Open
Force RCT_REMOVE_LEGACY_ARCH=1 for the entire OSS iOS framework - WIP !!#56821christophpurrer wants to merge 1 commit into
christophpurrer wants to merge 1 commit into
Conversation
|
@christophpurrer has exported this pull request. If you are a Meta employee, you can view the originating Diff in D105118393. |
Summary:
The legacy (Paper) architecture has been removed from the React Native iOS sources. The remaining call sites are all behind `#ifndef RCT_REMOVE_LEGACY_ARCH` guards, so leaving the macro unset (or set to `0`) now produces an unbuildable framework. Today the CocoaPods plumbing in `react_native_pods.rb` still treats `RCT_REMOVE_LEGACY_ARCH` as an opt-out env var (`'0' ? '0' : '1'`), and `Package.swift` already hard-codes the macro to `1` for the SwiftPM flow. This diff brings the CocoaPods flow in line with SwiftPM and makes the OSS framework always build with the legacy arch compiled out.
Changes in `packages/react-native/scripts/react_native_pods.rb`:
- `prepare_react_native_project!` hard-sets `ENV['RCT_REMOVE_LEGACY_ARCH'] = '1'` at the top, before any other helper consults the variable.
- `use_react_native!` re-asserts `ENV['RCT_REMOVE_LEGACY_ARCH'] = '1'` (the previous `... == '0' ? '0' : '1'` opt-out is gone) so consumers that skip `prepare_react_native_project!` still get the flag.
- `react_native_post_install` unconditionally adds `-DRCT_REMOVE_LEGACY_ARCH=1` to every project's `OTHER_CFLAGS` / `OTHER_CPLUSPLUSFLAGS` (the old `if/else` that could remove the flag is gone).
- New helper `set_remove_legacy_arch_compiler_flag!(spec)` appends `-DRCT_REMOVE_LEGACY_ARCH=1` to a podspec's `compiler_flags`, preserving anything already there (e.g. `js_engine_flags()` in `React-Core.podspec`).
The new helper is invoked once per Meta-owned React-* podspec under `packages/react-native/` (72 podspecs in total: every podspec that is not a third-party shim, not a codegen test fixture, not `hermes-engine`, and not `Yoga`). Baking the macro into each podspec's `compiler_flags` mirrors the `.define("RCT_REMOVE_LEGACY_ARCH", to: "1")` already present in `Package.swift` and provides a defensive belt-and-suspenders even for consumers that skip `react_native_post_install`.
Finally, the per-app `ENV['RCT_REMOVE_LEGACY_ARCH'] = '1'` override that previously sat at the top of `packages/rn-tester/Podfile` is now redundant and is removed; RNTester picks the flag up from the framework defaults like every other OSS app.
OSS impact: any app consuming `react_native_pods.rb` will always build React Native with `-DRCT_REMOVE_LEGACY_ARCH=1`. This matches the iOS source state. The env-var opt-out is gone -- setting `RCT_REMOVE_LEGACY_ARCH=0` in the shell or CI no longer has any effect on OSS CocoaPods or SwiftPM builds.
Changelog:
[iOS][Changed] - Force `RCT_REMOVE_LEGACY_ARCH=1` for the entire React Native iOS framework in OSS builds; the legacy (Paper) architecture is no longer a supported configuration. The `RCT_REMOVE_LEGACY_ARCH=0` env-var opt-out has been removed from `react_native_pods.rb`.
Differential Revision: D105118393
c0eb5e7 to
10baf97
Compare
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.
Summary:
The legacy (Paper) architecture has been removed from the React Native iOS sources. The remaining call sites are all behind
#ifndef RCT_REMOVE_LEGACY_ARCHguards, so leaving the macro unset (or set to0) now produces an unbuildable framework. Today the CocoaPods plumbing inreact_native_pods.rbstill treatsRCT_REMOVE_LEGACY_ARCHas an opt-out env var ('0' ? '0' : '1'), andPackage.swiftalready hard-codes the macro to1for the SwiftPM flow. This diff brings the CocoaPods flow in line with SwiftPM and makes the OSS framework always build with the legacy arch compiled out.Changes in
packages/react-native/scripts/react_native_pods.rb:prepare_react_native_project!hard-setsENV['RCT_REMOVE_LEGACY_ARCH'] = '1'at the top, before any other helper consults the variable.use_react_native!re-assertsENV['RCT_REMOVE_LEGACY_ARCH'] = '1'(the previous... == '0' ? '0' : '1'opt-out is gone) so consumers that skipprepare_react_native_project!still get the flag.react_native_post_installunconditionally adds-DRCT_REMOVE_LEGACY_ARCH=1to every project'sOTHER_CFLAGS/OTHER_CPLUSPLUSFLAGS(the oldif/elsethat could remove the flag is gone).set_remove_legacy_arch_compiler_flag!(spec)appends-DRCT_REMOVE_LEGACY_ARCH=1to a podspec'scompiler_flags, preserving anything already there (e.g.js_engine_flags()inReact-Core.podspec).The new helper is invoked once per Meta-owned React-* podspec under
packages/react-native/(72 podspecs in total: every podspec that is not a third-party shim, not a codegen test fixture, nothermes-engine, and notYoga). Baking the macro into each podspec'scompiler_flagsmirrors the.define("RCT_REMOVE_LEGACY_ARCH", to: "1")already present inPackage.swiftand provides a defensive belt-and-suspenders even for consumers that skipreact_native_post_install.Finally, the per-app
ENV['RCT_REMOVE_LEGACY_ARCH'] = '1'override that previously sat at the top ofpackages/rn-tester/Podfileis now redundant and is removed; RNTester picks the flag up from the framework defaults like every other OSS app.OSS impact: any app consuming
react_native_pods.rbwill always build React Native with-DRCT_REMOVE_LEGACY_ARCH=1. This matches the iOS source state. The env-var opt-out is gone -- settingRCT_REMOVE_LEGACY_ARCH=0in the shell or CI no longer has any effect on OSS CocoaPods or SwiftPM builds.Changelog:
[iOS][Changed] - Force
RCT_REMOVE_LEGACY_ARCH=1for the entire React Native iOS framework in OSS builds; the legacy (Paper) architecture is no longer a supported configuration. TheRCT_REMOVE_LEGACY_ARCH=0env-var opt-out has been removed fromreact_native_pods.rb.Differential Revision: D105118393