Skip to content

Commit

Permalink
Allow to disable the New Architecture inside RN Tester (facebook#36895)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cortinico authored and jeongshin committed May 7, 2023
1 parent 9c52944 commit bf8eb11
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
14 changes: 9 additions & 5 deletions packages/rn-tester/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ android {
cmake {
// RN Tester is doing custom linking of C++ libraries therefore needs
// a dedicated CMakeLists.txt file.
path "src/main/jni/CMakeLists.txt"
if (project.property("newArchEnabled") == "true") {
path("src/main/jni/CMakeLists.txt")
}
}
}
}
Expand All @@ -202,8 +204,10 @@ afterEvaluate {
// As we're building 4 native flavors in parallel, there is clash on the `.cxx/Debug` and
// `.cxx/Release` folder where the CMake intermediates are stored.
// We fixing this by instructing Gradle to always mergeLibs after they've been built.
mergeHermesDebugNativeLibs.mustRunAfter(externalNativeBuildJscDebug)
mergeHermesReleaseNativeLibs.mustRunAfter(externalNativeBuildJscRelease)
mergeJscDebugNativeLibs.mustRunAfter(externalNativeBuildHermesDebug)
mergeJscReleaseNativeLibs.mustRunAfter(externalNativeBuildHermesRelease)
if (project.property("newArchEnabled") == "true") {
mergeHermesDebugNativeLibs.mustRunAfter(externalNativeBuildJscDebug)
mergeHermesReleaseNativeLibs.mustRunAfter(externalNativeBuildJscRelease)
mergeJscDebugNativeLibs.mustRunAfter(externalNativeBuildHermesDebug)
mergeJscReleaseNativeLibs.mustRunAfter(externalNativeBuildHermesRelease)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public List<ViewManager> createViewManagers(

@Override
protected boolean isNewArchEnabled() {
return true;
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
}

@Override
Expand All @@ -132,7 +132,9 @@ public void onCreate() {
ReactFontManager.getInstance().addCustomFont(this, "Rubik", R.font.rubik);
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
DefaultNewArchitectureEntryPoint.load();
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
DefaultNewArchitectureEntryPoint.load();
}
ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}

Expand Down

0 comments on commit bf8eb11

Please sign in to comment.