mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 22:10:14 +00:00
lazy configure ReactAndroid gradle tasks
This commit is contained in:
parent
adac04601e
commit
7f238785ec
@ -210,14 +210,9 @@ def findNdkBuildFullPath() {
|
||||
def ndkDir = property("ndk.path")
|
||||
return new File(ndkDir, getNdkBuildName()).getAbsolutePath()
|
||||
}
|
||||
if (System.getenv("ANDROID_NDK") != null) {
|
||||
def ndkDir = System.getenv("ANDROID_NDK")
|
||||
return new File(ndkDir, getNdkBuildName()).getAbsolutePath()
|
||||
}
|
||||
def ndkDir = android.hasProperty("plugin") ? android.plugin.ndkFolder :
|
||||
plugins.getPlugin("com.android.library").hasProperty("sdkHandler") ?
|
||||
plugins.getPlugin("com.android.library").sdkHandler.getNdkFolder() :
|
||||
android.ndkDirectory ? android.ndkDirectory.absolutePath : null
|
||||
|
||||
def ndkDir = android.ndkDirectory ? android.ndkDirectory.absolutePath : null
|
||||
|
||||
if (ndkDir) {
|
||||
return new File(ndkDir, getNdkBuildName()).getAbsolutePath()
|
||||
}
|
||||
@ -253,7 +248,8 @@ def getNdkBuildFullPath() {
|
||||
return ndkBuildFullPath
|
||||
}
|
||||
|
||||
task buildReactNdkLib(dependsOn: [prepareJSC, prepareHermes, prepareBoost, prepareDoubleConversion, prepareFolly, prepareGlog], type: Exec) {
|
||||
def buildReactNdkLib = tasks.register("buildReactNdkLib", Exec) {
|
||||
dependsOn(prepareJSC, prepareHermes, prepareBoost, prepareDoubleConversion, prepareFolly, prepareGlog)
|
||||
inputs.dir("$projectDir/../ReactCommon")
|
||||
inputs.dir("src/main/jni")
|
||||
outputs.dir("$buildDir/react-ndk/all")
|
||||
@ -271,7 +267,7 @@ task buildReactNdkLib(dependsOn: [prepareJSC, prepareHermes, prepareBoost, prepa
|
||||
)
|
||||
}
|
||||
|
||||
task cleanReactNdkLib(type: Exec) {
|
||||
def cleanReactNdkLib = tasks.register("cleanReactNdkLib", Exec) {
|
||||
ignoreExitValue(true)
|
||||
errorOutput(new ByteArrayOutputStream())
|
||||
commandLine(getNdkBuildFullPath(),
|
||||
@ -286,14 +282,16 @@ task cleanReactNdkLib(type: Exec) {
|
||||
}
|
||||
}
|
||||
|
||||
task packageReactNdkLibs(dependsOn: buildReactNdkLib, type: Copy) {
|
||||
def packageReactNdkLibs = tasks.register("packageReactNdkLibs", Copy) {
|
||||
dependsOn(buildReactNdkLib)
|
||||
from("$buildDir/react-ndk/all")
|
||||
into("$buildDir/react-ndk/exported")
|
||||
exclude("**/libjsc.so")
|
||||
exclude("**/libhermes.so")
|
||||
}
|
||||
|
||||
task packageReactNdkLibsForBuck(dependsOn: packageReactNdkLibs, type: Copy) {
|
||||
def packageReactNdkLibsForBuck = tasks.register("packageReactNdkLibsForBuck", Copy) {
|
||||
dependsOn(packageReactNdkLibs)
|
||||
from("$buildDir/react-ndk/exported")
|
||||
into("src/main/jni/prebuilt/lib")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user