From f38443cb061d495581c36d2f4c40de1b9c74f170 Mon Sep 17 00:00:00 2001 From: SaeedZhiany Date: Wed, 10 Jul 2019 15:41:10 +0430 Subject: [PATCH 1/3] Update android.js By these changes, developer's library can read android plugin version and react-native version of root project --- templates/android.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/templates/android.js b/templates/android.js index ad90c464..9a582ff3 100644 --- a/templates/android.js +++ b/templates/android.js @@ -1,6 +1,9 @@ module.exports = platform => [{ name: () => `${platform}/build.gradle`, content: ({ packageIdentifier }) => `buildscript { + ext.safeExtGet = {prop, fallback -> + rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback + } repositories { google() jcenter() @@ -9,17 +12,13 @@ module.exports = platform => [{ dependencies { // Matches recent template from React Native (0.59) // https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L16 - classpath 'com.android.tools.build:gradle:3.3.2' + classpath("com.android.tools.build:gradle:${safeExtGet('gradlePluginVersion', '3.4.1')}") } } apply plugin: 'com.android.library' apply plugin: 'maven' -def safeExtGet(prop, fallback) { - rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback -} - // Matches values in recent template from React Native (0.59) // https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L5-L9 def DEFAULT_COMPILE_SDK_VERSION = 28 @@ -53,7 +52,7 @@ repositories { } dependencies { - compile 'com.facebook.react:react-native:+' + implementation "com.facebook.react:react-native:${safeExtGet('reactnativeVersion', '+')}" } def configureReactNativePom(def pom) { From 793a2a2ad09e4acb58722a4cce790fed34be0891 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Wed, 10 Jul 2019 18:38:37 -0400 Subject: [PATCH 2/3] Fix embedding of braces in templates/android.js --- templates/android.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/android.js b/templates/android.js index 9a582ff3..dea6c653 100644 --- a/templates/android.js +++ b/templates/android.js @@ -12,7 +12,7 @@ module.exports = platform => [{ dependencies { // Matches recent template from React Native (0.59) // https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L16 - classpath("com.android.tools.build:gradle:${safeExtGet('gradlePluginVersion', '3.4.1')}") + classpath("com.android.tools.build:gradle:$\{safeExtGet('gradlePluginVersion', '3.4.1')\}") } } @@ -52,7 +52,7 @@ repositories { } dependencies { - implementation "com.facebook.react:react-native:${safeExtGet('reactnativeVersion', '+')}" + implementation "com.facebook.react:react-native:$\{safeExtGet('reactnativeVersion', '+')\}" } def configureReactNativePom(def pom) { From f1d66aefe82019a142d25783ec61f33776090f82 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Thu, 11 Jul 2019 18:26:13 -0400 Subject: [PATCH 3/3] Update Gradle comment for gradlePluginVersion from RN 0.60 --- templates/android.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/android.js b/templates/android.js index dea6c653..55cebe2c 100644 --- a/templates/android.js +++ b/templates/android.js @@ -10,8 +10,8 @@ module.exports = platform => [{ } dependencies { - // Matches recent template from React Native (0.59) - // https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L16 + // Matches recent template from React Native (0.60) + // https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle#L16 classpath("com.android.tools.build:gradle:$\{safeExtGet('gradlePluginVersion', '3.4.1')\}") } }