Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -616,11 +616,13 @@ apply plugin: "org.jetbrains.kotlin.android"
apply from: "./publish.gradle"

// We need to override the artifact ID as this project is called `ReactAndroid` but
// the maven coordinates are on `react-native`.
// the maven coordinates are on `react-android`.
// Please note that the original coordinates, `react-native`, have been voided
// as they caused https://github.com/facebook/react-native/issues/35210
publishing {
publications {
getByName("release") {
artifactId 'react-native'
artifactId 'react-android'
}
}
}
13 changes: 13 additions & 0 deletions ReactAndroid/hermes-engine/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,17 @@ afterEvaluate {
prepareHeadersForPrefab.dependsOn(buildHermes)
}

/* Publishing Configuration */
apply from: "../publish.gradle"

// We need to override the artifact ID as this project is called `hermes-engine` but
// the maven coordinates are on `hermes-android`.
// Please note that the original coordinates, `hermes-engine`, have been voided
// as they caused https://github.com/facebook/react-native/issues/35210
publishing {
publications {
getByName("release") {
artifactId 'hermes-android'
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,23 @@ internal object DependencyUtils {
fun configureDependencies(project: Project, versionString: String) {
if (versionString.isBlank()) return
project.configurations.all { configuration ->
// Here we set a dependencySubstitution for both react-native and hermes-engine as those
// coordinates are voided due to https://github.com/facebook/react-native/issues/35210
// This allows users to import libraries that are still using
// implementation("com.facebook.react:react-native:+") and resolve the right dependency.
configuration.resolutionStrategy.dependencySubstitution {
it.substitute(it.module("com.facebook.react:react-native"))
.using(it.module("com.facebook.react:react-android:${versionString}"))
.because(
"The react-native artifact was deprecated in favor of react-android due to https://github.com/facebook/react-native/issues/35210.")
it.substitute(it.module("com.facebook.react:hermes-engine"))
.using(it.module("com.facebook.react:hermes-android:${versionString}"))
.because(
"The hermes-engine artifact was deprecated in favor of hermes-android due to https://github.com/facebook/react-native/issues/35210.")
}
configuration.resolutionStrategy.force(
"com.facebook.react:react-native:${versionString}",
"com.facebook.react:hermes-engine:${versionString}",
"com.facebook.react:react-android:${versionString}",
"com.facebook.react:hermes-android:${versionString}",
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ class DependencyUtilsTest {
configureDependencies(project, "1.2.3")

val forcedModules = project.configurations.first().resolutionStrategy.forcedModules
assertTrue(forcedModules.any { it.toString() == "com.facebook.react:react-native:1.2.3" })
assertTrue(forcedModules.any { it.toString() == "com.facebook.react:hermes-engine:1.2.3" })
assertTrue(forcedModules.any { it.toString() == "com.facebook.react:react-android:1.2.3" })
assertTrue(forcedModules.any { it.toString() == "com.facebook.react:hermes-android:1.2.3" })
}

@Test
Expand Down
6 changes: 3 additions & 3 deletions scripts/release-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ function generateAndroidArtifacts(releaseVersion, tmpPublishingFolder) {
'-debug-sources.jar',
'-release-sources.jar',
].map(suffix => {
return `react-native-${releaseVersion}${suffix}`;
return `react-android-${releaseVersion}${suffix}`;
});

artifacts.forEach(name => {
if (
!test(
'-e',
`/tmp/maven-local/com/facebook/react/react-native/${releaseVersion}/${name}`,
`/tmp/maven-local/com/facebook/react/react-android/${releaseVersion}/${name}`,
)
) {
echo(
`Failing as expected file: \n\
/tmp/maven-local/com/facebook/react/react-native/${releaseVersion}/${name}\n\
/tmp/maven-local/com/facebook/react/react-android/${releaseVersion}/${name}\n\
was not correctly generated.`,
);
exit(1);
Expand Down
1 change: 0 additions & 1 deletion scripts/test-manual-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ init_template_app(){

info "Double checking the versions in package.json are correct:"
grep "\"react-native\": \".*react-native-$PACKAGE_VERSION-$TIMESTAMP.tgz\"" "/tmp/${project_name}/package.json" || error "Incorrect version number in /tmp/${project_name}/package.json"
grep -E "com.facebook.react:react-native:\\+" "${project_name}/android/app/build.gradle" || error "Dependency in /tmp/${project_name}/android/app/build.gradle must be com.facebook.react:react-native:+"

success "New sample project generated at /tmp/${project_name}"
popd >/dev/null || exit
Expand Down
4 changes: 2 additions & 2 deletions template/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ android {

dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-native")
implementation("com.facebook.react:react-android")

implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")

Expand All @@ -161,7 +161,7 @@ dependencies {

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-engine")
implementation("com.facebook.react:hermes-android")
} else {
implementation jscFlavor
}
Expand Down