From e6ffaa903ee88939fc1d21e12ec2f784f4d3135c Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Thu, 13 Apr 2023 01:41:37 -0700 Subject: [PATCH] Allow to disable the New Architecture inside RN Tester Summary: 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: 921615a92ea27cca8f0df6ce42085c2b8a4d20c6 --- packages/rn-tester/android/app/build.gradle | 14 +++++++++----- .../facebook/react/uiapp/RNTesterApplication.java | 6 ++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/rn-tester/android/app/build.gradle b/packages/rn-tester/android/app/build.gradle index f71bcddfa3f166..b597120366fa47 100644 --- a/packages/rn-tester/android/app/build.gradle +++ b/packages/rn-tester/android/app/build.gradle @@ -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") + } } } } @@ -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) + } } diff --git a/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.java b/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.java index 1657cdc08894fb..cb00882bbed8fb 100644 --- a/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.java +++ b/packages/rn-tester/android/app/src/main/java/com/facebook/react/uiapp/RNTesterApplication.java @@ -118,7 +118,7 @@ public List createViewManagers( @Override protected boolean isNewArchEnabled() { - return true; + return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; } @Override @@ -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()); }