fix: Fix Android tasks execution (#407)
This commit is contained in:
parent
98128471cc
commit
3b7560ac4d
@ -241,33 +241,6 @@ dependencies {
|
|||||||
implementation "androidx.exifinterface:exifinterface:1.3.3"
|
implementation "androidx.exifinterface:exifinterface:1.3.3"
|
||||||
}
|
}
|
||||||
|
|
||||||
task extractAARHeaders {
|
|
||||||
doLast {
|
|
||||||
configurations.extractHeaders.files.each {
|
|
||||||
def file = it.absoluteFile
|
|
||||||
copy {
|
|
||||||
from zipTree(file)
|
|
||||||
into "$buildDir/$file.name"
|
|
||||||
include "**/*.h"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task extractJNIFiles {
|
|
||||||
doLast {
|
|
||||||
configurations.extractJNI.files.each {
|
|
||||||
def file = it.absoluteFile
|
|
||||||
|
|
||||||
copy {
|
|
||||||
from zipTree(file)
|
|
||||||
into "$buildDir/$file.name"
|
|
||||||
include "jni/**/*"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// third-party-ndk deps headers
|
// third-party-ndk deps headers
|
||||||
// mostly a copy of https://github.com/software-mansion/react-native-reanimated/blob/master/android/build.gradle#L115
|
// mostly a copy of https://github.com/software-mansion/react-native-reanimated/blob/master/android/build.gradle#L115
|
||||||
|
|
||||||
@ -287,9 +260,11 @@ def GLOG_VERSION = thirdPartyVersions["GLOG_VERSION"]
|
|||||||
def glog_file = new File(downloadsDir, "glog-${GLOG_VERSION}.tar.gz")
|
def glog_file = new File(downloadsDir, "glog-${GLOG_VERSION}.tar.gz")
|
||||||
|
|
||||||
task createNativeDepsDirectories {
|
task createNativeDepsDirectories {
|
||||||
|
doLast {
|
||||||
downloadsDir.mkdirs()
|
downloadsDir.mkdirs()
|
||||||
thirdPartyNdkDir.mkdirs()
|
thirdPartyNdkDir.mkdirs()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) {
|
task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) {
|
||||||
src("https://github.com/react-native-community/boost-for-react-native/releases/download/v${BOOST_VERSION.replace("_", ".")}-0/boost_${BOOST_VERSION}.tar.gz")
|
src("https://github.com/react-native-community/boost-for-react-native/releases/download/v${BOOST_VERSION.replace("_", ".")}-0/boost_${BOOST_VERSION}.tar.gz")
|
||||||
@ -384,7 +359,25 @@ task prepareGlog(dependsOn: downloadGlog, type: Copy) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task prepareThirdPartyNdkHeaders {
|
||||||
|
if (!boost_file.exists()) {
|
||||||
|
dependsOn(prepareBoost)
|
||||||
|
}
|
||||||
|
if (!double_conversion_file.exists()) {
|
||||||
|
dependsOn(prepareDoubleConversion)
|
||||||
|
}
|
||||||
|
if (!folly_file.exists()) {
|
||||||
|
dependsOn(prepareFolly)
|
||||||
|
}
|
||||||
|
if (!glog_file.exists()) {
|
||||||
|
dependsOn(prepareGlog)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
prepareThirdPartyNdkHeaders.mustRunAfter createNativeDepsDirectories
|
||||||
|
|
||||||
task prepareHermes() {
|
task prepareHermes() {
|
||||||
|
doLast {
|
||||||
def hermesPackagePath = findNodeModulePath(projectDir, "hermes-engine")
|
def hermesPackagePath = findNodeModulePath(projectDir, "hermes-engine")
|
||||||
if (!hermesPackagePath) {
|
if (!hermesPackagePath) {
|
||||||
throw new GradleScriptException("Could not find the hermes-engine npm package", null)
|
throw new GradleScriptException("Could not find the hermes-engine npm package", null)
|
||||||
@ -403,6 +396,9 @@ task prepareHermes() {
|
|||||||
into "$thirdPartyNdkDir/hermes"
|
into "$thirdPartyNdkDir/hermes"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
prepareHermes.mustRunAfter prepareThirdPartyNdkHeaders
|
||||||
|
|
||||||
task prepareJSC {
|
task prepareJSC {
|
||||||
doLast {
|
doLast {
|
||||||
@ -434,29 +430,47 @@ task prepareJSC {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task prepareThirdPartyNdkHeaders {
|
prepareJSC.mustRunAfter prepareHermes
|
||||||
if (!boost_file.exists()) {
|
|
||||||
dependsOn(prepareBoost)
|
task extractAARHeaders {
|
||||||
}
|
doLast {
|
||||||
if (!double_conversion_file.exists()) {
|
configurations.extractHeaders.files.each {
|
||||||
dependsOn(prepareDoubleConversion)
|
def file = it.absoluteFile
|
||||||
}
|
copy {
|
||||||
if (!folly_file.exists()) {
|
from zipTree(file)
|
||||||
dependsOn(prepareFolly)
|
into "$buildDir/$file.name"
|
||||||
}
|
include "**/*.h"
|
||||||
if (!glog_file.exists()) {
|
|
||||||
dependsOn(prepareGlog)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extractAARHeaders.mustRunAfter prepareJSC
|
||||||
|
|
||||||
|
task extractJNIFiles {
|
||||||
|
doLast {
|
||||||
|
configurations.extractJNI.files.each {
|
||||||
|
def file = it.absoluteFile
|
||||||
|
|
||||||
|
copy {
|
||||||
|
from zipTree(file)
|
||||||
|
into "$buildDir/$file.name"
|
||||||
|
include "jni/**/*"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extractJNIFiles.mustRunAfter extractAARHeaders
|
||||||
|
|
||||||
// pre-native build pipeline
|
// pre-native build pipeline
|
||||||
|
|
||||||
tasks.whenTaskAdded { task ->
|
tasks.whenTaskAdded { task ->
|
||||||
if (task.name.contains('externalNativeBuild')) {
|
if (task.name == 'externalNativeBuildDebug' || task.name == 'externalNativeBuildRelease') {
|
||||||
task.dependsOn(prepareJSC)
|
|
||||||
task.dependsOn(prepareHermes)
|
|
||||||
task.dependsOn(extractAARHeaders)
|
task.dependsOn(extractAARHeaders)
|
||||||
task.dependsOn(extractJNIFiles)
|
task.dependsOn(extractJNIFiles)
|
||||||
|
task.dependsOn(prepareJSC)
|
||||||
|
task.dependsOn(prepareHermes)
|
||||||
task.dependsOn(prepareThirdPartyNdkHeaders)
|
task.dependsOn(prepareThirdPartyNdkHeaders)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# Specifies the JVM arguments used for the daemon process.
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
||||||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||||
|
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
Loading…
Reference in New Issue
Block a user