From 0a3055d98a36e49746144e883edc7e20afec4fcb Mon Sep 17 00:00:00 2001 From: Dulmandakh Date: Wed, 27 Jun 2018 20:25:32 -0700 Subject: [PATCH] gradle to set project-wide properties (#19845) Summary: Change HelloWorld app template to use project-wide properties. See https://developer.android.com/studio/build/gradle-tips#configure-project-wide-properties. RN community and third-party native module developers adopted this, so it'll make RN package development and usage easy. CI is green https://circleci.com/gh/dulmandakh/react-native/507 Closes https://github.com/facebook/react-native/pull/19845 Differential Revision: D8675341 Pulled By: hramos fbshipit-source-id: 4ed06cd7ef7ae70f153d7f335ef8a9d1371f6ce0 --- .../templates/HelloWorld/android/app/build.gradle | 10 +++++----- local-cli/templates/HelloWorld/android/build.gradle | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/local-cli/templates/HelloWorld/android/app/build.gradle b/local-cli/templates/HelloWorld/android/app/build.gradle index 131424b8c33344..31a0da9a576ea7 100644 --- a/local-cli/templates/HelloWorld/android/app/build.gradle +++ b/local-cli/templates/HelloWorld/android/app/build.gradle @@ -94,13 +94,13 @@ def enableSeparateBuildPerCPUArchitecture = false def enableProguardInReleaseBuilds = false android { - compileSdkVersion 26 - buildToolsVersion "26.0.3" + compileSdkVersion rootProject.ext.compileSdkVersion + buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { applicationId "com.helloworld" - minSdkVersion 16 - targetSdkVersion 22 + minSdkVersion rootProject.ext.minSdkVersion + targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" ndk { @@ -138,7 +138,7 @@ android { dependencies { compile fileTree(dir: "libs", include: ["*.jar"]) - compile "com.android.support:appcompat-v7:26.1.0" + compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" compile "com.facebook.react:react-native:+" // From node_modules } diff --git a/local-cli/templates/HelloWorld/android/build.gradle b/local-cli/templates/HelloWorld/android/build.gradle index 225b5f682d0ff8..49569e4db5f7e7 100644 --- a/local-cli/templates/HelloWorld/android/build.gradle +++ b/local-cli/templates/HelloWorld/android/build.gradle @@ -30,3 +30,11 @@ allprojects { } } } + +ext { + buildToolsVersion = "26.0.3" + minSdkVersion = 16 + compileSdkVersion = 26 + targetSdkVersion = 26 + supportLibVersion = "26.1.0" +}