Skip to content

Commit 5b6f18b

Browse files
coadometa-codesync[bot]
authored andcommitted
Build the template app with RN_STRICT_API (#59224)
Summary: Pull Request resolved: #59224 Turn on the C++ stable API checks (`RN_STRICT_API`) in the template apps CI builds, so the opt-ins, React Native's app-facing headers and the generated codegen and autolinking code are compiled in strict mode the way a new app would build them: - `private/helloworld`: `strictCxxApiEnabled=true` in `android/gradle.properties`, and the Podfile sets `RN_STRICT_API=1` unless the environment already sets it (`RN_STRICT_API=0 pod install` opts out). - Community template CI (cloned at build time): `build-android-templateapp.yml` appends `strictCxxApiEnabled=true` to the generated app's `gradle.properties`, and `e2e-ios-templateapp.yml` runs its `pod install` with `RN_STRICT_API=1`. Changelog: [Internal] ___ landed-with-radar-review Differential Revision: D126330998 fbshipit-source-id: 051b55482f4fd94aabe63c202e3415353d152b9b
1 parent 0bab052 commit 5b6f18b

4 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎.github/workflows/build-android-templateapp.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
--pathToLocalReactNative "$REACT_NATIVE_PKG"
5959
6060
echo -e "\nreact.internal.mavenLocalRepo=$MAVEN_LOCAL" >> /tmp/RNTestProject/android/gradle.properties
61+
echo "strictCxxApiEnabled=true" >> /tmp/RNTestProject/android/gradle.properties
6162
6263
CAPITALIZED_FLAVOR=$(echo "${{ matrix.flavor }}" | awk '{print toupper(substr($0, 1, 1)) substr($0, 2)}')
6364
cd /tmp/RNTestProject/android

‎.github/workflows/e2e-ios-templateapp.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
export RCT_USE_LOCAL_RN_DEP=/tmp/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz
8282
# Disable prebuilds for now, as they are causing issues with E2E tests for 0.82-stable branch
8383
export RCT_TESTONLY_RNCORE_TARBALL_PATH="/tmp/ReactCore/ReactCore${{ matrix.flavor }}.xcframework.tar.gz"
84-
RCT_NEW_ARCH_ENABLED=$NEW_ARCH_ENABLED bundle exec pod install
84+
RN_STRICT_API=1 RCT_NEW_ARCH_ENABLED=$NEW_ARCH_ENABLED bundle exec pod install
8585
8686
xcodebuild \
8787
-scheme "RNTestProject" \

‎private/helloworld/android/gradle.properties‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ reactNativeArchitectures=arm64-v8a
1111
newArchEnabled=true
1212
hermesEnabled=true
1313
edgeToEdgeEnabled=false
14+
strictCxxApiEnabled=true
1415

1516
# Opt out of built-in kotlin and new DSL behavior that ships with AGP 9.
1617
# Starting from AGP 10.x these opt outs will be removed.

‎private/helloworld/ios/Podfile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ require "../../../packages/react-native/scripts/cocoapods/autolinking.rb"
33
platform :ios, min_ios_version_supported
44
prepare_react_native_project!
55

6+
# Build with the C++ stable API enforced. Run `RN_STRICT_API=0 pod install` to opt out.
7+
ENV['RN_STRICT_API'] ||= '1'
8+
69
linkage = ENV['USE_FRAMEWORKS']
710
if linkage != nil
811
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green

0 commit comments

Comments
 (0)