forked from deltachat/deltachat-android
-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
293 lines (256 loc) · 11.8 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
plugins {
id 'com.android.application' version '8.1.4'
id 'com.google.gms.google-services' version '4.4.1'
}
repositories {
google()
mavenCentral()
maven {
url "https://www.jitpack.io"
name 'JitPack Github wrapper'
}
}
android {
dependenciesInfo {
// Disables dependency metadata when building APKs.
includeInApk = false
// Disables dependency metadata when building Android App Bundles.
includeInBundle = false
}
namespace "org.thoughtcrime.securesms"
flavorDimensions "none"
compileSdk 34
// Set NDK version to strip native libraries.
// Even though we compile our libraries outside Gradle with `scripts/ndk-make.sh`,
// without ndkVersion `./gradlew clean` followed by `./gradlew assembleDebug --warning-mode=all` emits the following warning:
// > Task :stripFatDebugDebugSymbols
// Unable to strip the following libraries, packaging them as they are: libanimation-decoder-gif.so, libnative-utils.so.
// See <https://issuetracker.google.com/issues/237187538> for details.
ndkVersion "27.0.12077973"
useLibrary 'org.apache.http.legacy'
defaultConfig {
versionCode 30000700
versionName "1.50.4"
applicationId "chat.delta.lite"
multiDexEnabled true
minSdkVersion 21
targetSdkVersion 34
vectorDrawables.useSupportLibrary = true
// base name of the generated apk
project.ext.set("archivesBaseName", "deltachat");
buildConfigField "boolean", "DEV_BUILD", "false"
ndk {
if(project.hasProperty("ABI_FILTER")) {
abiFilters ABI_FILTER
} else {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "TEST_ADDR", buildConfigProperty("TEST_ADDR"))
buildConfigField("String", "TEST_MAIL_PW", buildConfigProperty("TEST_MAIL_PW"))
buildConfigField("String", "NDK_ARCH", getNdkArch())
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
jniLibs {
doNotStrip '**/*.so'
keepDebugSymbols += ['*/mips/*.so', '*/mips64/*.so']
}
resources {
excludes += ['LICENSE.txt', 'LICENSE', 'NOTICE', 'asm-license.txt', 'META-INF/LICENSE', 'META-INF/NOTICE']
}
}
signingConfigs {
debug {
// add `DC_DEBUG_STORE_FILE=/path/to/debug.keystore` to `~/.gradle/gradle.properties`
if(project.hasProperty("DC_DEBUG_STORE_FILE" )) {
storeFile file(DC_DEBUG_STORE_FILE )
}
}
release {
// can be defined at `~/.gradle/gradle.properties` or at "Build/Generate signed APK"
if(project.hasProperty("DC_RELEASE_STORE_FILE")) {
storeFile file(DC_RELEASE_STORE_FILE)
storePassword DC_RELEASE_STORE_PASSWORD
keyAlias DC_RELEASE_KEY_ALIAS
keyPassword DC_RELEASE_KEY_PASSWORD
}
}
}
buildTypes {
debug {
minifyEnabled false
applicationIdSuffix ".beta"
}
release {
// minification and proguard disabled for now.
//
// when enabled, it can cut down apk size about 6%,
// however this also has the potential to break things.
// so exceptions are needed and have to be maintained.
// (see git-history and https://github.com/deltachat/deltachat-android/issues/905 )
//
// nb: it is highly recommended to use the same settings in debug+release -
// otherwise problems might be noticed delayed only
minifyEnabled true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
productFlavors {
foss {
dimension "none"
buildConfigField "boolean", "USE_PLAY_SERVICES", "false"
}
gplay {
dimension "none"
apply plugin: "com.google.gms.google-services"
buildConfigField "boolean", "USE_PLAY_SERVICES", "true"
}
}
if(!project.hasProperty("ABI_FILTER")) {
splits {
abi {
enable true
reset()
include "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
universalApk true
}
}
}
project.ext.versionCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2, 'x86': 3, 'x86_64': 4]
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
output.outputFileName = output.outputFileName
.replace("android", "ArcaneChat")
.replace("-release", "")
.replace(".apk", "-${variant.versionName}.apk")
if(project.hasProperty("ABI_FILTER")) {
output.versionCodeOverride =
variant.versionCode * 10 + project.ext.versionCodes.get(ABI_FILTER)
} else {
output.versionCodeOverride =
variant.versionCode * 10 + project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 4)
}
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
androidResources {
generateLocaleConfig true
}
lint {
abortOnError false
}
buildFeatures {
renderScript true
aidl true
}
}
final def markwon_version = '4.6.2'
dependencies {
// ArcaneChat-only dependencies:
implementation "io.noties.markwon:core:$markwon_version"
implementation "io.noties.markwon:ext-strikethrough:$markwon_version"
implementation "io.noties.markwon:inline-parser:$markwon_version"
implementation 'com.airbnb.android:lottie:4.2.2' // Lottie animations support.
implementation 'androidx.sharetarget:sharetarget:1.2.0'
implementation 'androidx.webkit:webkit:1.11.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation ('androidx.preference:preference:1.2.1') {
exclude group: 'androidx.lifecycle', module:'lifecycle-viewmodel'
exclude group: 'androidx.lifecycle', module:'lifecycle-viewmodel-ktx'
}
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.3.7'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.6.2'
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.6.2'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2'
implementation 'androidx.work:work-runtime:2.9.1'
implementation 'androidx.emoji2:emoji2-emojipicker:1.5.0'
implementation 'com.google.guava:guava:31.1-android'
implementation 'com.google.android.exoplayer:exoplayer-core:2.19.1' // plays video and audio
implementation 'com.google.android.exoplayer:exoplayer-ui:2.19.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.zxing:core:3.3.0' // fixed version to support SDK<24
implementation ('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false } // QR Code scanner
implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.1' // used as JSON library
implementation 'com.google.code.gson:gson:2.9.1' // used as JSON library. Don't upgrade to 2.10.1: https://github.com/deltachat/deltachat-android/pull/2610
implementation "me.leolin:ShortcutBadger:1.1.16" // display messagecount on the home screen icon.
implementation 'com.jpardogo.materialtabstrip:library:1.0.9' // used in the emoji selector for the tab selection.
implementation 'com.github.chrisbanes:PhotoView:2.1.3' // does the zooming on photos / media
implementation 'com.github.penfeizhou.android.animation:glide-plugin:2.25.0' // APNG & animated webp support.
implementation 'com.caverock:androidsvg-aar:1.4' // SVG support.
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
annotationProcessor 'androidx.annotation:annotation:1.8.2'
implementation 'com.makeramen:roundedimageview:2.1.0' // crops the avatars to circles
implementation 'com.pnikosis:materialish-progress:1.5' // used only in the "Progress Wheel" in Share Activity.
implementation 'com.soundcloud.android:android-crop:1.0.1@aar' // used for profile and group avatar selection in Android SDK<19
implementation 'com.github.amulyakhare:TextDrawable:558677ea31' // number of unread messages,
// the one-letter circle for the contacts (when there is not avatar) and a white background.
implementation 'com.googlecode.mp4parser:isoparser:1.0.6' // MP4 recoding; upgrading eg. to 1.1.22 breaks recoding, however, i have not investigated further, just reset to 1.0.6
implementation ('com.davemorrissey.labs:subsampling-scale-image-view:3.6.0') { // for the zooming on photos / media
exclude group: 'com.android.support', module: 'support-annotations'
}
implementation 'com.annimon:stream:1.1.8' // brings future java streams api to SDK Version < 24
implementation 'com.getkeepsafe.relinker:relinker:1.4.4' // needed to avoid safe-content-resolver-v14 trying to fetch older non-existing version
// Replacement for ContentResolver
// that protects against the Surreptitious Sharing attack.
// <https://github.com/cketti/SafeContentResolver>
implementation 'de.cketti.safecontentresolver:safe-content-resolver-v14:1.0.0'
gplayImplementation('com.google.firebase:firebase-messaging:24.0.0') { // for PUSH notifications
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'
}
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.assertj:assertj-core:1.7.1'
testImplementation 'org.mockito:mockito-core:1.9.5'
testImplementation 'org.powermock:powermock-api-mockito:1.6.1'
testImplementation 'org.powermock:powermock-module-junit4:1.6.1'
testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.1'
testImplementation 'org.powermock:powermock-classloading-xstream:1.6.1'
androidTestImplementation 'androidx.test:runner:1.6.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.6.1'
androidTestImplementation 'androidx.test:rules:1.6.1'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation ('org.assertj:assertj-core:1.7.1') {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
}
String buildConfigProperty(String name) {
return "\"${propertyOrEmpty(name)}\""
}
String propertyOrEmpty(String name) {
Object p = findProperty(name)
if (p == null) return environmentVariable(name)
return (String) p
}
static String environmentVariable(String name) {
String env = System.getenv(name)
if (env == null) return ""
return env
}
String getNdkArch() {
Properties properties = new Properties()
def file = project.rootProject.file('ndkArch')
if (!file.exists()) return "\"\""
properties.load(file.newDataInputStream())
def arch = properties.getProperty('NDK_ARCH')
if (arch == null) return "\"\""
return "\"$arch\""
}