2019-10-22 17:43:51 +03:00
|
|
|
/*
|
2021-12-31 02:08:43 +03:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2019-10-22 17:43:51 +03: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 17:35:58 +03:00
|
|
|
|
2023-02-10 21:04:55 +03:00
|
|
|
plugins {
|
2023-08-11 18:34:37 +03: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-02-10 21:04:55 +03:00
|
|
|
}
|
2022-10-13 19:45:11 +03:00
|
|
|
|
2022-10-17 14:07:37 +03:00
|
|
|
val reactAndroidProperties = java.util.Properties()
|
|
|
|
|
2023-03-17 15:03:25 +03:00
|
|
|
File("$rootDir/packages/react-native/ReactAndroid/gradle.properties").inputStream().use {
|
2022-10-24 20:43:02 +03:00
|
|
|
reactAndroidProperties.load(it)
|
|
|
|
}
|
2022-10-17 14:07:37 +03:00
|
|
|
|
|
|
|
version =
|
|
|
|
if (project.hasProperty("isNightly") &&
|
|
|
|
(project.property("isNightly") as? String).toBoolean()) {
|
|
|
|
"${reactAndroidProperties.getProperty("VERSION_NAME")}-SNAPSHOT"
|
|
|
|
} else {
|
|
|
|
reactAndroidProperties.getProperty("VERSION_NAME")
|
|
|
|
}
|
|
|
|
|
|
|
|
group = "com.facebook.react"
|
|
|
|
|
2022-04-07 20:55:32 +03:00
|
|
|
val ndkPath by extra(System.getenv("ANDROID_NDK"))
|
2023-07-25 19:57:30 +03:00
|
|
|
val ndkVersion by extra(System.getenv("ANDROID_NDK_VERSION") ?: "25.1.8937393")
|
2022-10-13 19:45:11 +03:00
|
|
|
val sonatypeUsername = findProperty("SONATYPE_USERNAME")?.toString()
|
|
|
|
val sonatypePassword = findProperty("SONATYPE_PASSWORD")?.toString()
|
|
|
|
|
|
|
|
nexusPublishing {
|
|
|
|
repositories {
|
2022-10-17 14:07:37 +03:00
|
|
|
sonatype {
|
2022-10-13 19:45:11 +03:00
|
|
|
username.set(sonatypeUsername)
|
|
|
|
password.set(sonatypePassword)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-06 15:54:15 +03:00
|
|
|
tasks.register("clean", Delete::class.java) {
|
2022-06-09 12:50:45 +03:00
|
|
|
description = "Remove all the build files and intermediate build outputs"
|
|
|
|
dependsOn(gradle.includedBuild("react-native-gradle-plugin").task(":clean"))
|
2023-04-06 15:54:15 +03: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 14:58:19 +03:00
|
|
|
delete(allprojects.map { it.layout.buildDirectory.asFile })
|
2023-03-17 15:03:25 +03: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/"))
|
2022-06-09 12:50:45 +03:00
|
|
|
delete(rootProject.file("./packages/react-native-codegen/lib"))
|
2023-04-06 15:54:15 +03:00
|
|
|
delete(rootProject.file("./node_modules/@react-native/codegen/lib"))
|
2022-06-09 12:50:45 +03:00
|
|
|
delete(rootProject.file("./packages/rn-tester/android/app/.cxx"))
|
2021-11-30 12:51:38 +03:00
|
|
|
}
|
2022-05-16 19:27:54 +03:00
|
|
|
|
2023-03-17 20:26:34 +03:00
|
|
|
tasks.register("build") {
|
2022-06-09 12:50:45 +03:00
|
|
|
description = "Build and test all the React Native relevant projects."
|
|
|
|
dependsOn(gradle.includedBuild("react-native-gradle-plugin").task(":build"))
|
2022-05-16 19:27:54 +03:00
|
|
|
}
|
2022-05-18 01:31:48 +03:00
|
|
|
|
2022-10-13 13:08:22 +03:00
|
|
|
tasks.register("publishAllInsideNpmPackage") {
|
|
|
|
description =
|
|
|
|
"Publish all the artifacts to be available inside the NPM package in the `android` folder."
|
|
|
|
// Due to size constraints of NPM, we publish only react-native and hermes-engine inside
|
|
|
|
// the NPM package.
|
2023-03-17 15:03:25 +03:00
|
|
|
dependsOn(":packages:react-native:ReactAndroid:installArchives")
|
|
|
|
dependsOn(":packages:react-native:ReactAndroid:hermes-engine:installArchives")
|
2022-10-13 13:08:22 +03:00
|
|
|
}
|
|
|
|
|
2022-10-25 23:13:14 +03:00
|
|
|
tasks.register("publishAllToMavenTempLocal") {
|
|
|
|
description = "Publish all the artifacts to be available inside a Maven Local repository on /tmp."
|
2023-03-17 15:03:25 +03:00
|
|
|
dependsOn(":packages:react-native:ReactAndroid:publishAllPublicationsToMavenTempLocalRepository")
|
2022-10-25 23:13:14 +03:00
|
|
|
// We don't publish the external-artifacts to Maven Local as CircleCI is using it via workspace.
|
2023-07-04 16:01:09 +03:00
|
|
|
dependsOn(
|
|
|
|
":packages:react-native:ReactAndroid:flipper-integration:publishAllPublicationsToMavenTempLocalRepository")
|
2023-03-17 15:03:25 +03:00
|
|
|
dependsOn(
|
|
|
|
":packages:react-native:ReactAndroid:hermes-engine:publishAllPublicationsToMavenTempLocalRepository")
|
2022-10-13 13:08:22 +03:00
|
|
|
}
|
|
|
|
|
2022-10-13 19:45:11 +03:00
|
|
|
tasks.register("publishAllToSonatype") {
|
|
|
|
description = "Publish all the artifacts to Sonatype (Maven Central or Snapshot repository)"
|
2023-03-17 15:03:25 +03:00
|
|
|
dependsOn(":packages:react-native:ReactAndroid:publishToSonatype")
|
|
|
|
dependsOn(":packages:react-native:ReactAndroid:external-artifacts:publishToSonatype")
|
2023-07-04 16:01:09 +03:00
|
|
|
dependsOn(":packages:react-native:ReactAndroid:flipper-integration:publishToSonatype")
|
2023-03-17 15:03:25 +03:00
|
|
|
dependsOn(":packages:react-native:ReactAndroid:hermes-engine:publishToSonatype")
|
2022-10-13 13:08:22 +03:00
|
|
|
}
|
2023-08-14 10:45:07 +03:00
|
|
|
|
|
|
|
if (project.findProperty("react.internal.useHermesNightly")?.toString()?.toBoolean() == true) {
|
|
|
|
logger.warn(
|
|
|
|
"""
|
|
|
|
********************************************************************************
|
|
|
|
INFO: You're using Hermes from nightly as you set
|
|
|
|
|
|
|
|
react.internal.useHermesNightly=true
|
|
|
|
|
|
|
|
in the ./gradle.properties file.
|
|
|
|
|
|
|
|
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")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|