From b82d54f72a5ac64cd6614e3d0a1540d70b321fdf Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Tue, 6 Jun 2023 19:37:19 +0200 Subject: [PATCH] Use React Native and Hermes modules from Maven We no longer need to publish these binaries because React Native team is publishing React Native binaries to Maven. --- packages/react-native-aztec/android/build.gradle | 10 ++-------- packages/react-native-bridge/android/build.gradle | 5 +++++ .../android/react-native-bridge/build.gradle | 14 +++----------- .../react-native-editor/android/app/build.gradle | 11 +++++------ packages/react-native-editor/android/build.gradle | 9 +-------- 5 files changed, 16 insertions(+), 33 deletions(-) diff --git a/packages/react-native-aztec/android/build.gradle b/packages/react-native-aztec/android/build.gradle index b7d2080b2e463e..5e7d12279cf710 100644 --- a/packages/react-native-aztec/android/build.gradle +++ b/packages/react-native-aztec/android/build.gradle @@ -75,13 +75,7 @@ repositories { } maven { url "https://a8c-libs.s3.amazonaws.com/android/react-native-mirror" } google() - mavenCentral { - // We don't want to fetch react-native from Maven Central as there are - // older versions over there. - content { - excludeGroup "com.facebook.react" - } - } + mavenCentral() } dependencies { @@ -100,7 +94,7 @@ dependencies { def rnVersion = readReactNativeVersion('../../../package.json', 'devDependencies') println "react-native version for react-native-aztec: $rnVersion" - implementation "com.facebook.react:react-native:$rnVersion" + implementation "com.facebook.react:react-android:$rnVersion" } project.afterEvaluate { diff --git a/packages/react-native-bridge/android/build.gradle b/packages/react-native-bridge/android/build.gradle index 99069d55cfb6bf..e1e4675b9d0d5b 100644 --- a/packages/react-native-bridge/android/build.gradle +++ b/packages/react-native-bridge/android/build.gradle @@ -12,6 +12,11 @@ plugins { allprojects { repositories { + mavenCentral() + // Starting from React Native 0.70, we no longer need to publish React Native binaries + // because they are already published to Maven (reference: https://t.ly/Biea). + // However, the third-party dependencies from forked repositories still point to older + // versions of React Native, hence we need to keep this Maven repository. maven { url "https://a8c-libs.s3.amazonaws.com/android/react-native-mirror" } } } diff --git a/packages/react-native-bridge/android/react-native-bridge/build.gradle b/packages/react-native-bridge/android/react-native-bridge/build.gradle index 07e8f7973da46b..fcb0de3b7d53ae 100644 --- a/packages/react-native-bridge/android/react-native-bridge/build.gradle +++ b/packages/react-native-bridge/android/react-native-bridge/build.gradle @@ -47,13 +47,7 @@ repositories { maven { url "https://a8c-libs.s3.amazonaws.com/android" } maven { url "https://jitpack.io" } google() - mavenCentral { - // We don't want to fetch react-native from Maven Central as there are - // older versions over there. - content { - excludeGroup "com.facebook.react" - } - } + mavenCentral() } dependencies { @@ -68,7 +62,7 @@ dependencies { println "react-native version for react-native-bridge: $rnVersion" def packageJson = '../../../react-native-editor/package.json' - implementation "com.facebook.react:react-native:$rnVersion" + implementation "com.facebook.react:react-android:$rnVersion" implementation "com.github.wordpress-mobile:react-native-video:${extractPackageVersion(packageJson, 'react-native-video', 'dependencies')}" implementation "com.github.wordpress-mobile:react-native-linear-gradient:${extractPackageVersion(packageJson, 'react-native-linear-gradient', 'dependencies')}" implementation "com.github.wordpress-mobile:react-native-slider:${extractPackageVersion(packageJson, '@react-native-community/slider', 'dependencies')}" @@ -93,9 +87,7 @@ dependencies { implementation "$reactNativeLibrariesGroupId:react-native-clipboard:${extractPackageVersion(packageJson, '@react-native-clipboard/clipboard', 'dependencies')}" implementation "$reactNativeLibrariesGroupId:react-native-fast-image:${extractPackageVersion(packageJson, 'react-native-fast-image', 'dependencies')}" - runtimeOnly("com.facebook.react:hermes-engine:$rnVersion", { - exclude group:'com.facebook.fbjni' - }) + runtimeOnly "com.facebook.react:hermes-android:$rnVersion" if (willPublishReactNativeBridgeBinary) { implementation "org.wordpress-mobile.gutenberg-mobile:react-native-aztec:$reactNativeAztecVersion" diff --git a/packages/react-native-editor/android/app/build.gradle b/packages/react-native-editor/android/app/build.gradle index 806745c27a2143..84856590146fbf 100644 --- a/packages/react-native-editor/android/app/build.gradle +++ b/packages/react-native-editor/android/app/build.gradle @@ -127,8 +127,8 @@ dependencies { implementation "org.wordpress-mobile.gutenberg-mobile:react-native-bridge" implementation 'androidx.appcompat:appcompat:1.2.0' - //noinspection GradleDynamicVersion - implementation "com.facebook.react:react-native:${extractPackageVersion(packageJson, 'react-native', 'dependencies')}" + // The version of react-native is set by the React Native Gradle Plugin + implementation "com.facebook.react:react-android" implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" @@ -155,10 +155,9 @@ dependencies { implementation "$reactNativeLibrariesGroupId:react-native-masked-view:${extractPackageVersion(packageJson, '@react-native-masked-view/masked-view', 'dependencies')}" implementation "$reactNativeLibrariesGroupId:react-native-clipboard:${extractPackageVersion(packageJson, '@react-native-clipboard/clipboard', 'dependencies')}" implementation "$reactNativeLibrariesGroupId:react-native-fast-image:${extractPackageVersion(packageJson, 'react-native-fast-image', 'dependencies')}" - - implementation("com.facebook.react:hermes-engine:${extractPackageVersion(packageJson, 'react-native', 'dependencies')}") { - exclude group:'com.facebook.fbjni' - } + + // The version of react-native is set by the React Native Gradle Plugin + implementation "com.facebook.react:hermes-android" debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { exclude group:'com.facebook.fbjni' diff --git a/packages/react-native-editor/android/build.gradle b/packages/react-native-editor/android/build.gradle index 983f18c51dae4d..7177fa965b8f66 100644 --- a/packages/react-native-editor/android/build.gradle +++ b/packages/react-native-editor/android/build.gradle @@ -24,13 +24,7 @@ buildscript { allprojects { repositories { - mavenCentral { - // We don't want to fetch react-native from Maven Central as there are - // older versions over there. - content { - excludeGroup "com.facebook.react" - } - } + mavenCentral() mavenLocal() maven { url "https://a8c-libs.s3.amazonaws.com/android" @@ -41,7 +35,6 @@ allprojects { includeGroupByRegex "org.wordpress-mobile.react-native-libraries.*" } } - maven { url "https://a8c-libs.s3.amazonaws.com/android/react-native-mirror" } maven { url 'https://www.jitpack.io' } google() }