Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate native dependencies versions #20742

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think old-fashioned is good and more readable.

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