2019-10-22 14:43:51 +00:00
|
|
|
/*
|
2021-12-30 23:08:43 +00:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2019-10-22 14:43:51 +00:00
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*/
|
2015-09-14 14:35:58 +00:00
|
|
|
|
2023-02-10 18:04:55 +00:00
|
|
|
plugins {
|
2023-08-11 15:34:37 +00:00
|
|
|
alias(libs.plugins.nexus.publish)
|
|
|
|
alias(libs.plugins.android.library) apply false
|
|
|
|
alias(libs.plugins.android.application) apply false
|
|
|
|
alias(libs.plugins.download) apply false
|
|
|
|
alias(libs.plugins.kotlin.android) apply false
|
2023-12-04 20:22:58 +00:00
|
|
|
alias(libs.plugins.binary.compatibility.validator) apply true
|
2023-02-10 18:04:55 +00:00
|
|
|
}
|
2022-10-13 16:45:11 +00:00
|
|
|
|
2022-10-17 11:07:37 +00:00
|
|
|
val reactAndroidProperties = java.util.Properties()
|
|
|
|
|
2023-03-17 12:03:25 +00:00
|
|
|
File("$rootDir/packages/react-native/ReactAndroid/gradle.properties").inputStream().use {
|
2022-10-24 17:43:02 +00:00
|
|
|
reactAndroidProperties.load(it)
|
|
|
|
}
|
2022-10-17 11:07:37 +00:00
|
|
|
|
2023-12-05 21:36:34 +00:00
|
|
|
fun getListReactAndroidProperty(name: String) = reactAndroidProperties.getProperty(name).split(",")
|
|
|
|
|
2023-12-04 20:22:58 +00:00
|
|
|
apiValidation {
|
|
|
|
ignoredPackages.addAll(
|
2023-12-21 23:49:29 +00:00
|
|
|
getListReactAndroidProperty("binaryCompatibilityValidator.ignoredPackages"))
|
|
|
|
ignoredClasses.addAll(getListReactAndroidProperty("binaryCompatibilityValidator.ignoredClasses"))
|
2023-12-04 20:22:58 +00:00
|
|
|
nonPublicMarkers.addAll(
|
2023-12-21 23:49:29 +00:00
|
|
|
getListReactAndroidProperty("binaryCompatibilityValidator.nonPublicMarkers"))
|
2023-12-05 21:36:34 +00:00
|
|
|
validationDisabled =
|
|
|
|
reactAndroidProperties
|
2023-12-21 23:49:29 +00:00
|
|
|
.getProperty("binaryCompatibilityValidator.validationDisabled")
|
2023-12-05 21:36:34 +00:00
|
|
|
?.toBoolean() == true
|
2023-12-04 20:22:58 +00:00
|
|
|
}
|
|
|
|
|
2022-10-17 11:07:37 +00:00
|
|
|
version =
|
2023-10-12 14:22:23 +00:00
|
|
|
if (project.hasProperty("isSnapshot") &&
|
|
|
|
(project.property("isSnapshot") as? String).toBoolean()) {
|
2022-10-17 11:07:37 +00:00
|
|
|
"${reactAndroidProperties.getProperty("VERSION_NAME")}-SNAPSHOT"
|
|
|
|
} else {
|
|
|
|
reactAndroidProperties.getProperty("VERSION_NAME")
|
|
|
|
}
|
|
|
|
|
|
|
|
group = "com.facebook.react"
|
|
|
|
|
2022-04-07 17:55:32 +00:00
|
|
|
val ndkPath by extra(System.getenv("ANDROID_NDK"))
|
2024-01-26 08:34:55 +00:00
|
|
|
val ndkVersion by extra(System.getenv("ANDROID_NDK_VERSION") ?: libs.versions.ndkVersion.get())
|
2022-10-13 16:45:11 +00:00
|
|
|
val sonatypeUsername = findProperty("SONATYPE_USERNAME")?.toString()
|
|
|
|
val sonatypePassword = findProperty("SONATYPE_PASSWORD")?.toString()
|
|
|
|
|
|
|
|
nexusPublishing {
|
|
|
|
repositories {
|
2022-10-17 11:07:37 +00:00
|
|
|
sonatype {
|
2022-10-13 16:45:11 +00:00
|
|
|
username.set(sonatypeUsername)
|
|
|
|
password.set(sonatypePassword)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-06 12:54:15 +00:00
|
|
|
tasks.register("clean", Delete::class.java) {
|
2022-06-09 09:50:45 +00:00
|
|
|
description = "Remove all the build files and intermediate build outputs"
|
2024-06-21 08:08:00 +00:00
|
|
|
dependsOn(gradle.includedBuild("gradle-plugin").task(":clean"))
|
2023-04-06 12:54:15 +00:00
|
|
|
subprojects.forEach {
|
|
|
|
if (it.project.plugins.hasPlugin("com.android.library") ||
|
|
|
|
it.project.plugins.hasPlugin("com.android.application")) {
|
|
|
|
dependsOn(it.tasks.named("clean"))
|
|
|
|
}
|
|
|
|
}
|
2023-08-11 11:58:19 +00:00
|
|
|
delete(allprojects.map { it.layout.buildDirectory.asFile })
|
2023-03-17 12:03:25 +00:00
|
|
|
delete(rootProject.file("./packages/react-native/ReactAndroid/.cxx"))
|
|
|
|
delete(rootProject.file("./packages/react-native/ReactAndroid/hermes-engine/.cxx"))
|
|
|
|
delete(rootProject.file("./packages/react-native/sdks/download/"))
|
|
|
|
delete(rootProject.file("./packages/react-native/sdks/hermes/"))
|
|
|
|
delete(
|
|
|
|
rootProject.file("./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/arm64-v8a/"))
|
|
|
|
delete(
|
|
|
|
rootProject.file(
|
|
|
|
"./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/armeabi-v7a/"))
|
|
|
|
delete(rootProject.file("./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/x86/"))
|
|
|
|
delete(rootProject.file("./packages/react-native/ReactAndroid/src/main/jni/prebuilt/lib/x86_64/"))
|
2023-10-23 19:00:54 +00:00
|
|
|
delete(rootProject.file("./packages/react-native-codegen/lib"))
|
|
|
|
delete(rootProject.file("./node_modules/@react-native/codegen/lib"))
|
2022-06-09 09:50:45 +00:00
|
|
|
delete(rootProject.file("./packages/rn-tester/android/app/.cxx"))
|
2021-11-30 09:51:38 +00:00
|
|
|
}
|
2022-05-16 16:27:54 +00:00
|
|
|
|
2023-03-17 17:26:34 +00:00
|
|
|
tasks.register("build") {
|
2022-06-09 09:50:45 +00:00
|
|
|
description = "Build and test all the React Native relevant projects."
|
2024-06-21 08:08:00 +00:00
|
|
|
dependsOn(gradle.includedBuild("gradle-plugin").task(":build"))
|
2022-05-16 16:27:54 +00:00
|
|
|
}
|
2022-05-17 22:31:48 +00:00
|
|
|
|
2022-10-25 20:13:14 +00:00
|
|
|
tasks.register("publishAllToMavenTempLocal") {
|
|
|
|
description = "Publish all the artifacts to be available inside a Maven Local repository on /tmp."
|
2023-03-17 12:03:25 +00:00
|
|
|
dependsOn(":packages:react-native:ReactAndroid:publishAllPublicationsToMavenTempLocalRepository")
|
2022-10-25 20:13:14 +00:00
|
|
|
// We don't publish the external-artifacts to Maven Local as CircleCI is using it via workspace.
|
2023-03-17 12:03:25 +00:00
|
|
|
dependsOn(
|
|
|
|
":packages:react-native:ReactAndroid:hermes-engine:publishAllPublicationsToMavenTempLocalRepository")
|
2022-10-13 10:08:22 +00:00
|
|
|
}
|
|
|
|
|
2024-07-16 20:58:43 +00:00
|
|
|
tasks.register("publishAndroidToSonatype") {
|
|
|
|
description = "Publish the Android artifacts to Sonatype (Maven Central or Snapshot repository)"
|
2023-03-17 12:03:25 +00:00
|
|
|
dependsOn(":packages:react-native:ReactAndroid:publishToSonatype")
|
|
|
|
dependsOn(":packages:react-native:ReactAndroid:hermes-engine:publishToSonatype")
|
2022-10-13 10:08:22 +00:00
|
|
|
}
|
2023-08-14 07:45:07 +00:00
|
|
|
|
|
|
|
if (project.findProperty("react.internal.useHermesNightly")?.toString()?.toBoolean() == true) {
|
|
|
|
logger.warn(
|
|
|
|
"""
|
|
|
|
********************************************************************************
|
|
|
|
INFO: You're using Hermes from nightly as you set
|
2023-10-05 02:57:14 +00:00
|
|
|
|
2023-08-14 07:45:07 +00:00
|
|
|
react.internal.useHermesNightly=true
|
2023-10-05 02:57:14 +00:00
|
|
|
|
2023-08-14 07:45:07 +00:00
|
|
|
in the ./gradle.properties file.
|
2023-10-05 02:57:14 +00:00
|
|
|
|
2023-08-14 07:45:07 +00:00
|
|
|
That's fine for local development, but you should not commit this change.
|
|
|
|
********************************************************************************
|
|
|
|
"""
|
|
|
|
.trimIndent())
|
|
|
|
allprojects {
|
|
|
|
configurations.all {
|
|
|
|
resolutionStrategy.dependencySubstitution {
|
|
|
|
substitute(project(":packages:react-native:ReactAndroid:hermes-engine"))
|
|
|
|
.using(module("com.facebook.react:hermes-android:0.0.0-+"))
|
|
|
|
.because("Users opted to use hermes from nightly")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|