-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathbuild.gradle
More file actions
190 lines (153 loc) · 6.71 KB
/
Copy pathbuild.gradle
File metadata and controls
190 lines (153 loc) · 6.71 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
apply plugin: 'com.android.library'
apply plugin: 'jacoco'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:10.18.0"
}
}
apply plugin: 'realm-android'
apply plugin: 'maven-publish'
version '0.10.8-SNAPSHOT'
project.version = this.version
jacoco {
toolVersion = jacocoVersion
}
android {
namespace "io.ona.kujaku"
compileSdk rootProject.ext.compileSdkVersion
buildFeatures {
buildConfig = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion 21
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName this.version
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
if (project.rootProject.file("local.properties").exists()) {
Properties properties = new Properties()
properties.load(project.rootProject.file("local.properties").newDataInputStream())
if (properties != null &&
properties.containsKey("mapbox.sdk.token")) {
buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", "\"" + localProperties["mapbox.sdk.token"] + "\""
} else {
println("One of the required config variables is not set in your local.properties")
buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", "\"sample_key\""
}
} else {
println("local.properties does not exist")
buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", "\"sample_key\""
}
}
debug {
// See bug https://github.com/vanniktech/gradle-android-junit-jacoco-plugin/issues/183
testCoverageEnabled true
if (project.rootProject.file("local.properties").exists()) {
Properties properties = new Properties()
properties.load(project.rootProject.file("local.properties").newDataInputStream())
if (properties != null &&
properties.containsKey("mapbox.sdk.token")) {
buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", "\"" + localProperties["mapbox.sdk.token"] + "\""
} else {
println("One of the required config variables is not set in your local.properties")
buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", "\"sample_key\""
}
} else {
println("local.properties does not exist")
buildConfigField "String", "MAPBOX_SDK_ACCESS_TOKEN", "\"sample_key\""
}
}
}
lintOptions {
abortOnError false
}
testOptions {
unitTests {
includeAndroidResources = true
}
/*unitTests.all {
systemProperty 'robolectric.dependency.repo.id', 'roboMaven'
systemProperty 'robolectric.dependency.repo.url', "https://repo1.maven.org/maven2"
}*/
}
}
dependencies { configuration ->
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation (mapboxSDK) {
transitive = true
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-fragment'
}
// The local build has an issue fetching this library for some reason which
// is a dependency of the mapbox-android-sdk. The mapbox-sdk-turf is declared as
// a runtime dependency
implementation mapboxSDKTurf
implementation mapboxAnnotationPlugin
// Comment the line below when creating releases - The line is for development of the library & utils
implementation (project(":utils")) {
// Uncomment the line below when creating releases
implementation('io.ona.kujaku:utils:0.10.8-SNAPSHOT') {
transitive = true
exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-sdk'
exclude group: 'com.android.support', module: 'support-v4'
}
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'org.simpleframework:simple-xml:2.7.1'
implementation 'com.jakewharton.threetenabp:threetenabp:1.1.1'
implementation 'com.jakewharton.timber:timber:5.0.1'
customDependencies(this, configuration)
appPermissionsDependencies(configuration)
infoWindowDependencies(this, configuration)
locationDependencies(configuration)
testDependencies(this, configuration)
}
private static void testDependencies(instance, configuration) {
configuration.testImplementation instance.junit
configuration.testImplementation instance.robolectric
configuration.testImplementation 'org.mockito:mockito-inline:5.2.0'
configuration.testImplementation instance.androidxTestCore
configuration.androidTestImplementation instance.junit
def mockitoVersion = '5.12.0'
configuration.androidTestImplementation "org.mockito:mockito-android:$mockitoVersion"
configuration.androidTestImplementation "org.mockito:mockito-core:$mockitoVersion"
configuration.androidTestImplementation ('com.android.support.test.espresso:espresso-core:3.6.1', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'net.sf.kxml', module: 'kxml2'
})
}
private static void infoWindowDependencies(instance, configuration) {
configuration.implementation "androidx.cardview:cardview:${instance.supportVersion}"
configuration.implementation "androidx.recyclerview:recyclerview:${instance.supportVersion}"
}
private static void customDependencies(instance, configuration) {
configuration.implementation 'com.cocoahero.android:geojson:1.0.1@jar'
configuration.implementation "com.android.volley:volley:${instance.volleyVersion}"
configuration.implementation 'com.snatik:storage:2.1.0'
}
private static void appPermissionsDependencies(configuration) {
configuration.implementation 'com.karumi:dexter:6.2.3'
}
private static void locationDependencies(configuration) {
configuration.implementation 'com.google.android.gms:play-services-location:21.2.0'
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}
// Add github packages, maven-central and sonatype publishing
apply from: '../publish.gradle'
apply from: '../jacoco-report.gradle'