diff --git a/RNTester/android/app/build.gradle b/RNTester/android/app/build.gradle index f0f5926139f923..530876fcf76016 100644 --- a/RNTester/android/app/build.gradle +++ b/RNTester/android/app/build.gradle @@ -92,7 +92,6 @@ def enableProguardInReleaseBuilds = true android { compileSdkVersion 27 - buildToolsVersion "27.0.3" defaultConfig { applicationId "com.facebook.react.uiapp" diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index a419728d773e9c..b0379fb01efa32 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -242,16 +242,22 @@ task buildReactNdkLib(dependsOn: [prepareJSC, prepareBoost, prepareDoubleConvers "REACT_COMMON_DIR=$projectDir/../ReactCommon", "REACT_SRC_DIR=$projectDir/src/main/java/com/facebook/react", '-C', file('src/main/jni/react/jni').absolutePath, - '--jobs', project.hasProperty("jobs") ? project.property("jobs") : Runtime.runtime.availableProcessors() + '--jobs', project.findProperty("jobs") ?: Runtime.runtime.availableProcessors() } task cleanReactNdkLib(type: Exec) { + ignoreExitValue true + errorOutput new ByteArrayOutputStream() commandLine getNdkBuildFullPath(), "NDK_APPLICATION_MK=$projectDir/src/main/jni/Application.mk", "THIRD_PARTY_NDK_DIR=$buildDir/third-party-ndk", "REACT_COMMON_DIR=$projectDir/../ReactCommon", '-C', file('src/main/jni/react/jni').absolutePath, 'clean' + doLast { + file(AAR_OUTPUT_URL).delete() + println "Deleted aar output dir at ${file(AAR_OUTPUT_URL)}" + } } task packageReactNdkLibs(dependsOn: buildReactNdkLib, type: Copy) { @@ -267,7 +273,6 @@ task packageReactNdkLibsForBuck(dependsOn: packageReactNdkLibs, type: Copy) { android { compileSdkVersion 27 - buildToolsVersion "27.0.3" defaultConfig { minSdkVersion 16 diff --git a/ReactAndroid/release.gradle b/ReactAndroid/release.gradle index cc66a47e39eb65..6fba6f20c98c43 100644 --- a/ReactAndroid/release.gradle +++ b/ReactAndroid/release.gradle @@ -6,6 +6,10 @@ apply plugin: 'maven' apply plugin: 'signing' +ext { + AAR_OUTPUT_URL = "file://${projectDir}/../android" +} + // Gradle tasks for publishing to maven // 1) To install in local maven repo use :installArchives task // 2) To upload artifact to maven central use: :uploadArchives (you'd need to have the permission to do that) @@ -15,15 +19,15 @@ def isReleaseBuild() { } def getRepositoryUrl() { - return project.hasProperty('repositoryUrl') ? property('repositoryUrl') : 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' + return project.findProperty('repositoryUrl') ?: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' } def getRepositoryUsername() { - return project.hasProperty('repositoryUsername') ? property('repositoryUsername') : '' + return project.findProperty('repositoryUsername') ?: '' } def getRepositoryPassword() { - return project.hasProperty('repositoryPassword') ? property('repositoryPassword') : '' + return project.findProperty('repositoryPassword') ?: '' } def configureReactNativePom(def pom) { @@ -128,7 +132,7 @@ afterEvaluate { project -> configuration = configurations.archives repositories.mavenDeployer { // Deploy to react-native/android, ready to publish to npm - repository url: "file://${projectDir}/../android" + repository url: AAR_OUTPUT_URL configureReactNativePom pom } diff --git a/ReactAndroid/src/main/jni/Application.mk b/ReactAndroid/src/main/jni/Application.mk index 942a122de79183..c73c0397f5d24d 100644 --- a/ReactAndroid/src/main/jni/Application.mk +++ b/ReactAndroid/src/main/jni/Application.mk @@ -24,11 +24,11 @@ APP_MK_DIR := $(dir $(lastword $(MAKEFILE_LIST))) # etc.) are defined inside build.gradle. NDK_MODULE_PATH := $(APP_MK_DIR)$(HOST_DIRSEP)$(THIRD_PARTY_NDK_DIR)$(HOST_DIRSEP)$(REACT_COMMON_DIR)$(HOST_DIRSEP)$(APP_MK_DIR)first-party$(HOST_DIRSEP)$(REACT_SRC_DIR) -APP_STL := gnustl_shared +APP_STL := c++_shared # Make sure every shared lib includes a .note.gnu.build-id header APP_CFLAGS := -Wall -Werror APP_CPPFLAGS := -std=c++1y APP_LDFLAGS := -Wl,--build-id -NDK_TOOLCHAIN_VERSION := 4.9 +NDK_TOOLCHAIN_VERSION := clang diff --git a/ReactAndroid/src/main/jni/react/jni/Android.mk b/ReactAndroid/src/main/jni/react/jni/Android.mk index 85e5fddc769de8..9259233cca8691 100644 --- a/ReactAndroid/src/main/jni/react/jni/Android.mk +++ b/ReactAndroid/src/main/jni/react/jni/Android.mk @@ -17,7 +17,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH) # ./../ == react LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../.. -LOCAL_CFLAGS += -fexceptions -frtti +LOCAL_CFLAGS += -fexceptions -frtti -Wno-unused-lambda-capture LOCAL_LDLIBS += -landroid diff --git a/ReactAndroid/src/main/jni/third-party/folly/Android.mk b/ReactAndroid/src/main/jni/third-party/folly/Android.mk index 4700879022a26d..e285d10666f5e9 100644 --- a/ReactAndroid/src/main/jni/third-party/folly/Android.mk +++ b/ReactAndroid/src/main/jni/third-party/folly/Android.mk @@ -26,6 +26,7 @@ FOLLY_FLAGS := \ -DFOLLY_NO_CONFIG=1 \ -DFOLLY_HAVE_CLOCK_GETTIME=1 \ -DFOLLY_HAVE_MEMRCHR=1 \ + -DFOLLY_USE_LIBCPP=1 # If APP_PLATFORM in Application.mk targets android-23 above, please comment this line. # NDK uses GNU style stderror_r() after API 23. diff --git a/ReactAndroid/src/main/jni/third-party/glog/Android.mk b/ReactAndroid/src/main/jni/third-party/glog/Android.mk index 1abd09655046d0..33ea07c9a26ab2 100644 --- a/ReactAndroid/src/main/jni/third-party/glog/Android.mk +++ b/ReactAndroid/src/main/jni/third-party/glog/Android.mk @@ -23,7 +23,8 @@ LOCAL_CFLAGS += \ -g \ -O2 \ -D_START_GOOGLE_NAMESPACE_="namespace google {" \ - -D_END_GOOGLE_NAMESPACE_="}" + -D_END_GOOGLE_NAMESPACE_="}" \ + -DHAVE_PREAD=1 LOCAL_MODULE := glog diff --git a/ReactCommon/cxxreact/Android.mk b/ReactCommon/cxxreact/Android.mk index faf9935abee4c2..cd234d418c51fd 100644 --- a/ReactCommon/cxxreact/Android.mk +++ b/ReactCommon/cxxreact/Android.mk @@ -17,7 +17,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) LOCAL_CFLAGS := \ -DLOG_TAG=\"ReactNative\" -LOCAL_CFLAGS += -fexceptions -frtti +LOCAL_CFLAGS += -fexceptions -frtti -Wno-unused-lambda-capture LOCAL_STATIC_LIBRARIES := boost LOCAL_SHARED_LIBRARIES := jsinspector libfolly_json glog diff --git a/build.gradle b/build.gradle index f85d59f03c1adb..3fe554d50d4ae6 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.4' + classpath 'com.android.tools.build:gradle:3.2.1' classpath 'de.undercouch:gradle-download-task:3.4.3' // NOTE: Do not place your application dependencies here; they belong @@ -32,6 +32,6 @@ allprojects { } task wrapper(type: Wrapper) { - gradleVersion = '4.4' + gradleVersion = '4.10.2' distributionUrl = distributionUrl.replace("bin", "all") } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 01b8bf6b1f99ca..29953ea141f55e 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b6517bb1d16502..d76b502e226a5c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip diff --git a/gradlew.bat b/gradlew.bat index 1934213b6ddee5..e95643d6a2ca62 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,8 +1,3 @@ -:: Copyright (c) 2015-present, Facebook, Inc. -:: -:: This source code is licensed under the MIT license found in the -:: LICENSE file in the root directory of this source tree. - @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem diff --git a/local-cli/templates/HelloWorld/android/app/build.gradle b/local-cli/templates/HelloWorld/android/app/build.gradle index a123b6cfb34a73..b86e047a8a54c7 100644 --- a/local-cli/templates/HelloWorld/android/app/build.gradle +++ b/local-cli/templates/HelloWorld/android/app/build.gradle @@ -95,7 +95,6 @@ def enableProguardInReleaseBuilds = false android { compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { applicationId "com.helloworld" @@ -109,7 +108,7 @@ android { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK - include "armeabi-v7a", "x86", "arm64-v8a" + include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } buildTypes { @@ -123,7 +122,7 @@ android { variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits - def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3] + def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = diff --git a/local-cli/templates/HelloWorld/android/build.gradle b/local-cli/templates/HelloWorld/android/build.gradle index 7fde4f576be839..5c9b23477ae7df 100644 --- a/local-cli/templates/HelloWorld/android/build.gradle +++ b/local-cli/templates/HelloWorld/android/build.gradle @@ -2,7 +2,6 @@ buildscript { ext { - buildToolsVersion = "27.0.3" minSdkVersion = 16 compileSdkVersion = 27 targetSdkVersion = 27 @@ -13,7 +12,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.4' + classpath 'com.android.tools.build:gradle:3.2.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/local-cli/templates/HelloWorld/android/gradle/wrapper/gradle-wrapper.properties b/local-cli/templates/HelloWorld/android/gradle/wrapper/gradle-wrapper.properties index b6517bb1d16502..019065d1d650ce 100644 --- a/local-cli/templates/HelloWorld/android/gradle/wrapper/gradle-wrapper.properties +++ b/local-cli/templates/HelloWorld/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip