Skip to content

Commit

Permalink
Consolidate native dependencies versions (#20742)
Browse files Browse the repository at this point in the history
Summary:
This PR tries to consolidate Android native dependencies versions to make it less error prone to version bumps.
Pull Request resolved: #20742

Differential Revision: D9818155

Pulled By: hramos

fbshipit-source-id: 9bf631640910edad5731014f4e23dbca45af2b59
  • Loading branch information
dulmandakh authored and facebook-github-bot committed Sep 13, 2018
1 parent 644fc57 commit ba608a2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
37 changes: 19 additions & 18 deletions ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

apply plugin: 'com.android.library'
apply plugin: 'maven'

apply plugin: 'de.undercouch.download'
plugins {
id("com.android.library")
id("maven")
id("de.undercouch.download")
}

import de.undercouch.gradle.tasks.download.Download
import org.apache.tools.ant.taskdefs.condition.Os
Expand Down Expand Up @@ -39,68 +40,68 @@ task createNativeDepsDirectories {
}

task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) {
src 'https://github.com/react-native-community/boost-for-react-native/releases/download/v1.63.0-0/boost_1_63_0.tar.gz'
src "https://github.com/react-native-community/boost-for-react-native/releases/download/v${BOOST_VERSION.replace("_", ".")}-0/boost_${BOOST_VERSION}.tar.gz"
onlyIfNewer true
overwrite false
dest new File(downloadsDir, 'boost_1_63_0.tar.gz')
dest new File(downloadsDir, "boost_${BOOST_VERSION}.tar.gz")
}

task prepareBoost(dependsOn: boostPath ? [] : [downloadBoost], type: Copy) {
from boostPath ?: tarTree(resources.gzip(downloadBoost.dest))
from 'src/main/jni/third-party/boost/Android.mk'
include 'Android.mk', 'boost_1_63_0/boost/**/*.hpp', 'boost/boost/**/*.hpp'
include 'Android.mk', "boost_${BOOST_VERSION}/boost/**/*.hpp", 'boost/boost/**/*.hpp'
includeEmptyDirs = false
into "$thirdPartyNdkDir/boost"
doLast {
file("$thirdPartyNdkDir/boost/boost").renameTo("$thirdPartyNdkDir/boost/boost_1_63_0")
file("$thirdPartyNdkDir/boost/boost").renameTo("$thirdPartyNdkDir/boost/boost_${BOOST_VERSION}")
}
}

task downloadDoubleConversion(dependsOn: createNativeDepsDirectories, type: Download) {
src 'https://github.com/google/double-conversion/archive/v1.1.6.tar.gz'
src "https://github.com/google/double-conversion/archive/v${DOUBLE_CONVERSION_VERSION}.tar.gz"
onlyIfNewer true
overwrite false
dest new File(downloadsDir, 'double-conversion-1.1.6.tar.gz')
dest new File(downloadsDir, "double-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gz")
}

task prepareDoubleConversion(dependsOn: dependenciesPath ? [] : [downloadDoubleConversion], type: Copy) {
from dependenciesPath ?: tarTree(downloadDoubleConversion.dest)
from 'src/main/jni/third-party/double-conversion/Android.mk'
include 'double-conversion-1.1.6/src/**/*', 'Android.mk'
include "double-conversion-${DOUBLE_CONVERSION_VERSION}/src/**/*", 'Android.mk'
filesMatching('*/src/**/*', {fname -> fname.path = "double-conversion/${fname.name}"})
includeEmptyDirs = false
into "$thirdPartyNdkDir/double-conversion"
}

task downloadFolly(dependsOn: createNativeDepsDirectories, type: Download) {
src 'https://github.com/facebook/folly/archive/v2016.10.31.00.tar.gz'
src "https://github.com/facebook/folly/archive/v${FOLLY_VERSION}.tar.gz"
onlyIfNewer true
overwrite false
dest new File(downloadsDir, 'folly-2016.10.31.00.tar.gz');
dest new File(downloadsDir, "folly-${FOLLY_VERSION}.tar.gz");
}

task prepareFolly(dependsOn: dependenciesPath ? [] : [downloadFolly], type: Copy) {
from dependenciesPath ?: tarTree(downloadFolly.dest)
from 'src/main/jni/third-party/folly/Android.mk'
include 'folly-2016.10.31.00/folly/**/*', 'Android.mk'
eachFile {fname -> fname.path = (fname.path - "folly-2016.10.31.00/")}
include "folly-${FOLLY_VERSION}/folly/**/*", 'Android.mk'
eachFile {fname -> fname.path = (fname.path - "folly-${FOLLY_VERSION}/")}
includeEmptyDirs = false
into "$thirdPartyNdkDir/folly"
}

task downloadGlog(dependsOn: createNativeDepsDirectories, type: Download) {
src 'https://github.com/google/glog/archive/v0.3.5.tar.gz'
src "https://github.com/google/glog/archive/v${GLOG_VERSION}.tar.gz"
onlyIfNewer true
overwrite false
dest new File(downloadsDir, 'glog-0.3.5.tar.gz')
dest new File(downloadsDir, "glog-${GLOG_VERSION}.tar.gz")
}

// Prepare glog sources to be compiled, this task will perform steps that normally should've been
// executed by automake. This way we can avoid dependencies on make/automake
task prepareGlog(dependsOn: dependenciesPath ? [] : [downloadGlog], type: Copy) {
from dependenciesPath ?: tarTree(downloadGlog.dest)
from 'src/main/jni/third-party/glog/'
include 'glog-0.3.5/src/**/*', 'Android.mk', 'config.h'
include "glog-${GLOG_VERSION}/src/**/*", 'Android.mk', 'config.h'
includeEmptyDirs = false
filesMatching('**/*.h.in') {
filter(ReplaceTokens, tokens: [
Expand Down
5 changes: 5 additions & 0 deletions ReactAndroid/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ FEST_ASSERT_CORE_VERSION=2.0M10

FRESCO_VERSION=1.10.0
OKHTTP_VERSION=3.10.0

BOOST_VERSION=1_63_0
DOUBLE_CONVERSION_VERSION=1.1.6
FOLLY_VERSION=2016.10.31.00
GLOG_VERSION=0.3.5

0 comments on commit ba608a2

Please sign in to comment.