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