Fix task ordering for including Hermes
Summary: Fix a failure in running a single command to clean and rebuild with Hermes (e.g. `./gradlew clean :RNTester:android:app:installHermesDebug`). From my limited understanding of Gradle, the failure was caused by the fact that the `clean` task could end up running after `prepareHermes`, and therefore delete the shared library after it had been copied. This change updates the `prepareHermes` task to impose the proper order. In investigating this failure, I also updated inconsistent use of the `$thirdPartyNdkDir` variable. Changelog: [Internal][Fixed] Fix a failure in running a single command to clean and rebuild ReactAndroid with Hermes Reviewed By: mdvacca Differential Revision: D23098220 fbshipit-source-id: 822fa8ac9874d54a3fdd432ad8cbee78295228ee
This commit is contained in:
Родитель
55911eafb8
Коммит
be53aae324
|
@ -101,7 +101,7 @@ task prepareFolly(dependsOn: dependenciesPath ? [] : [downloadFolly], type: Copy
|
|||
into("$thirdPartyNdkDir/folly")
|
||||
}
|
||||
|
||||
task prepareHermes() {
|
||||
task prepareHermes(dependsOn: createNativeDepsDirectories, type: Copy) {
|
||||
def hermesPackagePath = findNodeModulePath(projectDir, "hermes-engine")
|
||||
if (!hermesPackagePath) {
|
||||
throw new GradleScriptException("Could not find the hermes-engine npm package", null)
|
||||
|
@ -114,12 +114,10 @@ task prepareHermes() {
|
|||
|
||||
def soFiles = zipTree(hermesAAR).matching({ it.include "**/*.so" })
|
||||
|
||||
copy {
|
||||
from soFiles
|
||||
from "src/main/jni/first-party/hermes/Android.mk"
|
||||
into "$thirdPartyNdkDir/hermes"
|
||||
}
|
||||
}
|
||||
|
||||
task downloadGlog(dependsOn: createNativeDepsDirectories, type: Download) {
|
||||
src("https://github.com/google/glog/archive/v${GLOG_VERSION}.tar.gz")
|
||||
|
@ -314,7 +312,7 @@ def buildReactNdkLib = tasks.register("buildReactNdkLib", Exec) {
|
|||
"NDK_APPLICATION_MK=$projectDir/src/main/jni/Application.mk",
|
||||
"NDK_OUT=" + temporaryDir,
|
||||
"NDK_LIBS_OUT=$buildDir/react-ndk/all",
|
||||
"THIRD_PARTY_NDK_DIR=$buildDir/third-party-ndk",
|
||||
"THIRD_PARTY_NDK_DIR=$thirdPartyNdkDir",
|
||||
"REACT_COMMON_DIR=$projectDir/../ReactCommon",
|
||||
"REACT_SRC_DIR=$projectDir/src/main/java/com/facebook/react",
|
||||
"BUILD_FABRIC=$enableFabric",
|
||||
|
@ -328,7 +326,7 @@ def cleanReactNdkLib = tasks.register("cleanReactNdkLib", Exec) {
|
|||
errorOutput(new ByteArrayOutputStream())
|
||||
commandLine(getNdkBuildFullPath(),
|
||||
"NDK_APPLICATION_MK=$projectDir/src/main/jni/Application.mk",
|
||||
"THIRD_PARTY_NDK_DIR=$buildDir/third-party-ndk",
|
||||
"THIRD_PARTY_NDK_DIR=$thirdPartyNdkDir",
|
||||
"REACT_COMMON_DIR=$projectDir/../ReactCommon",
|
||||
"-C", file("src/main/jni/react/jni").absolutePath,
|
||||
"clean")
|
||||
|
|
Загрузка…
Ссылка в новой задаче