-
Notifications
You must be signed in to change notification settings - Fork 701
/
build.gradle
70 lines (64 loc) · 2.05 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
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
buildscript {
ext.isNewArchitectureEnabled = { _ ->
project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}
// buildscript dependencies are only required when working with the module in isolation (e.g.
// during development and for testing). 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.2.1'
if (isNewArchitectureEnabled()) {
classpath 'com.facebook.react:react-native-gradle-plugin'
}
}
}
}
apply plugin: 'com.android.library'
if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}
android {
compileSdkVersion safeExtGet('compileSdkVersion', 31).toInteger()
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 21)
targetSdkVersion safeExtGet('targetSdkVersion', 31)
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
}
sourceSets {
main {
if (isNewArchitectureEnabled()) {
java.srcDirs += ['src/newarch/java']
} else {
java.srcDirs += ['src/oldarch/java']
}
}
}
lintOptions {
abortOnError false
}
}
repositories {
mavenLocal()
mavenCentral()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
// Android JSC is installed from npm
url "$rootDir/../node_modules/jsc-android/dist"
}
google()
}
dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+' // From node_modules
}