-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
build.gradle
91 lines (81 loc) · 2.76 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import io.invertase.gradle.common.PackageJson
buildscript {
// The Android Gradle plugin is only required when opening the android folder stand-alone.
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
if (project == rootProject) {
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.0.4")
}
}
}
plugins {
id "io.invertase.gradle.build" version "1.5"
}
def appProject
if (findProject(':@react-native-firebase_app')) {
appProject = project(':@react-native-firebase_app')
} else if (findProject(':react-native-firebase_app')) {
appProject = project(':react-native-firebase_app')
} else {
throw new GradleException('Could not find the react-native-firebase/app package, have you installed it?')
}
def packageJson = PackageJson.getForProject(project)
def appPackageJson = PackageJson.getForProject(appProject)
def firebaseBomVersion = appPackageJson['sdkVersions']['android']['firebase']
def jsonMinSdk = appPackageJson['sdkVersions']['android']['minSdk']
def jsonTargetSdk = appPackageJson['sdkVersions']['android']['targetSdk']
def jsonCompileSdk = appPackageJson['sdkVersions']['android']['compileSdk']
def coreVersionDetected = appPackageJson['version']
def coreVersionRequired = packageJson['peerDependencies'][appPackageJson['name']]
// Only log after build completed so log warning appears at the end
if (coreVersionDetected != coreVersionRequired) {
gradle.buildFinished {
project.logger.warn("ReactNativeFirebase WARNING: NPM package '${packageJson['name']}' depends on '${appPackageJson['name']}' v${coreVersionRequired} but found v${coreVersionDetected}, this might cause build issues or runtime crashes.")
}
}
project.ext {
set('react-native', [
versions: [
android : [
minSdk : jsonMinSdk,
targetSdk : jsonTargetSdk,
compileSdk: jsonCompileSdk,
],
firebase: [
bom: firebaseBomVersion,
],
],
])
}
android {
defaultConfig {
multiDexEnabled true
}
lintOptions {
disable 'GradleCompatible'
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
google()
mavenCentral()
}
dependencies {
api appProject
implementation platform("com.google.firebase:firebase-bom:${ReactNative.ext.getVersion("firebase", "bom")}")
implementation "com.google.firebase:firebase-crashlytics"
implementation "com.google.firebase:firebase-crashlytics-ndk"
}
ReactNative.shared.applyPackageVersion()
ReactNative.shared.applyDefaultExcludes()
ReactNative.module.applyAndroidVersions()
ReactNative.module.applyReactNativeDependency("api")