Fix native tasks prepare ordering
Summary: ^ This change makes it clearer the order of tasks for the native libraries. If unspecified, tasks will run in parallel. There was an additional issue in which the revision could be written to disk before all dependencies are properly downloaded and packaged. For reference, we depend on Folly. Folly depends on: - Double-Conversion - Glog - Boost - LibEvent This is now reflected in the tasks graph. Reviewed By: passy Differential Revision: D35931187 fbshipit-source-id: ec19a28521ebf318bd1e92feafab1671733679ca
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d87fdafc9f
commit
637b578650
94
android/third-party/native.gradle
vendored
94
android/third-party/native.gradle
vendored
@@ -123,45 +123,7 @@ task prepareBoost(dependsOn: [downloadBoost], type: Copy) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task downloadFolly(dependsOn: createNativeDepsDirectories, type: Download) {
|
task downloadLibEvent(dependsOn: [createNativeDepsDirectories], type: Download) {
|
||||||
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
|
||||||
src 'https://github.com/facebook/folly/archive/v2020.02.17.00.tar.gz'
|
|
||||||
onlyIfNewer true
|
|
||||||
overwrite false
|
|
||||||
dest new File(downloadsDir, 'folly-' + getDownloadFileName(src))
|
|
||||||
}
|
|
||||||
|
|
||||||
task prepareFolly(dependsOn: [downloadFolly], type: Copy) {
|
|
||||||
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
|
||||||
from tarTree(downloadFolly.dest)
|
|
||||||
from './overrides/Folly/'
|
|
||||||
include 'folly-2020.02.17.00/folly/**/*', 'build.gradle', 'CMakeLists.txt', 'ApplicationManifest.xml'
|
|
||||||
eachFile { it.path = it.path - "folly-2020.02.17.00/" }
|
|
||||||
includeEmptyDirs = false
|
|
||||||
into "$externalDir/folly/"
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Get rid off this hack.
|
|
||||||
task finalizeFollyWithDemangle(dependsOn: [prepareFolly], type: Copy) {
|
|
||||||
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
|
||||||
from './overrides/Folly/'
|
|
||||||
include 'Demangle.h'
|
|
||||||
into "$externalDir/folly/folly/detail/"
|
|
||||||
}
|
|
||||||
|
|
||||||
// HACK to fix template issue with newest NDK
|
|
||||||
task finalizeFollyWithFileUtil(dependsOn: [prepareFolly], type: Copy) {
|
|
||||||
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
|
||||||
from './overrides/Folly/'
|
|
||||||
include 'FileUtil.cpp'
|
|
||||||
into "$externalDir/folly/folly/"
|
|
||||||
}
|
|
||||||
|
|
||||||
task finalizeFolly(dependsOn: [finalizeFollyWithDemangle, finalizeFollyWithFileUtil]) {
|
|
||||||
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
|
||||||
}
|
|
||||||
|
|
||||||
task downloadLibEvent(dependsOn: [], type: Download) {
|
|
||||||
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
||||||
src 'https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz'
|
src 'https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz'
|
||||||
onlyIfNewer true
|
onlyIfNewer true
|
||||||
@@ -169,7 +131,7 @@ task downloadLibEvent(dependsOn: [], type: Download) {
|
|||||||
dest new File(downloadsDir, 'libevent-' + getDownloadFileName(src))
|
dest new File(downloadsDir, 'libevent-' + getDownloadFileName(src))
|
||||||
}
|
}
|
||||||
|
|
||||||
task prepareLibEvent(dependsOn: [downloadLibEvent], type: Copy) {
|
task prepareLibEvent1(dependsOn: [downloadLibEvent], type: Copy) {
|
||||||
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
||||||
from tarTree(downloadLibEvent.dest)
|
from tarTree(downloadLibEvent.dest)
|
||||||
from './overrides/LibEvent/'
|
from './overrides/LibEvent/'
|
||||||
@@ -178,7 +140,7 @@ task prepareLibEvent(dependsOn: [downloadLibEvent], type: Copy) {
|
|||||||
into "$externalDir/LibEvent"
|
into "$externalDir/LibEvent"
|
||||||
}
|
}
|
||||||
|
|
||||||
task prepareLibEvent2(dependsOn: [prepareLibEvent], type: Copy) {
|
task prepareLibEvent2(dependsOn: [prepareLibEvent1], type: Copy) {
|
||||||
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
||||||
from './overrides/LibEvent/'
|
from './overrides/LibEvent/'
|
||||||
include 'event-config.h'
|
include 'event-config.h'
|
||||||
@@ -193,23 +155,51 @@ task finalizeLibEvent(dependsOn: [prepareLibEvent2], type: Copy) {
|
|||||||
into "$externalDir/LibEvent/libevent-2.1.11-stable/"
|
into "$externalDir/LibEvent/libevent-2.1.11-stable/"
|
||||||
}
|
}
|
||||||
|
|
||||||
task writeCacheRevision(dependsOn: createNativeDepsDirectories) {
|
task downloadFolly(dependsOn: createNativeDepsDirectories, type: Download) {
|
||||||
|
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
||||||
|
src 'https://github.com/facebook/folly/archive/v2020.02.17.00.tar.gz'
|
||||||
|
onlyIfNewer true
|
||||||
|
overwrite false
|
||||||
|
dest new File(downloadsDir, 'folly-' + getDownloadFileName(src))
|
||||||
|
}
|
||||||
|
|
||||||
|
task prepareFolly(dependsOn: [downloadFolly, prepareBoost, prepareDoubleConversion, finalizeGlog, finalizeLibEvent], type: Copy) {
|
||||||
|
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
||||||
|
from tarTree(downloadFolly.dest)
|
||||||
|
from './overrides/Folly/'
|
||||||
|
include 'folly-2020.02.17.00/folly/**/*', 'build.gradle', 'CMakeLists.txt', 'ApplicationManifest.xml'
|
||||||
|
eachFile { it.path = it.path - "folly-2020.02.17.00/" }
|
||||||
|
includeEmptyDirs = false
|
||||||
|
into "$externalDir/folly/"
|
||||||
|
}
|
||||||
|
|
||||||
|
task finalizeFollyWithDemangle(dependsOn: [prepareFolly], type: Copy) {
|
||||||
|
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
||||||
|
from './overrides/Folly/'
|
||||||
|
include 'Demangle.h'
|
||||||
|
into "$externalDir/folly/folly/detail/"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix template issue with newest NDK
|
||||||
|
task finalizeFollyWithFileUtil(dependsOn: [prepareFolly], type: Copy) {
|
||||||
|
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
||||||
|
from './overrides/Folly/'
|
||||||
|
include 'FileUtil.cpp'
|
||||||
|
into "$externalDir/folly/folly/"
|
||||||
|
}
|
||||||
|
|
||||||
|
task finalizeFolly(dependsOn: [finalizeFollyWithDemangle, finalizeFollyWithFileUtil]) {
|
||||||
|
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
||||||
|
}
|
||||||
|
|
||||||
|
task writeCacheRevision(dependsOn: [finalizeFolly]) {
|
||||||
doLast {
|
doLast {
|
||||||
buildDir.mkdirs()
|
buildDir.mkdirs()
|
||||||
revisionFile.text = CACHE_REVISION.toString()
|
revisionFile.text = CACHE_REVISION.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def allTasks = [
|
|
||||||
finalizeGlog,
|
|
||||||
prepareDoubleConversion,
|
|
||||||
prepareBoost,
|
|
||||||
finalizeFolly,
|
|
||||||
finalizeLibEvent,
|
|
||||||
writeCacheRevision,
|
|
||||||
]
|
|
||||||
|
|
||||||
task prepareAllLibs() {
|
task prepareAllLibs() {
|
||||||
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
onlyIf { isCacheOutOfDate(CACHE_REVISION) }
|
||||||
dependsOn allTasks
|
dependsOn writeCacheRevision
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user