-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathbuild.gradle
More file actions
139 lines (120 loc) · 3.42 KB
/
build.gradle
File metadata and controls
139 lines (120 loc) · 3.42 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
buildscript {
ext.kotlin_version = "2.1.0"
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.12.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id "org.sonarqube" version "4.4.1.3373"
id "org.jlleitschuh.gradle.ktlint" version "13.0.0"
}
sonarqube {
properties {
property "sonar.projectKey", "react-native-mparticle"
property "sonar.organization", "mparticle"
property "sonar.host.url", "https://sonarcloud.io"
}
}
def isNewArchitectureEnabled() {
// React Native 0.80+ uses this standard detection approach
return project.hasProperty("newArchEnabled") && project.newArchEnabled.toBoolean()
}
def supportsNamespace() {
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
def major = parsed[0].toInteger()
def minor = parsed[1].toInteger()
// Namespace support was added in 7.3.0
if (major == 7 && minor >= 3) {
return true
}
return major >= 8
}
apply plugin: 'org.jlleitschuh.gradle.ktlint'
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
if (isNewArchitectureEnabled()) {
apply plugin: 'com.facebook.react'
}
android {
if (supportsNamespace()) {
namespace 'com.mparticle.react'
buildFeatures {
buildConfig = true
}
sourceSets {
main {
manifest.srcFile "src/main/AndroidManifestNew.xml"
}
}
}
compileSdkVersion 33
defaultConfig {
minSdkVersion 21
targetSdkVersion 33
versionCode 2
versionName "2.0.0"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
}
sourceSets {
main {
if (isNewArchitectureEnabled()) {
java.srcDirs += ['src/newarch/java']
} else {
java.srcDirs += ['src/oldarch/java']
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
buildTypes {
release {
minifyEnabled false
}
}
adbOptions {
timeOutInMs 10 * 60 * 1000
installOptions "-d","-t"
}
}
repositories {
mavenCentral()
google()
}
ktlint {
outputToConsole = true
verbose = true
}
dependencies {
api 'com.facebook.react:react-android:+'
//
// In your app, you should include mParticle core like this:
//
// compile 'com.mparticle:android-core:REPLACEME'
//
// (See https://github.com/mparticle/mparticle-android-sdk for the latest version)
//
api 'com.mparticle:android-core:[5.9.3, )'
//
// And, if you want to include kits, you can do so as follows:
//
// compile 'com.mparticle:android-example-kit:REPLACEME'
//
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.6.1"
testImplementation 'org.mockito:mockito-core:5.8.0'
androidTestImplementation 'org.mockito:mockito-android:5.8.0'
testImplementation 'androidx.annotation:annotation:1.7.1'
testImplementation 'junit:junit:4.13.2'
testImplementation files('libs/java-json.jar')
testImplementation 'com.mparticle:android-core:5+'
testImplementation("com.facebook.react:react-android:+")
}