Skip to content

Commit 4d91f40

Browse files
cortinicofacebook-github-bot
authored andcommitted
Update template/android and RN Tester to use hermes-engine from the react-native NPM package. (#33467)
Summary: Pull Request resolved: #33467 We can now change the `hermes-engine` dependency to be consumed by the `react-native` NPM package and not anymore from the standalone `hermes-engine`. This will allow for a better stability as the `hermes-engine` and the `react-native` were built from source at the same instant in time. Changelog: [Android] [Changed] - Update template/android and RN Tester to use `hermes-engine` from the `react-native` NPM package. Reviewed By: hramos Differential Revision: D34213795 fbshipit-source-id: 29e54b37db0103f72e9983976ef9147fe69116e7
1 parent 743d070 commit 4d91f40

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

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

+5-4
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,12 @@ dependencies {
226226
// Build React Native from source
227227
implementation project(':ReactAndroid')
228228

229-
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
229+
// Consume Hermes as built from source only for the Hermes variant.
230+
hermesImplementation(project(":ReactAndroid:hermes-engine")) {
231+
exclude group:'com.facebook.fbjni'
232+
}
230233

231-
def hermesPath = '$projectDir/../../../../../node_modules/hermes-engine/android/'
232-
hermesDebugImplementation files(hermesPath + "hermes-debug.aar")
233-
hermesReleaseImplementation files(hermesPath + "hermes-release.aar")
234+
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
234235

235236
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
236237
exclude group:'com.facebook.fbjni'

template/android/app/build.gradle

+9-4
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,10 @@ dependencies {
271271
}
272272

273273
if (enableHermes) {
274-
def hermesPath = "../../node_modules/hermes-engine/android/";
275-
debugImplementation files(hermesPath + "hermes-debug.aar")
276-
releaseImplementation files(hermesPath + "hermes-release.aar")
274+
//noinspection GradleDynamicVersion
275+
implementation("com.facebook.react:hermes-engine:+") { // From node_modules
276+
exclude group:'com.facebook.fbjni'
277+
}
277278
} else {
278279
implementation jscFlavor
279280
}
@@ -286,7 +287,11 @@ if (isNewArchitectureEnabled()) {
286287
configurations.all {
287288
resolutionStrategy.dependencySubstitution {
288289
substitute(module("com.facebook.react:react-native"))
289-
.using(project(":ReactAndroid")).because("On New Architecture we're building React Native from source")
290+
.using(project(":ReactAndroid"))
291+
.because("On New Architecture we're building React Native from source")
292+
substitute(module("com.facebook.react:hermes-engine"))
293+
.using(project(":ReactAndroid:hermes-engine"))
294+
.because("On New Architecture we're building Hermes from source")
290295
}
291296
}
292297
}

template/android/settings.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ includeBuild('../node_modules/react-native-gradle-plugin')
66
if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
77
include(":ReactAndroid")
88
project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid')
9+
include(":ReactAndroid:hermes-engine")
10+
project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine')
911
}

0 commit comments

Comments
 (0)