|
1 |
| - def packageJsonFile = file('../package.json') |
2 |
| - def packageJson = new groovy.json.JsonSlurper().parseText(packageJsonFile.text) |
3 |
| - def packageVersion = '"' + packageJson.version + '"' |
| 1 | +def packageJsonFile = file('../package.json') |
| 2 | +def packageJson = new groovy.json.JsonSlurper().parseText(packageJsonFile.text) |
| 3 | +def packageVersion = '"' + packageJson.version + '"' |
4 | 4 |
|
5 | 5 |
|
6 | 6 | buildscript {
|
7 |
| - if (project == rootProject) { |
8 |
| - repositories { |
9 |
| - google() |
10 |
| - mavenCentral() |
11 |
| - } |
| 7 | + ext { |
| 8 | + buildToolsVersion = "34.0.0" |
| 9 | + minSdkVersion = 21 |
| 10 | + compileSdkVersion = 34 |
| 11 | + targetSdkVersion = 34 |
| 12 | + ndkVersion = "25.1.8937393" |
| 13 | + kotlinVersion = "1.8.0" |
| 14 | + } |
| 15 | + if (project == rootProject) { |
| 16 | + repositories { |
| 17 | + google() |
| 18 | + mavenCentral() |
| 19 | + } |
12 | 20 |
|
13 |
| - dependencies { |
14 |
| - classpath 'com.android.tools.build:gradle:3.5.3' |
15 |
| - } |
| 21 | + dependencies { |
| 22 | + classpath("com.android.tools.build:gradle") |
| 23 | + classpath("com.facebook.react:react-native-gradle-plugin") |
| 24 | + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") |
16 | 25 | }
|
| 26 | + } |
17 | 27 | }
|
18 | 28 |
|
19 | 29 | apply plugin: 'com.android.library'
|
20 | 30 |
|
21 | 31 | def safeExtGet(prop, fallback) {
|
22 |
| - rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback |
| 32 | + rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback |
23 | 33 | }
|
24 | 34 |
|
25 | 35 | android {
|
26 |
| - // Compatibility for AGP v. <4.2/Gradle 8 |
27 |
| - def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger() |
28 |
| - if (agpVersion >= 7) { |
29 |
| - namespace 'com.intercom.reactnative' |
30 |
| - } |
| 36 | + namespace 'com.intercom.reactnative' |
| 37 | + compileSdk rootProject.ext.compileSdkVersion |
| 38 | + buildToolsVersion rootProject.ext.buildToolsVersion |
31 | 39 |
|
32 |
| - compileSdkVersion safeExtGet('IntercomReactNative_compileSdkVersion', 34) |
33 |
| - defaultConfig { |
34 |
| - minSdkVersion safeExtGet('IntercomReactNative_minSdkVersion', 21) |
35 |
| - targetSdkVersion safeExtGet('IntercomReactNative_targetSdkVersion', 34) |
36 |
| - versionCode 1 |
37 |
| - versionName "1.0" |
38 |
| - buildConfigField 'String', 'INTERCOM_VERSION_NAME', packageVersion |
39 |
| - } |
| 40 | + defaultConfig { |
| 41 | + minSdkVersion rootProject.ext.minSdkVersion |
| 42 | + targetSdkVersion rootProject.ext.targetSdkVersion |
| 43 | + versionCode 1 |
| 44 | + versionName "1.0" |
| 45 | + buildConfigField 'String', 'INTERCOM_VERSION_NAME', packageVersion |
| 46 | + } |
40 | 47 |
|
41 |
| - buildTypes { |
42 |
| - release { |
43 |
| - minifyEnabled false |
44 |
| - } |
45 |
| - } |
46 |
| - lintOptions { |
47 |
| - disable 'GradleCompatible' |
48 |
| - } |
49 |
| - |
50 |
| - if (agpVersion < 8) { |
51 |
| - compileOptions { |
52 |
| - sourceCompatibility JavaVersion.VERSION_1_8 |
53 |
| - targetCompatibility JavaVersion.VERSION_1_8 |
54 |
| - } |
| 48 | + buildTypes { |
| 49 | + release { |
| 50 | + minifyEnabled false |
55 | 51 | }
|
| 52 | + } |
| 53 | + lintOptions { |
| 54 | + disable 'GradleCompatible' |
| 55 | + } |
56 | 56 | }
|
57 | 57 |
|
58 | 58 | repositories {
|
59 |
| - mavenCentral() |
60 |
| - mavenLocal() |
61 |
| - maven { |
62 |
| - // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm |
63 |
| - url("$rootDir/../node_modules/react-native/android") |
64 |
| - } |
65 |
| - google() |
| 59 | + mavenCentral() |
| 60 | + mavenLocal() |
| 61 | + maven { |
| 62 | + // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm |
| 63 | + url("$rootDir/../node_modules/react-native/android") |
| 64 | + } |
| 65 | + google() |
66 | 66 | }
|
67 | 67 |
|
68 | 68 | dependencies {
|
69 |
| - //noinspection GradleDynamicVersion |
70 |
| - implementation "com.facebook.react:react-native:+" // From node_modules |
71 |
| - implementation "com.google.firebase:firebase-messaging:${safeExtGet('firebaseMessagingVersion', '20.2.+')}" |
72 |
| - implementation 'io.intercom.android:intercom-sdk:15.9.+' |
| 69 | + //noinspection GradleDynamicVersion |
| 70 | + implementation "com.facebook.react:react-native:+" // From node_modules |
| 71 | + implementation "com.google.firebase:firebase-messaging:${safeExtGet('firebaseMessagingVersion', '20.2.+')}" |
| 72 | + implementation 'io.intercom.android:intercom-sdk:15.9.+' |
73 | 73 | }
|
0 commit comments