-
Notifications
You must be signed in to change notification settings - Fork 45
/
build.gradle
227 lines (202 loc) · 7.37 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
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
}
apply from: 'jacoco.gradle'
android {
compileSdk libs.versions.compileSdk.get().toInteger()
ndkVersion '22.0.7026061'
defaultConfig {
applicationId 'org.openobservatory.ooniprobe'
minSdk libs.versions.minSdk.get().toInteger()
targetSdk libs.versions.targetSdk.get().toInteger()
versionName '4.0.0'
versionCode 122
testInstrumentationRunner "org.openobservatory.ooniprobe.TestAndroidJUnitRunner"
buildConfigField 'String', 'OONI_API_BASE_URL', '"https://api.ooni.org"'
buildConfigField 'String', 'NOTIFICATION_SERVER', '"https://countly.ooni.io"'
buildConfigField 'String', 'OONI_RUN_DASHBOARD_URL', '"https://run.ooni.org"'
resValue "string", "APP_ID", 'org.openobservatory.ooniprobe'
resValue "string", "APP_NAME", "OONI Probe"
resValue "string", "RUN_V2_DOMAIN", "run.ooni.org"
buildConfigField 'String', 'SOFTWARE_NAME', 'BASE_SOFTWARE_NAME+IS_DEBUG'
buildConfigField 'String', 'COUNTLY_KEY', '"146836f41172f9e3287cab6f2cc347de3f5ddf3b"'
buildConfigField "boolean", "RUN_AUTOMATION", "false"
buildConfigField "boolean", "SHOW_DISABLED_CARDS", "true"
}
buildTypes {
debug {
buildConfigField 'String', 'IS_DEBUG', '"-debug"'
buildConfigField 'String', 'COUNTLY_KEY', '"e6c2cfe53e85951d50567467cef3f9fa2eab32c3"'
enableUnitTestCoverage true
enableAndroidTestCoverage true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField 'String', 'IS_DEBUG', '""'
}
}
testOptions {
animationsDisabled = true
unitTests {
includeAndroidResources = true
}
}
flavorDimensions = ['brand', 'testing', 'license']
productFlavors {
ooni {
getIsDefault().set(true)
dimension 'brand'
}
dw {
dimension 'brand'
applicationId 'com.dw.ooniprobe'
resValue "string", "APP_ID", 'com.dw.ooniprobe'
resValue "string", "APP_NAME", "News Media Scan"
buildConfigField 'String', 'BASE_SOFTWARE_NAME', '"news-media-scan-android"'
buildConfigField "boolean", "SHOW_DISABLED_CARDS", "false"
}
stable {
dimension 'testing'
buildConfigField 'String', 'BASE_SOFTWARE_NAME', '"ooniprobe-android"'
}
dev {
dimension 'testing'
applicationIdSuffix '.dev'
versionNameSuffix resolveVersionSuffix('beta')
versionCode resolveVersionCode()
buildConfigField 'String', 'BASE_SOFTWARE_NAME', '"ooniprobe-android-dev"'
resValue "string", "APP_NAME", "OONI Dev"
buildConfigField 'String', 'COUNTLY_KEY', '"e6c2cfe53e85951d50567467cef3f9fa2eab32c3"'
}
experimental {
dimension 'testing'
applicationIdSuffix '.experimental'
versionNameSuffix resolveVersionSuffix('experimental')
versionCode resolveVersionCode()
buildConfigField 'String', 'BASE_SOFTWARE_NAME', '"ooniprobe-android-experimental"'
resValue "string", "APP_NAME", "OONI Exp"
buildConfigField 'String', 'COUNTLY_KEY', '"e6c2cfe53e85951d50567467cef3f9fa2eab32c3"'
}
fdroid {
dimension 'license'
}
full {
dimension 'license'
}
}
bundle {
language {
enableSplit = false
}
}
applicationVariants.all { variant ->
variant.resValue "string", "APP_ID", "\"${applicationId}\""
}
variantFilter { variant ->
def names = variant.flavors*.name
if (names.contains("fdroid") && (names.contains("experimental") || names.contains("dev"))) {
setIgnore(true)
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
coreLibraryDesugaringEnabled = true
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
}
buildFeatures {
viewBinding = true
buildConfig = true
}
dataBinding {
enabled = true
enabledForTests = true
}
namespace 'org.openobservatory.ooniprobe'
}
dependencies {
implementation project(path: ':engine')
// Desugaring
coreLibraryDesugaring(libs.desugar.jdk.libs.nio)
// AndroidX
implementation libs.androidx.appcompat
implementation libs.androidx.constraintlayout
implementation libs.androidx.lifecycle.process
implementation libs.androidx.preference
implementation libs.androidx.localbroadcastmanager
implementation libs.androidx.legacy.support.v4
implementation libs.androidx.work.runtime
// Google
implementation libs.google.material
implementation libs.google.guava
implementation libs.google.gson
// Third-party
kapt libs.dbflow.processor
implementation libs.dbflow.core
implementation libs.dbflow.lib
implementation libs.retrofit.lib
implementation libs.retrofit.converter.gson
implementation libs.retrofit.logging.interceptor
implementation libs.xanscale.localhost.toolkit
implementation libs.lottie
implementation libs.markwon.core
implementation libs.commons.io
//arcview to fragment_dashboard
implementation libs.shapeofview
// Flavor
fullImplementation platform(libs.google.firebase.bom)
fullImplementation libs.google.firebase.messaging
fullImplementation libs.countly.sdk
fullImplementation libs.sentry.android
fullImplementation libs.google.play.appUpdate
// Dependency Injection
implementation libs.google.dagger.lib
kapt libs.google.dagger.compiler
// Logger
implementation project(':applogger')
// Testing
// Unit Testing
testImplementation project(':shared-test')
testImplementation libs.junit4
testImplementation libs.androidx.test.core
testImplementation libs.androidx.runner
testImplementation libs.androidx.rules
testImplementation libs.mockito.core
testImplementation libs.robolectric
testImplementation libs.faker
testImplementation libs.ooni.oonimkall
kaptTest libs.google.dagger.compiler
// Instrumentation Testing
androidTestImplementation project(':shared-test')
androidTestImplementation libs.fastlane.screengrab
androidTestImplementation libs.faker
androidTestImplementation libs.androidx.runner
androidTestImplementation libs.androidx.rules
androidTestImplementation libs.androidx.junit
androidTestImplementation libs.androidx.espresso.intents
androidTestImplementation libs.androidx.espresso.contrib
androidTestImplementation libs.androidx.espresso.core
androidTestImplementation libs.barista
kaptAndroidTest libs.google.dagger.compiler
}
static def resolveVersionCode() {
if(System.getenv("PR_NUMBER") != null) {
return System.getenv("PR_NUMBER").toInteger()
}
return new Date().format("yyyyMMdd").toInteger()
}
static def resolveVersionSuffix(String variant) {
if(System.getenv("PR_NUMBER") != null){
return "-${variant}.${System.getenv("PR_NUMBER")}"
}
return "-${variant}.1"
}
if (!getGradle().getStartParameter().getTaskRequests()
.toString().contains("Fdroid")){
apply plugin: 'com.google.gms.google-services'
}