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