Skip to content

Commit bf8eb11

Browse files
cortinicojeongshin
authored andcommitted
Allow to disable the New Architecture inside RN Tester (facebook#36895)
Summary: Pull Request resolved: facebook#36895 Currently RN-Tester build with the New Architecture hardcoded to true. For testing is convenient to disable it at times so we can test how the app behaves in the old arch. Changelog: [Internal] [Changed] - Allow to disable the New Architecture inside RN Tester Reviewed By: cipolleschi Differential Revision: D44917566 fbshipit-source-id: f1e6393e37bf6702677157b9577a26f0c4da0b86
1 parent 9c52944 commit bf8eb11

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

packages/rn-tester/android/app/build.gradle

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ android {
189189
cmake {
190190
// RN Tester is doing custom linking of C++ libraries therefore needs
191191
// a dedicated CMakeLists.txt file.
192-
path "src/main/jni/CMakeLists.txt"
192+
if (project.property("newArchEnabled") == "true") {
193+
path("src/main/jni/CMakeLists.txt")
194+
}
193195
}
194196
}
195197
}
@@ -202,8 +204,10 @@ afterEvaluate {
202204
// As we're building 4 native flavors in parallel, there is clash on the `.cxx/Debug` and
203205
// `.cxx/Release` folder where the CMake intermediates are stored.
204206
// We fixing this by instructing Gradle to always mergeLibs after they've been built.
205-
mergeHermesDebugNativeLibs.mustRunAfter(externalNativeBuildJscDebug)
206-
mergeHermesReleaseNativeLibs.mustRunAfter(externalNativeBuildJscRelease)
207-
mergeJscDebugNativeLibs.mustRunAfter(externalNativeBuildHermesDebug)
208-
mergeJscReleaseNativeLibs.mustRunAfter(externalNativeBuildHermesRelease)
207+
if (project.property("newArchEnabled") == "true") {
208+
mergeHermesDebugNativeLibs.mustRunAfter(externalNativeBuildJscDebug)
209+
mergeHermesReleaseNativeLibs.mustRunAfter(externalNativeBuildJscRelease)
210+
mergeJscDebugNativeLibs.mustRunAfter(externalNativeBuildHermesDebug)
211+
mergeJscReleaseNativeLibs.mustRunAfter(externalNativeBuildHermesRelease)
212+
}
209213
}

packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public List<ViewManager> createViewManagers(
118118

119119
@Override
120120
protected boolean isNewArchEnabled() {
121-
return true;
121+
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
122122
}
123123

124124
@Override
@@ -132,7 +132,9 @@ public void onCreate() {
132132
ReactFontManager.getInstance().addCustomFont(this, "Rubik", R.font.rubik);
133133
super.onCreate();
134134
SoLoader.init(this, /* native exopackage */ false);
135-
DefaultNewArchitectureEntryPoint.load();
135+
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
136+
DefaultNewArchitectureEntryPoint.load();
137+
}
136138
ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
137139
}
138140

0 commit comments

Comments
 (0)