Skip to content

Commit 2cfa520

Browse files
SaeedZhianyChristopher J. Brody
and
Christopher J. Brody
committed
Gradle updates in android.js (#24)
* Update android.js By these changes, developer's library can read android plugin version and react-native version of root project * Fix embedding of braces in templates/android.js * Update Gradle comment for gradlePluginVersion from RN 0.60 Co-authored-by: SaeedZhiany <[email protected]> Co-authored-by: Christopher J. Brody <[email protected]>
1 parent 81f8109 commit 2cfa520

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

templates/android.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
module.exports = platform => [{
22
name: () => `${platform}/build.gradle`,
33
content: ({ packageIdentifier }) => `buildscript {
4+
ext.safeExtGet = {prop, fallback ->
5+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
6+
}
47
repositories {
58
google()
69
jcenter()
710
}
811
912
dependencies {
10-
// Matches recent template from React Native (0.59)
11-
// https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L16
12-
classpath 'com.android.tools.build:gradle:3.3.2'
13+
// Matches recent template from React Native (0.60)
14+
// https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle#L16
15+
classpath("com.android.tools.build:gradle:$\{safeExtGet('gradlePluginVersion', '3.4.1')\}")
1316
}
1417
}
1518
1619
apply plugin: 'com.android.library'
1720
apply plugin: 'maven'
1821
19-
def safeExtGet(prop, fallback) {
20-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
21-
}
22-
2322
// Matches values in recent template from React Native (0.59)
2423
// https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L5-L9
2524
def DEFAULT_COMPILE_SDK_VERSION = 28
@@ -53,7 +52,7 @@ repositories {
5352
}
5453
5554
dependencies {
56-
compile 'com.facebook.react:react-native:+'
55+
implementation "com.facebook.react:react-native:$\{safeExtGet('reactnativeVersion', '+')\}"
5756
}
5857
5958
def configureReactNativePom(def pom) {

0 commit comments

Comments
 (0)