-
Notifications
You must be signed in to change notification settings - Fork 12
/
configs.gradle
145 lines (117 loc) · 4.41 KB
/
configs.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
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
ant.condition(property: 'os', value: 'windows') {
os(family: 'windows')
}
ant.condition(property: 'os', value: 'unix') {
os(family: 'unix')
}
// Based on http://stackoverflow.com/questions/17097263#24121734
def getMasterCommitCount = { ->
try {
def stdout = new ByteArrayOutputStream()
exec {
switch (ant.properties.os) {
case 'windows':
commandLine 'cmd', '/c', 'git', 'rev-list', '--first-parent', '--count', 'master'
break
case 'unix':
commandLine 'git', 'rev-list', '--first-parent', '--count', 'origin/master'
break
}
standardOutput = stdout
}
return Integer.parseInt(stdout.toString().trim())
} catch (ignored) {
return -1
}
}
def getVersionName = { ->
try {
def stdout = new ByteArrayOutputStream()
exec {
switch (ant.properties.os) {
case 'windows':
commandLine 'cmd', '/c', 'git', 'describe', '--tags', '--dirty', '--always'
break
case 'unix':
commandLine 'git', 'describe', '--tags', '--dirty', '--always'
break
}
standardOutput = stdout
}
return stdout.toString().trim()
} catch (ignored) {
return null
}
}
ext.getMasterCommitCount = getMasterCommitCount
ext.getVersionName = getVersionName
// LOAD PROPERTIES FILE
Properties properties = new Properties()
String[] propertyKeys = ["cgr.username", "cgr.password", "cgr.url", "mapbox.sdk.token"]
if (project.rootProject.file("local.properties").exists()) {
properties.load(project.rootProject.file("local.properties").newDataInputStream())
if (properties != null) {
boolean containsAllKeys = true
ArrayList<String> missingKeys = new ArrayList<>()
for (String propertyKey: propertyKeys) {
if (!properties.containsKey(propertyKey)) {
missingKeys.add(propertyKey)
containsAllKeys = false
}
}
if (!containsAllKeys) {
println(("One of the required config variables is not set in your local.properties. Make sure you have " + missingKeys.join(", ")))
}
} else {
println("Properties was null!! The file does not exist or contains nothing")
}
} else {
println("local.properties does not exist")
}
if (properties == null) {
properties = new Properties()
}
for (String propertyKey: propertyKeys) {
if (!properties.containsKey(propertyKey)) {
properties.put(propertyKey, "\"\"")
}
}
ext.localProperties = properties
/**
Dependencies
*/
ext {
// Dependency and other versions
androidxTestCoreVersion = "1.4.0"
compileSdkVersion = 34
jacocoVersion = "0.8.11"
junitVersion = "4.13.2"
mapboxAnnotationPluginVersion = "0.9.0"
mapboxSdkVersion = "9.7.1"
mapboxSdkTurfVersion = "7.2.0"
robolectricVersion = "4.13"
supportVersion = "1.0.0"
volleyVersion = "1.2.1"
targetSdkVersion = 34
// Dependency names
androidxTestCore = "androidx.test:core:$androidxTestCoreVersion"
junit = "junit:junit:$junitVersion"
mapboxSDK = "com.mapbox.mapboxsdk:mapbox-android-sdk:$mapboxSdkVersion"
mapboxSDKTurf = "com.mapbox.mapboxsdk:mapbox-sdk-turf:$mapboxSdkTurfVersion"
mapboxAnnotationPlugin = "com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:$mapboxAnnotationPluginVersion"
robolectric = "org.robolectric:robolectric:$robolectricVersion"
}
ext.mapboxDependencies = { instance, configuration ->
configuration.implementation("com.mapbox.maps:android:$mapboxSdkVersion") {
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
configuration.implementation "com.mapbox.mapboxsdk:mapbox-sdk-turf:$instance.mapboxSdkTurfVersion"
configuration.implementation "com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v7:${instance.mapboxAnnotationPluginVersion}"
}
//ext.mapboxDependencies = mapboxDependencies