Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Gradle configuration avoidance API #48603

Closed
wants to merge 1 commit into from
Closed
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
49 changes: 28 additions & 21 deletions packages/react-native/ReactAndroid/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -249,148 +249,155 @@ val createNativeDepsDirectories by
thirdPartyNdkDir.mkdirs()
}

val downloadBoostDest = File(downloadsDir, "boost_${BOOST_VERSION}.tar.gz")
val downloadBoost by
tasks.creating(Download::class) {
tasks.registering(Download::class) {
dependsOn(createNativeDepsDirectories)
src(
"https://archives.boost.io/release/${BOOST_VERSION.replace("_", ".")}/source/boost_${BOOST_VERSION}.tar.gz")
onlyIfModified(true)
overwrite(false)
retries(5)
quiet(true)
dest(File(downloadsDir, "boost_${BOOST_VERSION}.tar.gz"))
dest(downloadBoostDest)
}

val prepareBoost by
tasks.registering(PrepareBoostTask::class) {
dependsOn(if (boostPathOverride != null) emptyList() else listOf(downloadBoost))
boostPath.setFrom(if (boostPathOverride != null) boostPath else tarTree(downloadBoost.dest))
boostPath.setFrom(if (boostPathOverride != null) boostPath else tarTree(downloadBoostDest))
boostVersion.set(BOOST_VERSION)
outputDir.set(File(thirdPartyNdkDir, "boost"))
}

val downloadDoubleConversionDest = File(downloadsDir, "double-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gz")
val downloadDoubleConversion by
tasks.creating(Download::class) {
tasks.registering(Download::class) {
dependsOn(createNativeDepsDirectories)
src(
"https://github.com/google/double-conversion/archive/v${DOUBLE_CONVERSION_VERSION}.tar.gz")
onlyIfModified(true)
overwrite(false)
retries(5)
quiet(true)
dest(File(downloadsDir, "double-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gz"))
dest(downloadDoubleConversionDest)
}

val prepareDoubleConversion by
tasks.registering(Copy::class) {
dependsOn(if (dependenciesPath != null) emptyList() else listOf(downloadDoubleConversion))
from(dependenciesPath ?: tarTree(downloadDoubleConversion.dest))
from(dependenciesPath ?: tarTree(downloadDoubleConversionDest))
from("src/main/jni/third-party/double-conversion/")
include("double-conversion-${DOUBLE_CONVERSION_VERSION}/src/**/*", "CMakeLists.txt")
filesMatching("*/src/**/*") { this.path = "double-conversion/${this.name}" }
includeEmptyDirs = false
into("$thirdPartyNdkDir/double-conversion")
}

val downloadFollyDest = File(downloadsDir, "folly-${FOLLY_VERSION}.tar.gz")
val downloadFolly by
tasks.creating(Download::class) {
tasks.registering(Download::class) {
src("https://github.com/facebook/folly/archive/v${FOLLY_VERSION}.tar.gz")
onlyIfModified(true)
overwrite(false)
retries(5)
quiet(true)
dest(File(downloadsDir, "folly-${FOLLY_VERSION}.tar.gz"))
dest(downloadFollyDest)
}

val prepareFolly by
tasks.registering(Copy::class) {
dependsOn(if (dependenciesPath != null) emptyList() else listOf(downloadFolly))
from(dependenciesPath ?: tarTree(downloadFolly.dest))
from(dependenciesPath ?: tarTree(downloadFollyDest))
from("src/main/jni/third-party/folly/")
include("folly-${FOLLY_VERSION}/folly/**/*", "CMakeLists.txt")
eachFile { this.path = this.path.removePrefix("folly-${FOLLY_VERSION}/") }
includeEmptyDirs = false
into("$thirdPartyNdkDir/folly")
}

val downloadFastFloatDest = File(downloadsDir, "fast_float-${FAST_FLOAT_VERSION}.tar.gz")
val downloadFastFloat by
tasks.creating(Download::class) {
tasks.registering(Download::class) {
dependsOn(createNativeDepsDirectories)
src("https://github.com/fastfloat/fast_float/archive/v${FAST_FLOAT_VERSION}.tar.gz")
onlyIfModified(true)
overwrite(false)
retries(5)
quiet(true)
dest(File(downloadsDir, "fast_float-${FAST_FLOAT_VERSION}.tar.gz"))
dest(downloadFastFloatDest)
}

val prepareFastFloat by
tasks.registering(Copy::class) {
dependsOn(if (dependenciesPath != null) emptyList() else listOf(downloadFastFloat))
from(dependenciesPath ?: tarTree(downloadFastFloat.dest))
from(dependenciesPath ?: tarTree(downloadFastFloatDest))
from("src/main/jni/third-party/fast_float/")
include("fast_float-${FAST_FLOAT_VERSION}/include/**/*", "CMakeLists.txt")
eachFile { this.path = this.path.removePrefix("fast_float-${FAST_FLOAT_VERSION}/") }
includeEmptyDirs = false
into("$thirdPartyNdkDir/fast_float")
}

val downloadFmtDest = File(downloadsDir, "fmt-${FMT_VERSION}.tar.gz")
val downloadFmt by
tasks.creating(Download::class) {
tasks.registering(Download::class) {
dependsOn(createNativeDepsDirectories)
src("https://github.com/fmtlib/fmt/archive/${FMT_VERSION}.tar.gz")
onlyIfModified(true)
overwrite(false)
retries(5)
quiet(true)
dest(File(downloadsDir, "fmt-${FMT_VERSION}.tar.gz"))
dest(downloadFmtDest)
}

val prepareFmt by
tasks.registering(Copy::class) {
dependsOn(if (dependenciesPath != null) emptyList() else listOf(downloadFmt))
from(dependenciesPath ?: tarTree(downloadFmt.dest))
from(dependenciesPath ?: tarTree(downloadFmtDest))
from("src/main/jni/third-party/fmt/")
include("fmt-${FMT_VERSION}/src/**/*", "fmt-${FMT_VERSION}/include/**/*", "CMakeLists.txt")
eachFile { this.path = this.path.removePrefix("fmt-${FMT_VERSION}/") }
includeEmptyDirs = false
into("$thirdPartyNdkDir/fmt")
}

val downloadGlogDest = File(downloadsDir, "glog-${GLOG_VERSION}.tar.gz")
val downloadGlog by
tasks.creating(Download::class) {
tasks.registering(Download::class) {
dependsOn(createNativeDepsDirectories)
src("https://github.com/google/glog/archive/v${GLOG_VERSION}.tar.gz")
onlyIfModified(true)
overwrite(false)
retries(5)
quiet(true)
dest(File(downloadsDir, "glog-${GLOG_VERSION}.tar.gz"))
dest(downloadGlogDest)
}

val downloadGtestDest = File(downloadsDir, "gtest.tar.gz")
val downloadGtest by
tasks.creating(Download::class) {
tasks.registering(Download::class) {
dependsOn(createNativeDepsDirectories)
src("https://github.com/google/googletest/archive/refs/tags/release-${GTEST_VERSION}.tar.gz")
onlyIfModified(true)
overwrite(false)
retries(5)
quiet(true)
dest(File(downloadsDir, "gtest.tar.gz"))
dest(downloadGtestDest)
}

val prepareGtest by
tasks.registering(Copy::class) {
dependsOn(if (dependenciesPath != null) emptyList() else listOf(downloadGtest))
from(dependenciesPath ?: tarTree(downloadGtest.dest))
from(dependenciesPath ?: tarTree(downloadGtestDest))
eachFile { this.path = (this.path.removePrefix("googletest-release-${GTEST_VERSION}/")) }
into(File(thirdPartyNdkDir, "googletest"))
}

val prepareGlog by
tasks.registering(PrepareGlogTask::class) {
dependsOn(if (dependenciesPath != null) emptyList() else listOf(downloadGlog))
glogPath.setFrom(dependenciesPath ?: tarTree(downloadGlog.dest))
glogPath.setFrom(dependenciesPath ?: tarTree(downloadGlogDest))
glogVersion.set(GLOG_VERSION)
outputDir.set(File(thirdPartyNdkDir, "glog"))
}
Expand Down
Loading