This repository was archived by the owner on Jan 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 393
/
Copy pathbuild.gradle
executable file
·324 lines (265 loc) · 11.4 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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
import com.android.build.OutputFile
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
apply plugin: 'kotlin-android-extensions'
buildscript {
repositories {
google()
maven {
url "https://plugins.gradle.org/m2/"
}
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:5.12.0"
}
}
kapt {
correctErrorTypes = true
}
// map for the version codes
// x86 must have greater values than arm, see https://software.intel.com/en-us/android/articles/google-play-supports-cpu-architecture-filtering-for-multiple-apk
// 64 bits have greater value than 32 bits
ext.abiVersionCodes = ["armeabi-v7a": 1, "arm64-v8a": 2, "x86": 3, "x86_64": 4].withDefault { 0 }
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "im.vector"
minSdkVersion 21
targetSdkVersion 28
// use the version code
versionCode 9907051
versionName "Mehr99-A"
// Keep abiFilter for the universalApk
ndk {
abiFilters "armeabi-v7a", "x86", 'arm64-v8a', 'x86_64'
}
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
// Ref: https://developer.android.com/studio/build/configure-apk-splits.html
splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true
// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for armeabi-v7a, x86, arm64-v8a and x86_64.
// Resets the list of ABIs that Gradle should create APKs for to none.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
// Generate a universal APK that includes all ABIs, so user who install from CI tool can use this one by default.
universalApk true
}
}
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def baseAbiVersionCode = project.ext.abiVersionCodes.get(output.getFilter(OutputFile.ABI))
output.versionCodeOverride = baseAbiVersionCode * 10_000_000 + variant.versionCode
}
}
dexOptions {
jumboMode true
javaMaxHeapSize "2g"
}
buildTypes {
debug {
resValue "bool", "debug_mode", "true"
resValue "string", "git_revision", "\"${gitRevision()}\""
resValue "string", "git_revision_date", "\"${gitRevisionDate()}\""
resValue "string", "git_branch_name", "\"${gitBranchName()}\""
resValue "string", "build_number", rootProject.ext.buildNumberProp
buildConfigField "boolean", "LOW_PRIVACY_LOG_ENABLE", "false"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
resValue "bool", "debug_mode", "false"
resValue "string", "git_revision", "\"${gitRevision()}\""
resValue "string", "git_revision_date", "\"${gitRevisionDate()}\""
resValue "string", "git_branch_name", "\"${gitBranchName()}\""
resValue "string", "build_number", rootProject.ext.buildNumberProp
buildConfigField "boolean", "LOW_PRIVACY_LOG_ENABLE", "false"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// Specifies a flavor dimension (no need to specify it in each productsFlavor, cause we only declare one dimension).
flavorDimensions "flavor_dimension_vector"
productFlavors {
app {
applicationId "im.vector.app"
// use the version name
versionCode rootProject.ext.versionCodeProp
versionName rootProject.ext.versionNameProp
buildConfigField "boolean", "IS_SABA", "false"
buildConfigField "boolean", "ALLOW_FCM_USE", "true"
buildConfigField "String", "SHORT_FLAVOR_DESCRIPTION", "\"G\""
buildConfigField "String", "FLAVOR_DESCRIPTION", "\"GooglePlay\""
}
appfdroid {
applicationId "im.vector.alpha"
// use the version name
versionCode rootProject.ext.versionCodeProp
versionName rootProject.ext.versionNameProp
buildConfigField "boolean", "IS_SABA", "false"
buildConfigField "boolean", "ALLOW_FCM_USE", "false"
buildConfigField "String", "SHORT_FLAVOR_DESCRIPTION", "\"F\""
buildConfigField "String", "FLAVOR_DESCRIPTION", "\"FDroid\""
}
saba {
applicationId "ir.batna.messaging"
versionCode 9905261
versionName "Mordad99-C"
buildConfigField "boolean", "IS_SABA", "true"
buildConfigField "boolean", "ALLOW_HOME_SERVER_CHANGE", "true"
buildConfigField "boolean", "ALLOW_FCM_USE", "false"
buildConfigField "String", "SHORT_FLAVOR_DESCRIPTION", "\"S\""
buildConfigField "String", "FLAVOR_DESCRIPTION", "\"Saba\""
}
}
lintOptions {
lintConfig file("lint.xml")
abortOnError false
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
apply plugin: 'org.jetbrains.kotlin.android.extensions'
androidExtensions {
experimental = true
}
static def gitRevision() {
def cmd = "git rev-parse --short HEAD"
return cmd.execute().text.trim()
}
static def gitRevisionDate() {
def cmd = "git show -s --format=%ci HEAD^{commit}"
return cmd.execute().text.trim()
}
static def gitBranchName() {
def cmd = "git name-rev --name-only HEAD"
return cmd.execute().text.trim()
}
dependencies {
compile 'uk.co.chrisjenx:calligraphy:2.3.0'
// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Kotlin KTX
implementation 'androidx.core:core-ktx:1.0.2'
// Kotlin coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1'
implementation "org.jetbrains.anko:anko-commons:0.10.8"
// Note: do not upgrade to 1.0.3 because it lead to crashes at startup on Android 16
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'me.leolin:ShortcutBadger:1.1.2@aar'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.preference:preference:1.0.0'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'com.jakewharton:butterknife:10.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
kapt 'com.jakewharton:butterknife-compiler:10.1.0'
// Work manager
// (Java only)
implementation "android.arch.work:work-runtime:1.0.1"
// Kotlin + coroutines
implementation "android.arch.work:work-runtime-ktx:1.0.1"
// UI
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'com.binaryfork:spanny:1.0.4'
implementation 'com.github.chrisbanes:PhotoView:2.1.4'
// Epoxy
implementation 'com.airbnb.android:epoxy:3.7.0'
implementation 'com.airbnb.android:mvrx:1.0.1'
kapt 'com.airbnb.android:epoxy-processor:3.7.0'
// Network
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation "com.google.code.gson:gson:$gson_version"
implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.12.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
implementation 'com.squareup.okio:okio:1.17.2'
// Use Glide library to display image (Gif supported)
implementation 'com.github.bumptech.glide:glide:4.9.0'
kapt 'com.github.bumptech.glide:compiler:4.9.0'
// Passphrase strength helper
implementation 'com.nulab-inc:zxcvbn:1.2.5'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.9.12'
//Alerter
implementation 'com.tapadoo.android:alerter:4.0.3'
/************* Matrix SDK management **************/
// update settings.gradle
// use the matrix SDK as external dependency
implementation 'com.github.matrix-org:matrix-android-sdk:v0.9.35'
// use the matrix SDK as a sub project
// you have to uncomment some lines in settings.gradle
//implementation project(':matrix-sdk')
//implementation project(':matrix-sdk-crypto')
//implementation project(':matrix-sdk-core')
/************* jitsi **************/
implementation('org.jitsi.react:jitsi-meet-sdk:2.2.2')
/************* analytics **************/
// another tracking than GA
implementation 'org.matomo.sdk:tracker:4.0.2'
/************* flavors management **************/
// app flavor only
appImplementation('com.google.firebase:firebase-messaging:20.0.0') {
exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'com.google.firebase', module: 'firebase-analytics'
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
}
// appfdroid flavor only
implementation 'io.sentry:sentry-android:2.0.2'
implementation 'org.slf4j:slf4j-nop:1.7.25'
// Test
testImplementation 'junit:junit:4.12' // Test
testImplementation 'androidx.test:runner:1.2.0'
testImplementation 'androidx.test:rules:1.2.0'
testImplementation 'org.mockito:mockito-core:2.23.0'
testImplementation 'junit:junit:4.12'
testImplementation 'org.hamcrest:hamcrest-library:1.3'
testImplementation 'org.apache.maven:maven-ant-tasks:2.1.3' // fixes issue on linux/mac
testImplementation "org.robolectric:robolectric:4.0.2"
// Robolectric
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
}
//Ensure we never move past okhttp 3.12.x
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.squareup.okhttp3' && details.requested.name == 'okhttp') {
details.useVersion '3.12.3'
details.because '3.13+ dropped support for android <5'
}
}
}
if (!getGradle().getStartParameter().getTaskRequests().toString().contains("fdroid")
&& !getGradle().getStartParameter().getTaskRequests().toString().contains("Saba")
&& !getGradle().getStartParameter().getTaskRequests().toString().contains("assembleAndroidTest")) {
apply plugin: 'com.google.gms.google-services'
}