build.gradle

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