Switched to npm hosted boost lib

Summary:
Boost is officially hosted on SourceForge which has ab SSL problem that Gradle complains about and also it is sometimes unavailable.
I switched to using npm hosted (yarnpkg mirrored for performance) boost lib exactly the same as from Source Forge.

Other alternatives considered:
- CDN e.g. mirror.nienbo.com started responding with 4XX code when requested by Gradle
- File sharing like DropBox are not for mass anonymous downloads
- Github is not good for binary files and is throttled for anonymous raw file downloads
- S3 or similar. Requires amazon account for maintenance and does not expose semver API and other nice features that npm has

In the future I'd like to try Yarn as dependency management tool for bridge builds, this could be the first step.

**Test plan (required)**

- Circle (testing with caches cleaned)
- `./gradlew ReactAndroid:packageReactNdkLibsForBuck` (check twice to make sure caches work)
- `REACT_NATIVE_BOOST_PATH=./bridge-dependencies/node_modules/boost-react-native-bundle ./
Closes https://github.com/facebook/react-native/pull/11469

Differential Revision: D4339446

Pulled By: mkonicek

fbshipit-source-id: ccc9196e9b675c16a235a318c4861aaa4e263d6e
This commit is contained in:
Konstantin Raev 2016-12-16 06:30:14 -08:00 committed by Facebook Github Bot
parent fa082796a5
commit 0579efea8c
2 changed files with 27 additions and 11 deletions

View File

@ -35,17 +35,31 @@ task createNativeDepsDirectories {
} }
task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) { task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) {
// Use ZIP version as it's faster this way to selectively extract some parts of the archive src 'https://registry.yarnpkg.com/boost-react-native-bundle/-/boost-react-native-bundle-1.57.0.tgz'
src 'https://downloads.sourceforge.net/project/boost/boost/1.57.0/boost_1_57_0.zip'
// alternative
// src 'http://mirror.nienbo.com/boost/boost_1_57_0.zip'
onlyIfNewer true onlyIfNewer true
overwrite false overwrite false
dest new File(downloadsDir, 'boost_1_57_0.zip') dest new File(downloadsDir, 'boost-react-native-bundle-1.57.0.tgz')
} }
task prepareBoost(dependsOn: boostPath ? [] : [downloadBoost], type: Copy) { task unpackBoost(dependsOn: downloadBoost, type: Copy) {
from boostPath ?: zipTree(downloadBoost.dest) from tarTree(resources.gzip(downloadBoost.dest))
include 'package/boost_1_57_0/boost/**/*.hpp'
into "$thirdPartyNdkDir/boost"
// npm packages are unpacked into folder "package" that we want to strip
eachFile { FileCopyDetails fcp ->
if (fcp.relativePath.pathString.startsWith("package")) {
// remap the file to the root
def segments = fcp.relativePath.segments
def pathsegments = segments[1..-1] as String[]
fcp.relativePath = new RelativePath(!fcp.file.isDirectory(), pathsegments)
} else {
fcp.exclude()
}
}
}
task prepareBoost(dependsOn: boostPath ? [] : [unpackBoost], type: Copy) {
from boostPath ?: []
from 'src/main/jni/third-party/boost/Android.mk' from 'src/main/jni/third-party/boost/Android.mk'
include 'boost_1_57_0/boost/**/*.hpp', 'Android.mk' include 'boost_1_57_0/boost/**/*.hpp', 'Android.mk'
into "$thirdPartyNdkDir/boost" into "$thirdPartyNdkDir/boost"

View File

@ -59,13 +59,15 @@ test:
- buck build ReactAndroid/src/main/java/com/facebook/react - buck build ReactAndroid/src/main/java/com/facebook/react
- buck build ReactAndroid/src/main/java/com/facebook/react/shell - buck build ReactAndroid/src/main/java/com/facebook/react/shell
# compile native libs with Gradle script, we need bridge for unit and
# integration tests
- ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=1 -Pcom.android.build.threadPoolSize=1:
timeout: 360
# unit tests # unit tests
- buck test ReactAndroid/src/test/... --config build.threads=1 - buck test ReactAndroid/src/test/... --config build.threads=1
# instrumentation tests # integration tests
# compile native libs with Gradle script
- ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=1 -Pcom.android.build.threadPoolSize=1:
timeout: 360
# build JS bundle for instrumentation tests # build JS bundle for instrumentation tests
- REACT_NATIVE_MAX_WORKERS=1 node local-cli/cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js - REACT_NATIVE_MAX_WORKERS=1 node local-cli/cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
# build test APK # build test APK