Commit a9df3d5
Define RN_BUILDING for React Native's own CMake, SwiftPM, and Buck targets (#57861)
Summary:
Pull Request resolved: #57861
React Native's public C++ headers are gaining guards from `react/cxxstableapi`, which
turn a direct include of a fine-grained header into an error for consumers that opt into
the strict API by defining `RN_STRICT_API`. React Native's own sources keep including
those headers directly, so they are exempted via `RN_BUILDING`.
Unlike CocoaPods, these three build systems each have a single chokepoint:
- CMake: one `add_compile_definitions(RN_BUILDING)` in the ReactAndroid JNI project,
a directory property inherited by every `add_react_common_subdir` below it. It is
declared *after* the third-party NDK subdirectories so glog/boost/folly/fmt never see
it, and this project never compiles app or third-party module code.
- SwiftPM: one `.define` in the shared `Target.reactNativeTarget` factory that every
React Native target is created through. `cxxSettings` are per-target and are not
inherited by packages that depend on React.
- Buck: a `_set_rn_building_flag` helper called from the four macros React Native's own
targets use. It is `preprocessor_flags`, deliberately
not `exported_preprocessor_flags`, so dependents are not exempted either.
This change is inert on its own: nothing behaves differently unless a consumer defines
`RN_STRICT_API`.
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D115051088
fbshipit-source-id: 70b525a7291227a4400beefdba2b0a3571dc032c1 parent 2e4e830 commit a9df3d5
2 files changed
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
959 | 959 | | |
960 | 960 | | |
961 | 961 | | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
962 | 966 | | |
963 | 967 | | |
964 | 968 | | |
| |||
967 | 971 | | |
968 | 972 | | |
969 | 973 | | |
| 974 | + | |
970 | 975 | | |
971 | 976 | | |
972 | 977 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
61 | 69 | | |
62 | 70 | | |
63 | 71 | | |
| |||
0 commit comments