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 {
|
|
|
|
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
|
2023-02-28 16:39:21 +00:00
|
|
|
id("com.android.library") version "7.4.2" apply false
|
|
|
|
id("com.android.application") version "7.4.2" apply false
|
2023-02-10 18:04:55 +00:00
|
|
|
id("de.undercouch.download") version "5.0.1" apply false
|
2023-02-22 15:13:47 +00:00
|
|
|
kotlin("android") version "1.7.22" apply false
|
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()
|
|
|
|
|
2022-10-24 17:43:02 +00:00
|
|
|
File("$rootDir/ReactAndroid/gradle.properties").inputStream().use {
|
|
|
|
reactAndroidProperties.load(it)
|
|
|
|
}
|
2022-10-17 11:07:37 +00: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 17:55:32 +00:00
|
|
|
val ndkPath by extra(System.getenv("ANDROID_NDK"))
|
|
|
|
val ndkVersion by extra(System.getenv("ANDROID_NDK_VERSION"))
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-30 09:51:38 +00:00
|
|
|
tasks.register("cleanAll", Delete::class.java) {
|
2022-06-09 09:50:45 +00:00
|
|
|
description = "Remove all the build files and intermediate build outputs"
|
|
|
|
dependsOn(gradle.includedBuild("react-native-gradle-plugin").task(":clean"))
|
2022-09-20 17:30:40 +00:00
|
|
|
dependsOn(":ReactAndroid:clean")
|
|
|
|
dependsOn(":ReactAndroid:hermes-engine:clean")
|
|
|
|
dependsOn(":packages:rn-tester:android:app:clean")
|
2022-06-09 09:50:45 +00:00
|
|
|
delete(allprojects.map { it.buildDir })
|
|
|
|
delete(rootProject.file("./ReactAndroid/.cxx"))
|
|
|
|
delete(rootProject.file("./ReactAndroid/hermes-engine/.cxx"))
|
|
|
|
delete(rootProject.file("./sdks/download/"))
|
|
|
|
delete(rootProject.file("./sdks/hermes/"))
|
|
|
|
delete(rootProject.file("./ReactAndroid/src/main/jni/prebuilt/lib/arm64-v8a/"))
|
|
|
|
delete(rootProject.file("./ReactAndroid/src/main/jni/prebuilt/lib/armeabi-v7a/"))
|
|
|
|
delete(rootProject.file("./ReactAndroid/src/main/jni/prebuilt/lib/x86/"))
|
|
|
|
delete(rootProject.file("./ReactAndroid/src/main/jni/prebuilt/lib/x86_64/"))
|
|
|
|
delete(rootProject.file("./packages/react-native-codegen/lib"))
|
|
|
|
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
|
|
|
|
|
|
|
tasks.register("buildAll") {
|
2022-06-09 09:50:45 +00:00
|
|
|
description = "Build and test all the React Native relevant projects."
|
|
|
|
dependsOn(gradle.includedBuild("react-native-gradle-plugin").task(":build"))
|
|
|
|
// This builds both the React Native framework for both debug and release
|
|
|
|
dependsOn(":ReactAndroid:assemble")
|
|
|
|
// This creates all the Maven artifacts and makes them available in the /android folder
|
|
|
|
dependsOn(":ReactAndroid:installArchives")
|
2022-11-24 19:22:54 +00:00
|
|
|
// This builds RN Tester for Hermes/JSC for debug and release
|
|
|
|
dependsOn(":packages:rn-tester:android:app:assemble")
|
2022-09-15 14:00:43 +00:00
|
|
|
// This compiles the Unit Test sources (without running them as they're partially broken)
|
|
|
|
dependsOn(":ReactAndroid:compileDebugUnitTestSources")
|
|
|
|
dependsOn(":ReactAndroid:compileReleaseUnitTestSources")
|
2022-05-16 16:27:54 +00:00
|
|
|
}
|
2022-05-17 22:31:48 +00:00
|
|
|
|
|
|
|
tasks.register("downloadAll") {
|
2022-06-09 09:50:45 +00:00
|
|
|
description = "Download all the depedencies needed locally so they can be cached on CI."
|
|
|
|
dependsOn(gradle.includedBuild("react-native-gradle-plugin").task(":dependencies"))
|
|
|
|
dependsOn(":ReactAndroid:downloadNdkBuildDependencies")
|
|
|
|
dependsOn(":ReactAndroid:dependencies")
|
|
|
|
dependsOn(":ReactAndroid:androidDependencies")
|
|
|
|
dependsOn(":ReactAndroid:hermes-engine:dependencies")
|
|
|
|
dependsOn(":ReactAndroid:hermes-engine:androidDependencies")
|
2023-02-16 12:38:36 +00:00
|
|
|
dependsOn(":packages:rn-tester:android:app:dependencies")
|
|
|
|
dependsOn(":packages:rn-tester:android:app:androidDependencies")
|
2022-05-17 22:31:48 +00:00
|
|
|
}
|
2022-10-13 10:08:22 +00: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.
|
|
|
|
dependsOn(":ReactAndroid:installArchives")
|
|
|
|
dependsOn(":ReactAndroid:hermes-engine:installArchives")
|
|
|
|
}
|
|
|
|
|
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."
|
|
|
|
dependsOn(":ReactAndroid:publishAllPublicationsToMavenTempLocalRepository")
|
|
|
|
// We don't publish the external-artifacts to Maven Local as CircleCI is using it via workspace.
|
|
|
|
dependsOn(":ReactAndroid:hermes-engine:publishAllPublicationsToMavenTempLocalRepository")
|
2022-10-13 10:08:22 +00:00
|
|
|
}
|
|
|
|
|
2022-10-13 16:45:11 +00:00
|
|
|
tasks.register("publishAllToSonatype") {
|
|
|
|
description = "Publish all the artifacts to Sonatype (Maven Central or Snapshot repository)"
|
|
|
|
dependsOn(":ReactAndroid:publishToSonatype")
|
|
|
|
dependsOn(":ReactAndroid:external-artifacts:publishToSonatype")
|
|
|
|
dependsOn(":ReactAndroid:hermes-engine:publishToSonatype")
|
2022-10-13 10:08:22 +00:00
|
|
|
}
|