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