1// Top-level build file where you can add configuration options common to all
  2// sub-projects/modules.
  3buildscript {
  4    repositories {
  5        google()
  6        mavenCentral()
  7    }
  8    dependencies {
  9        classpath 'com.android.tools.build:gradle:8.3.1'
 10    }
 11}
 12
 13plugins {
 14    id 'org.ajoberstar.grgit' version '4.1.1'
 15    // PLUGIN INSERT
 16}
 17
 18apply plugin: 'com.android.application'
 19
 20repositories {
 21    google()
 22    mavenCentral()
 23    maven { url='https://jitpack.io'}
 24}
 25
 26def tags = grgit.tag.list().findAll { it.dateTime != null }.sort { it.dateTime }
 27
 28// ROOT INSERT
 29
 30configurations {
 31    playstoreImplementation
 32    freeImplementation
 33    conversationsFreeImplementation
 34    cheogramPlaystoreImplementation
 35    conversationsPlaystoreImplementation
 36    quicksyPlaystoreImplementation
 37    quicksyPlaystoreImplementation
 38    quicksyFreeImplementation
 39    quicksyImplementation
 40}
 41
 42dependencies {
 43    androidTestImplementation 'tools.fastlane:screengrab:2.1.1'
 44    androidTestImplementation 'junit:junit:4.13.2'
 45    androidTestImplementation 'androidx.test:runner:1.3.0'
 46    androidTestImplementation 'androidx.test:rules:1.3.0'
 47    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
 48    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
 49
 50    implementation "androidx.core:core:1.10.1"
 51    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
 52
 53    implementation 'androidx.viewpager:viewpager:1.0.0'
 54
 55    playstoreImplementation('com.google.firebase:firebase-messaging:23.4.1') {
 56        exclude group: 'com.google.firebase', module: 'firebase-core'
 57        exclude group: 'com.google.firebase', module: 'firebase-analytics'
 58        exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
 59    }
 60    cheogramPlaystoreImplementation("com.android.installreferrer:installreferrer:2.2")
 61    cheogramPlaystoreImplementation 'com.github.singpolyma:play-licensing:1c637ea03c'
 62    conversationsPlaystoreImplementation("com.android.installreferrer:installreferrer:2.2")
 63    quicksyPlaystoreImplementation 'com.google.android.gms:play-services-auth-api-phone:18.0.2'
 64    implementation 'com.github.open-keychain.open-keychain:openpgp-api:v5.7.1'
 65    implementation("com.github.CanHub:Android-Image-Cropper:2.0.0")
 66    implementation 'androidx.appcompat:appcompat:1.6.1'
 67    implementation 'androidx.exifinterface:exifinterface:1.3.7'
 68    implementation 'androidx.cardview:cardview:1.0.0'
 69    implementation "androidx.preference:preference:1.2.1"
 70    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
 71    implementation 'com.google.android.material:material:1.11.0'
 72    implementation 'androidx.work:work-runtime:2.9.0'
 73
 74    implementation "androidx.emoji2:emoji2:1.4.0"
 75    freeImplementation "androidx.emoji2:emoji2-bundled:1.4.0"
 76
 77    implementation 'org.bouncycastle:bcmail-jdk15on:1.64'
 78    //zxing stopped supporting Java 7 so we have to stick with 3.3.3
 79    //https://github.com/zxing/zxing/issues/1170
 80    implementation 'com.google.zxing:core:3.3.3'
 81    implementation 'org.minidns:minidns-hla:1.0.5'
 82    implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
 83    implementation 'org.whispersystems:signal-protocol-java:2.6.2'
 84    implementation "com.wefika:flowlayout:0.4.1"
 85
 86    //noinspection GradleDependency
 87    implementation('com.github.natario1:Transcoder:v0.9.1') {
 88        exclude group: 'com.otaliastudios.opengl', module: 'egloo'
 89    }
 90    implementation 'com.github.natario1:Egloo:v0.4.0'
 91
 92    implementation 'org.jxmpp:jxmpp-jid:1.0.3'
 93    implementation 'org.jxmpp:jxmpp-stringprep-libidn:1.0.3'
 94    implementation 'org.osmdroid:osmdroid-android:6.1.11'
 95    implementation 'org.hsluv:hsluv:0.2'
 96    implementation 'org.conscrypt:conscrypt-android:2.5.2'
 97    implementation 'me.drakeet.support:toastcompat:1.1.0'
 98    implementation "com.leinardi.android:speed-dial:3.3.0"
 99
100    implementation "com.squareup.retrofit2:retrofit:2.9.0"
101    implementation "com.squareup.retrofit2:converter-gson:2.9.0"
102    implementation "com.squareup.okhttp3:okhttp:4.12.0"
103
104    implementation 'com.google.guava:guava:32.1.3-android'
105    implementation 'io.michaelrocks:libphonenumber-android:8.13.28'
106    implementation 'im.conversations.webrtc:webrtc-android:119.0.1'
107    implementation 'io.github.nishkarsh:android-permissions:2.1.6'
108    implementation 'androidx.recyclerview:recyclerview:1.1.0'
109    implementation 'androidx.documentfile:documentfile:1.0.1'
110    implementation 'androidx.browser:browser:1.8.0'
111    implementation 'com.github.martin-stone:hsv-alpha-color-picker-android:3.1.0'
112    implementation 'com.github.ipld:java-cid:v1.3.1'
113    //implementation 'com.splitwise:tokenautocomplete:3.0.2'
114    implementation 'com.github.singpolyma:TokenAutoComplete:bfa93780e0'
115    implementation 'com.github.singpolyma:Better-Link-Movement-Method:4df081e1e4'
116    implementation 'com.github.singpolyma:android-identicons:3361281bd4'
117    implementation 'com.github.woltapp:blurhash:master'
118    implementation 'com.caverock:androidsvg-aar:1.4'
119    implementation 'org.tomlj:tomlj:1.1.0'
120    implementation 'com.tbuonomo:dotsindicator:4.2'
121    implementation 'com.github.Priyansh-Kedia:OpenGraphParser:2.5.6'
122    implementation 'me.xdrop:fuzzywuzzy:1.4.0'
123    implementation 'net.fellbaum:jemoji:1.4.1'
124}
125
126ext {
127    preDexEnabled = System.getProperty("pre-dex", "true")
128    abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
129}
130
131android {
132    namespace 'eu.siacs.conversations'
133    compileSdk 34
134
135    defaultConfig {
136        minSdkVersion 23
137        targetSdkVersion 34
138        versionCode 42025 + tags.size()
139        versionName grgit.describe(always: true)
140        applicationId "eu.siacs.conversations"
141        def appName = "Conversations"
142        resValue "string", "app_name", appName
143        buildConfigField "String", "APP_NAME", "\"$appName\"";
144        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
145    }
146
147    splits {
148        abi {
149            universalApk true
150            enable true
151            reset()
152            //noinspection ChromeOsAbiSupport
153            include project.ext.abiCodes.keySet() as String[]
154        }
155    }
156
157    configurations {
158        implementation.exclude group: 'org.jetbrains' , module:'annotations'
159    }
160
161    dataBinding {
162        enabled true
163    }
164
165    compileOptions {
166        coreLibraryDesugaringEnabled true
167        sourceCompatibility JavaVersion.VERSION_17
168        targetCompatibility JavaVersion.VERSION_17
169    }
170
171    flavorDimensions += "mode"
172    flavorDimensions += "distribution"
173
174    productFlavors {
175
176        quicksy {
177            dimension "mode"
178            applicationId = "im.quicksy.client"
179
180            def appName = "Quicksy"
181            resValue "string", "app_name", appName
182            buildConfigField "String", "APP_NAME", "\"$appName\""
183            buildConfigField "String", "PRIVACY_POLICY", "\"https://quicksy.im/privacy.htm\""
184        }
185
186        conversations {
187            dimension "mode"
188            buildConfigField "String", "PRIVACY_POLICY", "\"https://conversations.im/privacy.html\""
189        }
190
191        cheogram {
192            dimension "mode"
193
194            applicationId = "com.cheogram.android"
195
196            def appName = "Cheogram"
197            resValue "string", "app_name", appName
198            buildConfigField "String", "APP_NAME", "\"$appName\"";
199            buildConfigField "String", "PRIVACY_POLICY", "\"https://cheogram.com/android-privacy.html\""
200        }
201
202        playstore {
203            dimension "distribution"
204            versionNameSuffix "+playstore"
205            applicationIdSuffix "playstore"
206        }
207        free {
208            dimension "distribution"
209            versionNameSuffix "+free"
210        }
211    }
212
213    applicationVariants.all { variant ->
214      variant.resValue "string", "applicationId", applicationId
215    }
216
217    sourceSets {
218        quicksyFree {
219            java {
220                srcDir 'src/quicksyFree/java'
221            }
222        }
223        quicksyPlaystore {
224            java {
225                srcDir 'src/quicksyPlaystore/java'
226            }
227            res {
228                srcDir 'src/quicksyPlaystore/res'
229            }
230        }
231        conversationsFree {
232            java {
233                srcDir 'src/conversationsFree/java'
234            }
235        }
236        cheogramFree {
237            java {
238                srcDir 'src/conversationsFree/java'
239            }
240        }
241        conversationsPlaystore {
242            java {
243                srcDir 'src/conversationsPlaystore/java'
244            }
245            res {
246                srcDir 'src/conversationsPlaystore/res'
247            }
248        }
249    }
250
251    buildTypes {
252        release {
253            shrinkResources true
254            minifyEnabled true
255            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
256            ndk.debugSymbolLevel = 'full'
257        }
258        debug {
259            shrinkResources true
260            minifyEnabled true
261            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
262        }
263    }
264
265
266    if (new File("signing.properties").exists()) {
267        Properties props = new Properties()
268        props.load(new FileInputStream(file("signing.properties")))
269
270        signingConfigs {
271            release {
272                storeFile file(props['keystore'])
273                storePassword props['keystore.password']
274                keyAlias props['keystore.alias']
275                keyPassword props['keystore.password']
276            }
277        }
278        buildTypes.release.signingConfig = signingConfigs.release
279    }
280
281    lintOptions {
282        disable 'MissingTranslation', 'InvalidPackage','AppCompatResource'
283        abortOnError false
284    }
285
286    subprojects {
287
288        afterEvaluate {
289            if (getPlugins().hasPlugin('android') ||
290                    getPlugins().hasPlugin('android-library')) {
291
292                configure(android.lintOptions) {
293                    disable 'AndroidGradlePluginVersion', 'MissingTranslation'
294                    abortOnError false
295                }
296            }
297
298        }
299    }
300    packagingOptions {
301        resources {
302            excludes += ['META-INF/BCKEY.DSA', 'META-INF/BCKEY.SF']
303        }
304    }
305    lint {
306        disable 'MissingTranslation', 'InvalidPackage', 'AppCompatResource'
307    }
308    buildFeatures {
309        buildConfig true
310    }
311
312    android.applicationVariants.configureEach { variant ->
313        variant.outputs.each { output ->
314            def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(com.android.build.OutputFile.ABI))
315            if (baseAbiVersionCode != null) {
316                output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + baseAbiVersionCode
317            } else {
318                output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + grgit.log(includes: ["HEAD"], excludes: [tags.last()]).size()
319            }
320        }
321
322    }
323}