mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Refactor Extract Headers and JNI from AARs to an internal task (#32426)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/32426 This diff refactors the extractHeader and extractJni tasks to a single Gradle task in the `.internal` package. The reason for this change is that those two tasks were always running, therefore invalidating the whole native build cache. Changelog: [Internal] [Changed] - Refactor Extract Headers and JNI from AARs to an internal task Reviewed By: mdvacca, ShikaSD Differential Revision: D31682942 fbshipit-source-id: 191cc77902e82c0425949cee743d240ded790137
This commit is contained in:
committed by
Facebook GitHub Bot
parent
75b2e5cc97
commit
bc93fefe13
+13
-27
@@ -284,7 +284,7 @@ def getNdkBuildFullPath() {
|
||||
}
|
||||
|
||||
def buildReactNdkLib = tasks.register("buildReactNdkLib", Exec) {
|
||||
dependsOn(prepareJSC, prepareHermes, prepareBoost, prepareDoubleConversion, prepareFmt, prepareFolly, prepareGlog, prepareLibevent, extractAARHeaders, extractJNIFiles)
|
||||
dependsOn(prepareJSC, prepareHermes, prepareBoost, prepareDoubleConversion, prepareFmt, prepareFolly, prepareGlog, prepareLibevent, extractNativeDependencies)
|
||||
dependsOn("generateCodegenArtifactsFromSchema");
|
||||
|
||||
inputs.dir("$projectDir/../ReactCommon")
|
||||
@@ -343,32 +343,18 @@ def packageReactNdkLibsForBuck = tasks.register("packageReactNdkLibsForBuck", Co
|
||||
into("src/main/jni/prebuilt/lib")
|
||||
}
|
||||
|
||||
task extractAARHeaders {
|
||||
doLast {
|
||||
configurations.extractHeaders.files.each {
|
||||
def file = it.absoluteFile
|
||||
def packageName = file.name.tokenize('-')[0]
|
||||
copy {
|
||||
from zipTree(file)
|
||||
into "$projectDir/src/main/jni/first-party/$packageName/headers"
|
||||
include "**/*.h"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task extractJNIFiles {
|
||||
doLast {
|
||||
configurations.extractJNI.files.each {
|
||||
def file = it.absoluteFile
|
||||
def packageName = file.name.tokenize('-')[0]
|
||||
copy {
|
||||
from zipTree(file)
|
||||
into "$projectDir/src/main/jni/first-party/$packageName/"
|
||||
include "jni/**/*"
|
||||
}
|
||||
}
|
||||
}
|
||||
final def extractNativeDependencies = tasks.register('extractNativeDependencies', ExtractJniAndHeadersTask) {
|
||||
it.extractHeadersConfiguration.setFrom(configurations.extractHeaders)
|
||||
it.extractJniConfiguration.setFrom(configurations.extractJNI)
|
||||
it.baseOutputDir = project.file("src/main/jni/first-party/")
|
||||
// Sadly this task as an output folder path that is directly dependent on
|
||||
// the task input (i.e. src/main/jni/first-party/<package-name>/...
|
||||
// This means that this task is using the parent folder (first-party/) as
|
||||
// @OutputFolder. The `prepareHermes` task will also output inside that
|
||||
// folder and if the two tasks happen to be inside the same run, we want
|
||||
// `extractNativeDependencies` to run after `prepareHermes` to do not
|
||||
// invalidate the input/output calculation for this task.
|
||||
it.mustRunAfter(prepareHermes)
|
||||
}
|
||||
|
||||
task installArchives {
|
||||
|
||||
Reference in New Issue
Block a user