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