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