Skip to content

Commit 4a2d8d4

Browse files
bestanderide
authored andcommitted
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 #11469 Differential Revision: D4339446 Pulled By: mkonicek fbshipit-source-id: ccc9196e9b675c16a235a318c4861aaa4e263d6e
1 parent bcdf00e commit 4a2d8d4

2 files changed

Lines changed: 27 additions & 11 deletions

File tree

ReactAndroid/build.gradle

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,31 @@ task createNativeDepsDirectories {
3535
}
3636

3737
task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) {
38-
// Use ZIP version as it's faster this way to selectively extract some parts of the archive
39-
src 'https://downloads.sourceforge.net/project/boost/boost/1.57.0/boost_1_57_0.zip'
40-
// alternative
41-
// src 'http://mirror.nienbo.com/boost/boost_1_57_0.zip'
38+
src 'https://registry.yarnpkg.com/boost-react-native-bundle/-/boost-react-native-bundle-1.57.0.tgz'
4239
onlyIfNewer true
4340
overwrite false
44-
dest new File(downloadsDir, 'boost_1_57_0.zip')
41+
dest new File(downloadsDir, 'boost-react-native-bundle-1.57.0.tgz')
4542
}
4643

47-
task prepareBoost(dependsOn: boostPath ? [] : [downloadBoost], type: Copy) {
48-
from boostPath ?: zipTree(downloadBoost.dest)
44+
task unpackBoost(dependsOn: downloadBoost, type: Copy) {
45+
from tarTree(resources.gzip(downloadBoost.dest))
46+
include 'package/boost_1_57_0/boost/**/*.hpp'
47+
into "$thirdPartyNdkDir/boost"
48+
// npm packages are unpacked into folder "package" that we want to strip
49+
eachFile { FileCopyDetails fcp ->
50+
if (fcp.relativePath.pathString.startsWith("package")) {
51+
// remap the file to the root
52+
def segments = fcp.relativePath.segments
53+
def pathsegments = segments[1..-1] as String[]
54+
fcp.relativePath = new RelativePath(!fcp.file.isDirectory(), pathsegments)
55+
} else {
56+
fcp.exclude()
57+
}
58+
}
59+
}
60+
61+
task prepareBoost(dependsOn: boostPath ? [] : [unpackBoost], type: Copy) {
62+
from boostPath ?: []
4963
from 'src/main/jni/third-party/boost/Android.mk'
5064
include 'boost_1_57_0/boost/**/*.hpp', 'Android.mk'
5165
into "$thirdPartyNdkDir/boost"

circle.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,15 @@ test:
5959
- buck build ReactAndroid/src/main/java/com/facebook/react
6060
- buck build ReactAndroid/src/main/java/com/facebook/react/shell
6161

62+
# compile native libs with Gradle script, we need bridge for unit and
63+
# integration tests
64+
- ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=1 -Pcom.android.build.threadPoolSize=1:
65+
timeout: 360
66+
6267
# unit tests
6368
- buck test ReactAndroid/src/test/... --config build.threads=1
6469

65-
# instrumentation tests
66-
# compile native libs with Gradle script
67-
- ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=1 -Pcom.android.build.threadPoolSize=1:
68-
timeout: 360
70+
# integration tests
6971
# build JS bundle for instrumentation tests
7072
- 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
7173
# build test APK

0 commit comments

Comments
 (0)