From e9a95d28960865b9e62ec59892bcb36850548eb3 Mon Sep 17 00:00:00 2001 From: Georgy Steshin Date: Wed, 4 Dec 2024 15:04:33 +0200 Subject: [PATCH 01/13] Enabled react native 76 --- .gitignore | 1 + detox/android/build.gradle | 8 ++++---- .../gradle/wrapper/gradle-wrapper.properties | 2 +- detox/package.json | 13 ++++++++----- detox/scripts/updateGradle.js | 2 ++ .../main/java/com/example/MainApplication.kt | 3 ++- detox/test/android/build.gradle | 6 +++--- detox/test/android/gradle.properties | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- detox/test/package.json | 19 +++++++++++-------- .../demo-react-native/android/build.gradle | 10 +++++----- .../android/gradle.properties | 3 +-- .../ios/example.xcodeproj/project.pbxproj | 4 ++++ examples/demo-react-native/package.json | 15 +++++++++------ 14 files changed, 53 insertions(+), 37 deletions(-) diff --git a/.gitignore b/.gitignore index ea33c4973b..3b3be7903f 100644 --- a/.gitignore +++ b/.gitignore @@ -198,6 +198,7 @@ project.xcworkspace # Android/IJ # .gradle +.cxx # node.js # diff --git a/detox/android/build.gradle b/detox/android/build.gradle index ed43b4202a..9cddf0cdcf 100644 --- a/detox/android/build.gradle +++ b/detox/android/build.gradle @@ -5,10 +5,10 @@ buildscript { isOfficialDetoxLib = true kotlinVersion = '1.9.24' dokkaVersion = '1.9.10' - buildToolsVersion = '34.0.0' - compileSdkVersion = 34 - targetSdkVersion = 34 - minSdkVersion = 23 + buildToolsVersion = '35.0.0' + compileSdkVersion = 35 + targetSdkVersion = 35 + minSdkVersion = 24 } ext.detoxKotlinVersion = ext.kotlinVersion diff --git a/detox/android/gradle/wrapper/gradle-wrapper.properties b/detox/android/gradle/wrapper/gradle-wrapper.properties index a4413138c9..df97d72b8b 100644 --- a/detox/android/gradle/wrapper/gradle-wrapper.properties +++ b/detox/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/detox/package.json b/detox/package.json index 7b51cdc2bd..7f475d297a 100644 --- a/detox/package.json +++ b/detox/package.json @@ -34,10 +34,13 @@ "postinstall": "node scripts/postinstall.js" }, "devDependencies": { - "@react-native/babel-preset": "0.75.4", - "@react-native/eslint-config": "0.75.4", - "@react-native/metro-config": "0.75.4", - "@react-native/typescript-config": "0.75.4", + "@react-native/babel-preset": "0.76.3", + "@react-native/eslint-config": "0.76.3", + "@react-native/metro-config": "0.76.3", + "@react-native/typescript-config": "0.76.3", + "@react-native-community/cli": "15.0.1", + "@react-native-community/cli-platform-android": "15.0.1", + "@react-native-community/cli-platform-ios": "15.0.1", "@tsconfig/react-native": "^3.0.0", "@types/bunyan": "^1.8.8", "@types/child-process-promise": "^2.2.1", @@ -59,7 +62,7 @@ "jest-allure2-reporter": "^2.0.0-beta.18", "metro-react-native-babel-preset": "0.76.8", "prettier": "^3.1.1", - "react-native": "0.75.4", + "react-native": "0.76.3", "react-native-codegen": "^0.0.8", "typescript": "^5.3.3", "wtfnode": "^0.9.1" diff --git a/detox/scripts/updateGradle.js b/detox/scripts/updateGradle.js index e3e45b19bd..12ae76d8e4 100644 --- a/detox/scripts/updateGradle.js +++ b/detox/scripts/updateGradle.js @@ -6,6 +6,8 @@ const rnMinor = require('../src/utils/rn-consts/rn-consts').rnVersion.minor; function getGradleVersionByRNVersion() { switch (rnMinor) { default: + return '8.10.2'; + case '75': return '8.8'; case '74': return '8.6'; diff --git a/detox/test/android/app/src/main/java/com/example/MainApplication.kt b/detox/test/android/app/src/main/java/com/example/MainApplication.kt index 5dfdfae2ec..4570598eff 100644 --- a/detox/test/android/app/src/main/java/com/example/MainApplication.kt +++ b/detox/test/android/app/src/main/java/com/example/MainApplication.kt @@ -5,6 +5,7 @@ import android.webkit.WebView import com.facebook.react.ReactApplication import com.facebook.react.ReactNativeHost import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load +import com.facebook.react.soloader.OpenSourceMergedSoMapping import com.facebook.soloader.SoLoader class MainApplication : Application(), ReactApplication { @@ -13,7 +14,7 @@ class MainApplication : Application(), ReactApplication { override fun onCreate() { super.onCreate() - SoLoader.init(this, /* native exopackage */false) + SoLoader.init(this, OpenSourceMergedSoMapping) WebView.setWebContentsDebuggingEnabled(true) if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { // If you opted-in for the New Architecture, we load the native entry point for this app. diff --git a/detox/test/android/build.gradle b/detox/test/android/build.gradle index 212a3b6547..fc214b3fbf 100644 --- a/detox/test/android/build.gradle +++ b/detox/test/android/build.gradle @@ -4,9 +4,9 @@ buildscript { ext { isOfficialDetoxApp = true kotlinVersion = '1.9.24' - buildToolsVersion = '34.0.0' - compileSdkVersion = 34 - targetSdkVersion = 34 + buildToolsVersion = '35.0.0' + compileSdkVersion = 35 + targetSdkVersion = 35 minSdkVersion = 26 appCompatVersion = '1.6.1' } diff --git a/detox/test/android/gradle.properties b/detox/test/android/gradle.properties index 964f22392f..f987cfa398 100644 --- a/detox/test/android/gradle.properties +++ b/detox/test/android/gradle.properties @@ -27,5 +27,5 @@ android.useAndroidX=true hermesEnabled=true reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 -newArchEnabled=false +newArchEnabled=true diff --git a/detox/test/android/gradle/wrapper/gradle-wrapper.properties b/detox/test/android/gradle/wrapper/gradle-wrapper.properties index a4413138c9..df97d72b8b 100644 --- a/detox/test/android/gradle/wrapper/gradle-wrapper.properties +++ b/detox/test/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/detox/test/package.json b/detox/test/package.json index 2c1499ef18..78a569e9c8 100644 --- a/detox/test/package.json +++ b/detox/test/package.json @@ -40,20 +40,23 @@ "@react-native-segmented-control/segmented-control": "^2.5.6", "moment": "^2.30.1", "react": "18.3.1", - "react-native": "0.75.4", + "react-native": "0.76.3", "react-native-launch-arguments": "^4.0.2", "react-native-permissions": "^5.2.1", "react-native-webview": "^13.12.4", "ssim.js": "^3.5.0" }, "devDependencies": { - "@babel/core": "^7.20.0", - "@babel/preset-env": "^7.20.0", - "@babel/runtime": "^7.20.0", - "@react-native/babel-preset": "0.75.4", - "@react-native/eslint-config": "0.75.4", - "@react-native/metro-config": "0.75.4", - "@react-native/typescript-config": "0.75.4", + "@babel/core": "^7.25.2", + "@babel/preset-env": "^7.25.3", + "@babel/runtime": "^7.25.0", + "@react-native/babel-preset": "0.76.3", + "@react-native/eslint-config": "0.76.3", + "@react-native/metro-config": "0.76.3", + "@react-native/typescript-config": "0.76.3", + "@react-native-community/cli": "15.0.1", + "@react-native-community/cli-platform-android": "15.0.1", + "@react-native-community/cli-platform-ios": "15.0.1", "@tsconfig/react-native": "^3.0.0", "@types/jest": "^29.5.11", "@types/node": "^16.18.68", diff --git a/examples/demo-react-native/android/build.gradle b/examples/demo-react-native/android/build.gradle index c6fcf8ba6f..1ec1d16b28 100644 --- a/examples/demo-react-native/android/build.gradle +++ b/examples/demo-react-native/android/build.gradle @@ -2,11 +2,11 @@ buildscript { apply from: '../../../detox/android/rninfo.gradle' ext { - kotlinVersion = '1.9.20' - buildToolsVersion = '34.0.0' - compileSdkVersion = 34 - targetSdkVersion = 34 - minSdkVersion = 23 + kotlinVersion = '1.9.24' + buildToolsVersion = '35.0.0' + compileSdkVersion = 35 + targetSdkVersion = 35 + minSdkVersion = 24 } repositories { diff --git a/examples/demo-react-native/android/gradle.properties b/examples/demo-react-native/android/gradle.properties index 47093e8b7c..3fe07a4a81 100644 --- a/examples/demo-react-native/android/gradle.properties +++ b/examples/demo-react-native/android/gradle.properties @@ -17,5 +17,4 @@ org.gradle.jvmargs=-Xmx3g -Dfile.encoding=UTF-8 # org.gradle.parallel=true android.useAndroidX=true -android.enableJetifier=true - +newArchEnabled=true diff --git a/examples/demo-react-native/ios/example.xcodeproj/project.pbxproj b/examples/demo-react-native/ios/example.xcodeproj/project.pbxproj index bf8b29778b..6190bf59bb 100644 --- a/examples/demo-react-native/ios/example.xcodeproj/project.pbxproj +++ b/examples/demo-react-native/ios/example.xcodeproj/project.pbxproj @@ -227,17 +227,21 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/RCT-Folly/RCT-Folly_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/RNCAsyncStorage/RNCAsyncStorage_resources.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/React-Core_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact/React-cxxreact_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/boost/boost_privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/glog/glog_privacy.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RCT-Folly_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RNCAsyncStorage_resources.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-Core_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-cxxreact_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/boost_privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/glog_privacy.bundle", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; diff --git a/examples/demo-react-native/package.json b/examples/demo-react-native/package.json index 5f2a32ead2..69e5750cd1 100644 --- a/examples/demo-react-native/package.json +++ b/examples/demo-react-native/package.json @@ -24,15 +24,18 @@ "dependencies": { "@react-native-async-storage/async-storage": "^2.1.0", "react": "18.3.1", - "react-native": "0.75.4", + "react-native": "0.76.3", "tslib": "^2.0.3" }, "devDependencies": { - "@babel/preset-env": "^7.20.0", - "@react-native/babel-preset": "0.75.4", - "@react-native/eslint-config": "0.75.4", - "@react-native/metro-config": "0.75.4", - "@react-native/typescript-config": "0.75.4", + "@babel/preset-env": "^7.25.3", + "@react-native/babel-preset": "0.76.3", + "@react-native/eslint-config": "0.76.3", + "@react-native/metro-config": "0.76.3", + "@react-native/typescript-config": "0.76.3", + "@react-native-community/cli": "15.0.1", + "@react-native-community/cli-platform-android": "15.0.1", + "@react-native-community/cli-platform-ios": "15.0.1", "@tsconfig/react-native": "^3.0.5", "@types/fs-extra": "^9.0.13", "@types/jest": "^29.2.1", From fcf0809f4344e679756123cbe82e070575a4b3f3 Mon Sep 17 00:00:00 2001 From: Georgy Steshin Date: Thu, 5 Dec 2024 10:30:36 +0200 Subject: [PATCH 02/13] Enabled react native 76 --- .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/demo-react-native/android/gradle/wrapper/gradle-wrapper.properties b/examples/demo-react-native/android/gradle/wrapper/gradle-wrapper.properties index a4413138c9..79eb9d003f 100644 --- a/examples/demo-react-native/android/gradle/wrapper/gradle-wrapper.properties +++ b/examples/demo-react-native/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From 0eeae3f13181b6e2085eb643e01f8ed9fe67d03c Mon Sep 17 00:00:00 2001 From: Georgy Steshin Date: Thu, 5 Dec 2024 10:35:10 +0200 Subject: [PATCH 03/13] Disabled new arch --- detox/test/android/gradle.properties | 2 +- examples/demo-react-native/android/gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/detox/test/android/gradle.properties b/detox/test/android/gradle.properties index f987cfa398..964f22392f 100644 --- a/detox/test/android/gradle.properties +++ b/detox/test/android/gradle.properties @@ -27,5 +27,5 @@ android.useAndroidX=true hermesEnabled=true reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 -newArchEnabled=true +newArchEnabled=false diff --git a/examples/demo-react-native/android/gradle.properties b/examples/demo-react-native/android/gradle.properties index 3fe07a4a81..abdd9a445b 100644 --- a/examples/demo-react-native/android/gradle.properties +++ b/examples/demo-react-native/android/gradle.properties @@ -17,4 +17,4 @@ org.gradle.jvmargs=-Xmx3g -Dfile.encoding=UTF-8 # org.gradle.parallel=true android.useAndroidX=true -newArchEnabled=true +newArchEnabled=false From bd48a07367b6b67537c6d7f05df70e12d23812c2 Mon Sep 17 00:00:00 2001 From: Georgy Steshin Date: Thu, 5 Dec 2024 10:41:01 +0200 Subject: [PATCH 04/13] Enable build on rn76 --- .buildkite/jobs/pipeline.android_rn_76.yml | 12 ++++++++++++ .buildkite/jobs/pipeline.ios_demo_app_rn_76.yml | 9 +++++++++ .buildkite/jobs/pipeline.ios_rn_76.yml | 10 ++++++++++ 3 files changed, 31 insertions(+) create mode 100644 .buildkite/jobs/pipeline.android_rn_76.yml create mode 100644 .buildkite/jobs/pipeline.ios_demo_app_rn_76.yml create mode 100644 .buildkite/jobs/pipeline.ios_rn_76.yml diff --git a/.buildkite/jobs/pipeline.android_rn_76.yml b/.buildkite/jobs/pipeline.android_rn_76.yml new file mode 100644 index 0000000000..bdbc79c0df --- /dev/null +++ b/.buildkite/jobs/pipeline.android_rn_76.yml @@ -0,0 +1,12 @@ + - label: ":android::detox: RN .76 + Android: Tests app" + command: + - "nvm install" + - "./scripts/ci.android.sh" + env: + REACT_NATIVE_VERSION: 0.76.3 + DETOX_DISABLE_POD_INSTALL: true + DETOX_DISABLE_POSTINSTALL: true + artifact_paths: + - "/Users/builder/uibuilder/work/coverage/**/*.lcov" + - "/Users/builder/uibuilder/work/**/allure-report-*.html" + - "/Users/builder/uibuilder/work/artifacts*.tar.gz" diff --git a/.buildkite/jobs/pipeline.ios_demo_app_rn_76.yml b/.buildkite/jobs/pipeline.ios_demo_app_rn_76.yml new file mode 100644 index 0000000000..aff5caf84a --- /dev/null +++ b/.buildkite/jobs/pipeline.ios_demo_app_rn_76.yml @@ -0,0 +1,9 @@ + - label: ":ios::react: RN .76 + iOS: Demo app" + command: + - "nvm install" + - "./scripts/demo-projects.ios.sh" + env: + REACT_NATIVE_VERSION: 0.76.3 + artifact_paths: + - "/Users/builder/uibuilder/work/coverage/**/*.lcov" + - "/Users/builder/uibuilder/work/artifacts*.tar.gz" diff --git a/.buildkite/jobs/pipeline.ios_rn_76.yml b/.buildkite/jobs/pipeline.ios_rn_76.yml new file mode 100644 index 0000000000..b31ba4e00a --- /dev/null +++ b/.buildkite/jobs/pipeline.ios_rn_76.yml @@ -0,0 +1,10 @@ + - label: ":ios::detox: RN .76 + iOS: Tests app" + command: + - "nvm install" + - "./scripts/ci.ios.sh" + env: + REACT_NATIVE_VERSION: 0.76.3 + artifact_paths: + - "/Users/builder/uibuilder/work/coverage/**/*.lcov" + - "/Users/builder/uibuilder/work/**/allure-report-*.html" + - "/Users/builder/uibuilder/work/artifacts*.tar.gz" From 9bbd52e364b31841760ba75bcf510e125d112463 Mon Sep 17 00:00:00 2001 From: Georgy Steshin Date: Thu, 5 Dec 2024 10:43:34 +0200 Subject: [PATCH 05/13] Enable build on rn76 --- ...emo_app_rn_75.yml => pipeline.android_demo_app_rn_76.yml} | 4 ++-- .buildkite/pipeline_common.sh | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) rename .buildkite/jobs/{pipeline.android_demo_app_rn_75.yml => pipeline.android_demo_app_rn_76.yml} (81%) diff --git a/.buildkite/jobs/pipeline.android_demo_app_rn_75.yml b/.buildkite/jobs/pipeline.android_demo_app_rn_76.yml similarity index 81% rename from .buildkite/jobs/pipeline.android_demo_app_rn_75.yml rename to .buildkite/jobs/pipeline.android_demo_app_rn_76.yml index 2b76e23d0a..905d2648ee 100644 --- a/.buildkite/jobs/pipeline.android_demo_app_rn_75.yml +++ b/.buildkite/jobs/pipeline.android_demo_app_rn_76.yml @@ -1,9 +1,9 @@ - - label: ":android::react: RN .75 + Android: Demo app" + - label: ":android::react: RN .76 + Android: Demo app" command: - "nvm install" - "./scripts/demo-projects.android.sh" env: - REACT_NATIVE_VERSION: 0.75.4 + REACT_NATIVE_VERSION: 0.76.3 REACT_NATIVE_COMPAT_TEST: true # Only set 'true' in jobs with the latest supported RN DETOX_DISABLE_POD_INSTALL: true DETOX_DISABLE_POSTINSTALL: true diff --git a/.buildkite/pipeline_common.sh b/.buildkite/pipeline_common.sh index cae5e1e799..425258cc56 100755 --- a/.buildkite/pipeline_common.sh +++ b/.buildkite/pipeline_common.sh @@ -2,11 +2,14 @@ echo "steps:" +cat .buildkite/jobs/pipeline.ios_rn_76.yml cat .buildkite/jobs/pipeline.ios_rn_75.yml cat .buildkite/jobs/pipeline.ios_rn_73.yml +cat .buildkite/jobs/pipeline.ios_demo_app_rn_76.yml cat .buildkite/jobs/pipeline.ios_demo_app_rn_75.yml cat .buildkite/jobs/pipeline.ios_demo_app_rn_73.yml +cat .buildkite/jobs/pipeline.android_rn_76.yml cat .buildkite/jobs/pipeline.android_rn_75.yml cat .buildkite/jobs/pipeline.android_rn_73.yml -cat .buildkite/jobs/pipeline.android_demo_app_rn_75.yml +cat .buildkite/jobs/pipeline.android_demo_app_rn_76.yml cat .buildkite/pipeline.post_processing.yml From aee3ee57777e80ddac8c46c2ef0ef3d18bd9e984 Mon Sep 17 00:00:00 2001 From: Georgy Steshin Date: Thu, 5 Dec 2024 13:45:38 +0200 Subject: [PATCH 06/13] Disabled new arch for iOS --- detox/test/ios/Podfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/detox/test/ios/Podfile b/detox/test/ios/Podfile index ed419b26f0..030471de41 100644 --- a/detox/test/ios/Podfile +++ b/detox/test/ios/Podfile @@ -1,3 +1,5 @@ +ENV['RCT_NEW_ARCH_ENABLED'] = '0' + if ENV["REACT_NATIVE_VERSION"] && ENV["REACT_NATIVE_VERSION"].match(/0.(70|71).*/) require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' From f89f72ab1b10c6d85cf6df24e7f8cdf87a8d3b45 Mon Sep 17 00:00:00 2001 From: Georgy Steshin Date: Thu, 5 Dec 2024 14:12:03 +0200 Subject: [PATCH 07/13] Fixed build for react native demo app --- .../android/app/build.gradle | 1 + .../java/com/example/MainApplication.java | 29 +++++++++++++++++-- .../demo-react-native/android/build.gradle | 6 ++-- .../android/gradle.properties | 1 + examples/demo-react-native/package.json | 4 ++- 5 files changed, 34 insertions(+), 7 deletions(-) diff --git a/examples/demo-react-native/android/app/build.gradle b/examples/demo-react-native/android/app/build.gradle index 38cd6180b4..2e4b39b0b6 100644 --- a/examples/demo-react-native/android/app/build.gradle +++ b/examples/demo-react-native/android/app/build.gradle @@ -8,6 +8,7 @@ react { android { namespace 'com.example' + ndkVersion rootProject.ext.ndkVersion buildToolsVersion = rootProject.ext.buildToolsVersion println("[$project] Using buildToolsVersion $buildToolsVersion") diff --git a/examples/demo-react-native/android/app/src/main/java/com/example/MainApplication.java b/examples/demo-react-native/android/app/src/main/java/com/example/MainApplication.java index a977bbac2a..006ef4a246 100644 --- a/examples/demo-react-native/android/app/src/main/java/com/example/MainApplication.java +++ b/examples/demo-react-native/android/app/src/main/java/com/example/MainApplication.java @@ -2,19 +2,24 @@ import android.app.Application; +import androidx.annotation.Nullable; + import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; +import com.facebook.react.defaults.DefaultReactNativeHost; import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; import com.reactnativecommunity.asyncstorage.AsyncStoragePackage; +import java.io.IOException; import java.util.Arrays; import java.util.List; +import com.facebook.react.soloader.OpenSourceMergedSoMapping; public class MainApplication extends Application implements ReactApplication { - private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { + private final ReactNativeHost mReactNativeHost = new DefaultReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; @@ -24,6 +29,22 @@ public boolean getUseDeveloperSupport() { protected List getPackages() { return new PackageList(this).getPackages(); } + + @Override + protected String getJSMainModuleName() { + return "index"; + } + + @Override + protected boolean isNewArchEnabled() { + return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; + } + + @Nullable + @Override + protected Boolean isHermesEnabled() { + return BuildConfig.IS_HERMES_ENABLED; + } }; @Override @@ -34,7 +55,11 @@ public ReactNativeHost getReactNativeHost() { @Override public void onCreate() { super.onCreate(); - SoLoader.init(this, /* native exopackage */ false); + try { + SoLoader.init(this, OpenSourceMergedSoMapping.INSTANCE); + } catch (IOException e) { + throw new RuntimeException(e); + } } } diff --git a/examples/demo-react-native/android/build.gradle b/examples/demo-react-native/android/build.gradle index 1ec1d16b28..1ca12d6788 100644 --- a/examples/demo-react-native/android/build.gradle +++ b/examples/demo-react-native/android/build.gradle @@ -6,6 +6,7 @@ buildscript { buildToolsVersion = '35.0.0' compileSdkVersion = 35 targetSdkVersion = 35 + ndkVersion = "26.1.10909125" minSdkVersion = 24 } @@ -42,7 +43,4 @@ subprojects { } } -if (ext.rnInfo.isRN73OrHigher) { - apply plugin: "com.facebook.react.rootproject" -} - +apply plugin: "com.facebook.react.rootproject" diff --git a/examples/demo-react-native/android/gradle.properties b/examples/demo-react-native/android/gradle.properties index abdd9a445b..f9392719ad 100644 --- a/examples/demo-react-native/android/gradle.properties +++ b/examples/demo-react-native/android/gradle.properties @@ -18,3 +18,4 @@ org.gradle.jvmargs=-Xmx3g -Dfile.encoding=UTF-8 android.useAndroidX=true newArchEnabled=false +hermesEnabled=true diff --git a/examples/demo-react-native/package.json b/examples/demo-react-native/package.json index 69e5750cd1..2a0e1e2393 100644 --- a/examples/demo-react-native/package.json +++ b/examples/demo-react-native/package.json @@ -44,6 +44,8 @@ "fs-extra": "^9.1.0", "jest": "^29.6.3", "ts-jest": "^29.0.3", - "typescript": "^5.3.3" + "typescript": "^5.3.3", + "@types/react-test-renderer": "^18.0.0", + "react-test-renderer": "18.3.1" } } From 76893833ac8aceb856de021fee62e1aa06e2f628 Mon Sep 17 00:00:00 2001 From: Georgy Steshin Date: Thu, 5 Dec 2024 14:48:39 +0200 Subject: [PATCH 08/13] Support rn < 76 tests --- .../wix/detox/reactnative/ReactNativeInfo.kt | 15 ++++---------- .../main/java/com/example/MainApplication.kt | 5 ++--- .../java/com/example/utils/DetoxSoLoader.kt | 20 +++++++++++++++++++ 3 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 detox/test/android/app/src/main/java/com/example/utils/DetoxSoLoader.kt diff --git a/detox/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeInfo.kt b/detox/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeInfo.kt index 05ac69419b..682bf07b02 100644 --- a/detox/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeInfo.kt +++ b/detox/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeInfo.kt @@ -1,20 +1,13 @@ package com.wix.detox.reactnative -import org.joor.Reflect -import java.util.Map +import com.facebook.react.modules.systeminfo.ReactNativeVersion data class RNVersion(val major: Int, val minor: Int, val patch: Int) object ReactNativeInfo { - private var rnVersion: RNVersion = - try { - val versionClass = Class.forName("com.facebook.react.modules.systeminfo.ReactNativeVersion") - val versionMap: Map = Reflect.on(versionClass).field("VERSION").get() - RNVersion(versionMap.get("major")!!, versionMap.get("minor")!!, versionMap.get("patch")!!) - } catch (e: ClassNotFoundException) { - // ReactNativeVersion was introduced in RN50, default to latest previous version. - RNVersion(0, 49, 0) - } + private var rnVersion: RNVersion = ReactNativeVersion.VERSION.run { + RNVersion(get("major") as Int, get("minor") as Int, get("patch") as Int) + } @JvmStatic fun rnVersion() = rnVersion diff --git a/detox/test/android/app/src/main/java/com/example/MainApplication.kt b/detox/test/android/app/src/main/java/com/example/MainApplication.kt index 4570598eff..18ddeffe97 100644 --- a/detox/test/android/app/src/main/java/com/example/MainApplication.kt +++ b/detox/test/android/app/src/main/java/com/example/MainApplication.kt @@ -2,19 +2,18 @@ package com.example import android.app.Application import android.webkit.WebView +import com.example.utils.DetoxSoLoader import com.facebook.react.ReactApplication import com.facebook.react.ReactNativeHost import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load -import com.facebook.react.soloader.OpenSourceMergedSoMapping -import com.facebook.soloader.SoLoader class MainApplication : Application(), ReactApplication { override val reactNativeHost: ReactNativeHost = DetoxRNHost(this) override fun onCreate() { super.onCreate() + DetoxSoLoader.init(this) - SoLoader.init(this, OpenSourceMergedSoMapping) WebView.setWebContentsDebuggingEnabled(true) if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { // If you opted-in for the New Architecture, we load the native entry point for this app. diff --git a/detox/test/android/app/src/main/java/com/example/utils/DetoxSoLoader.kt b/detox/test/android/app/src/main/java/com/example/utils/DetoxSoLoader.kt new file mode 100644 index 0000000000..214b175285 --- /dev/null +++ b/detox/test/android/app/src/main/java/com/example/utils/DetoxSoLoader.kt @@ -0,0 +1,20 @@ +package com.example.utils + +import android.app.Application +import android.content.Context +import com.facebook.react.modules.systeminfo.ReactNativeVersion +import com.facebook.soloader.SoLoader + +private const val OpenSourceMergedSoMappingClassName = "com.facebook.react.soloader.OpenSourceMergedSoMapping" + +object DetoxSoLoader { + fun init(appContext: Context) { + if (ReactNativeVersion.VERSION.run { get("minor") as Int } >= 76) { + val mergedSoMappingClass = Class.forName(OpenSourceMergedSoMappingClassName) + val initMethod = SoLoader::class.java.getMethod("init", Application::class.java, Class::class.java) + initMethod.invoke(null, this, mergedSoMappingClass) + } else { + SoLoader.init(appContext, false) + } + } +} From 4374395a4e5f5951137b41af3da79af81fdbb070 Mon Sep 17 00:00:00 2001 From: Georgy Steshin Date: Thu, 5 Dec 2024 15:09:35 +0200 Subject: [PATCH 09/13] Fixed validation --- .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/demo-react-native/android/gradle/wrapper/gradle-wrapper.properties b/examples/demo-react-native/android/gradle/wrapper/gradle-wrapper.properties index 79eb9d003f..df97d72b8b 100644 --- a/examples/demo-react-native/android/gradle/wrapper/gradle-wrapper.properties +++ b/examples/demo-react-native/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From cac8ce2a94ecdd99d7e9e4631478769d75135f82 Mon Sep 17 00:00:00 2001 From: Georgy Steshin Date: Thu, 5 Dec 2024 15:25:58 +0200 Subject: [PATCH 10/13] Updated docs of supported react native versions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 286ba0d935..cb3e587245 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ The most difficult part of automated testing on mobile is the tip of the testing Detox was built from the ground up to support React Native projects. -While Detox should work out of the box with almost any React Native version of the latest minor releases, official support is provided for React Native versions `0.72.x`, `0.73.x`, `0.74.x`, `0.75.x` with or without React Native's ["New Architecture"](https://reactnative.dev/docs/the-new-architecture/landing-page). +While Detox should work out of the box with almost any React Native version of the latest minor releases, official support is provided for React Native versions `0.72.x`, `0.73.x`, `0.74.x`, `0.75.x`, `0.76.x` without React Native's ["New Architecture"](https://reactnative.dev/docs/the-new-architecture/landing-page). Newer versions, as well as React Native's "New Architecture", may work with Detox, but have not been tested out yet by the Detox team. From b3d954461a1f8ff63d964d54311deb998e59013c Mon Sep 17 00:00:00 2001 From: Georgy Steshin Date: Mon, 9 Dec 2024 13:00:45 +0200 Subject: [PATCH 11/13] Fixed RN 76 reflection --- .../app/src/main/java/com/example/utils/DetoxSoLoader.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/detox/test/android/app/src/main/java/com/example/utils/DetoxSoLoader.kt b/detox/test/android/app/src/main/java/com/example/utils/DetoxSoLoader.kt index 214b175285..07b5870944 100644 --- a/detox/test/android/app/src/main/java/com/example/utils/DetoxSoLoader.kt +++ b/detox/test/android/app/src/main/java/com/example/utils/DetoxSoLoader.kt @@ -1,6 +1,5 @@ package com.example.utils -import android.app.Application import android.content.Context import com.facebook.react.modules.systeminfo.ReactNativeVersion import com.facebook.soloader.SoLoader @@ -11,8 +10,9 @@ object DetoxSoLoader { fun init(appContext: Context) { if (ReactNativeVersion.VERSION.run { get("minor") as Int } >= 76) { val mergedSoMappingClass = Class.forName(OpenSourceMergedSoMappingClassName) - val initMethod = SoLoader::class.java.getMethod("init", Application::class.java, Class::class.java) - initMethod.invoke(null, this, mergedSoMappingClass) + val externalSoMapping = Class.forName("com.facebook.soloader.ExternalSoMapping") + val initMethod = SoLoader::class.java.getMethod("init", Context::class.java, externalSoMapping) + initMethod.invoke(null, appContext, mergedSoMappingClass.getDeclaredField("INSTANCE").get(null)) } else { SoLoader.init(appContext, false) } From 30b16018ccb7656140a338db73383e1ef86c5f63 Mon Sep 17 00:00:00 2001 From: Georgy Steshin Date: Mon, 9 Dec 2024 13:25:10 +0200 Subject: [PATCH 12/13] Fixed progurad for release build --- detox/android/detox/proguard-rules-app.pro | 3 +++ .../app/src/main/java/com/example/utils/DetoxSoLoader.kt | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/detox/android/detox/proguard-rules-app.pro b/detox/android/detox/proguard-rules-app.pro index a4960cffd1..b47b6cc186 100644 --- a/detox/android/detox/proguard-rules-app.pro +++ b/detox/android/detox/proguard-rules-app.pro @@ -8,6 +8,9 @@ -keep class com.facebook.react.ReactInstanceManager { *; } -keep class com.facebook.react.ReactInstanceManager** { *; } -keep class com.facebook.react.ReactInstanceEventListener { *; } +-keep class com.facebook.react.soloader.OpenSourceMergedSoMapping { *; } +-keep class com.facebook.soloader.SoLoader { *; } +-keep class com.facebook.soloader.ExternalSoMapping { *; } -keep class com.facebook.react.views.slider.** { *; } -keep class com.google.android.material.slider.** { *; } diff --git a/detox/test/android/app/src/main/java/com/example/utils/DetoxSoLoader.kt b/detox/test/android/app/src/main/java/com/example/utils/DetoxSoLoader.kt index 07b5870944..4cf4e652f8 100644 --- a/detox/test/android/app/src/main/java/com/example/utils/DetoxSoLoader.kt +++ b/detox/test/android/app/src/main/java/com/example/utils/DetoxSoLoader.kt @@ -5,12 +5,13 @@ import com.facebook.react.modules.systeminfo.ReactNativeVersion import com.facebook.soloader.SoLoader private const val OpenSourceMergedSoMappingClassName = "com.facebook.react.soloader.OpenSourceMergedSoMapping" +private const val ExternalSoMappingClassName ="com.facebook.soloader.ExternalSoMapping" object DetoxSoLoader { fun init(appContext: Context) { if (ReactNativeVersion.VERSION.run { get("minor") as Int } >= 76) { val mergedSoMappingClass = Class.forName(OpenSourceMergedSoMappingClassName) - val externalSoMapping = Class.forName("com.facebook.soloader.ExternalSoMapping") + val externalSoMapping = Class.forName(ExternalSoMappingClassName) val initMethod = SoLoader::class.java.getMethod("init", Context::class.java, externalSoMapping) initMethod.invoke(null, appContext, mergedSoMappingClass.getDeclaredField("INSTANCE").get(null)) } else { From bc3d50b6f720210a6cbe356a09d70ff78ae59402 Mon Sep 17 00:00:00 2001 From: Georgy Steshin Date: Tue, 10 Dec 2024 12:06:55 +0200 Subject: [PATCH 13/13] Removed old build kite jobs --- .buildkite/jobs/pipeline.ios_demo_app_rn_73.yml | 9 --------- .buildkite/jobs/pipeline.ios_demo_app_rn_75.yml | 9 --------- .buildkite/pipeline_common.sh | 2 -- 3 files changed, 20 deletions(-) delete mode 100644 .buildkite/jobs/pipeline.ios_demo_app_rn_73.yml delete mode 100644 .buildkite/jobs/pipeline.ios_demo_app_rn_75.yml diff --git a/.buildkite/jobs/pipeline.ios_demo_app_rn_73.yml b/.buildkite/jobs/pipeline.ios_demo_app_rn_73.yml deleted file mode 100644 index a4420a2c06..0000000000 --- a/.buildkite/jobs/pipeline.ios_demo_app_rn_73.yml +++ /dev/null @@ -1,9 +0,0 @@ - - label: ":ios::react: RN .73 + iOS: Demo app" - command: - - "nvm install" - - "./scripts/demo-projects.ios.sh" - env: - REACT_NATIVE_VERSION: 0.73.2 - artifact_paths: - - "/Users/builder/uibuilder/work/coverage/**/*.lcov" - - "/Users/builder/uibuilder/work/artifacts*.tar.gz" diff --git a/.buildkite/jobs/pipeline.ios_demo_app_rn_75.yml b/.buildkite/jobs/pipeline.ios_demo_app_rn_75.yml deleted file mode 100644 index 623b1e35c6..0000000000 --- a/.buildkite/jobs/pipeline.ios_demo_app_rn_75.yml +++ /dev/null @@ -1,9 +0,0 @@ - - label: ":ios::react: RN .75 + iOS: Demo app" - command: - - "nvm install" - - "./scripts/demo-projects.ios.sh" - env: - REACT_NATIVE_VERSION: 0.75.4 - artifact_paths: - - "/Users/builder/uibuilder/work/coverage/**/*.lcov" - - "/Users/builder/uibuilder/work/artifacts*.tar.gz" diff --git a/.buildkite/pipeline_common.sh b/.buildkite/pipeline_common.sh index 425258cc56..4afa7835b7 100755 --- a/.buildkite/pipeline_common.sh +++ b/.buildkite/pipeline_common.sh @@ -6,8 +6,6 @@ cat .buildkite/jobs/pipeline.ios_rn_76.yml cat .buildkite/jobs/pipeline.ios_rn_75.yml cat .buildkite/jobs/pipeline.ios_rn_73.yml cat .buildkite/jobs/pipeline.ios_demo_app_rn_76.yml -cat .buildkite/jobs/pipeline.ios_demo_app_rn_75.yml -cat .buildkite/jobs/pipeline.ios_demo_app_rn_73.yml cat .buildkite/jobs/pipeline.android_rn_76.yml cat .buildkite/jobs/pipeline.android_rn_75.yml cat .buildkite/jobs/pipeline.android_rn_73.yml