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: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
 61    implementation "androidx.core:core:1.10.1"
 62    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
 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.1') {
 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.2.0'
 78    implementation 'com.github.open-keychain.open-keychain:openpgp-api:v5.7.1'
 79    implementation("com.vanniktech:android-image-cropper:4.6.0")
 80    implementation "androidx.sharetarget:sharetarget:1.2.0"
 81
 82    implementation 'androidx.appcompat:appcompat:1.7.0'
 83    implementation 'androidx.exifinterface:exifinterface:1.4.0'
 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.80'
 94    implementation 'org.bouncycastle:bcpg-jdk18on:1.80'
 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:33.4.0-android'
117    implementation 'io.michaelrocks:libphonenumber-android:8.13.52'
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    //Testing
140    testImplementation 'junit:junit:4.13.2'
141}
142
143ext {
144    preDexEnabled = System.getProperty("pre-dex", "true")
145    abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
146}
147
148android {
149    namespace 'eu.siacs.conversations'
150    compileSdk 34
151
152    defaultConfig {
153        minSdkVersion 23
154        targetSdkVersion 34
155        versionCode 42025 + tags.size()
156        versionName grgit.describe(always: true)
157        applicationId "eu.siacs.conversations"
158        def appName = "Conversations"
159        resValue "string", "app_name", appName
160        buildConfigField "String", "APP_NAME", "\"$appName\"";
161        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
162    }
163
164    splits {
165        abi {
166            universalApk true
167            enable true
168            reset()
169            //noinspection ChromeOsAbiSupport
170            include project.ext.abiCodes.keySet() as String[]
171        }
172    }
173
174    configurations {
175        implementation.exclude group: 'org.jetbrains' , module:'annotations'
176    }
177
178    dataBinding {
179        enabled true
180    }
181
182    compileOptions {
183        coreLibraryDesugaringEnabled true
184        sourceCompatibility JavaVersion.VERSION_17
185        targetCompatibility JavaVersion.VERSION_17
186    }
187
188    flavorDimensions += "mode"
189    flavorDimensions += "distribution"
190
191    productFlavors {
192
193        quicksy {
194            dimension "mode"
195            applicationId = "im.quicksy.client"
196
197            def appName = "Quicksy"
198            resValue "string", "app_name", appName
199            buildConfigField "String", "APP_NAME", "\"$appName\""
200            buildConfigField "String", "PRIVACY_POLICY", "\"https://quicksy.im/privacy.htm\""
201        }
202
203        conversations {
204            dimension "mode"
205            buildConfigField "String", "PRIVACY_POLICY", "\"https://conversations.im/privacy.html\""
206        }
207
208        cheogram {
209            dimension "mode"
210
211            applicationId = "com.cheogram.android"
212
213            def appName = "Cheogram"
214            resValue "string", "app_name", appName
215            buildConfigField "String", "APP_NAME", "\"$appName\"";
216            buildConfigField "String", "PRIVACY_POLICY", "\"https://cheogram.com/android-privacy.html\""
217        }
218
219        playstore {
220            dimension "distribution"
221            versionNameSuffix "+playstore"
222            applicationIdSuffix "playstore"
223        }
224        free {
225            dimension "distribution"
226            versionNameSuffix "+free"
227        }
228    }
229
230    applicationVariants.all { variant ->
231      variant.resValue "string", "applicationId", applicationId
232    }
233
234    sourceSets {
235        quicksyFree {
236            java {
237                srcDir 'src/quicksyFree/java'
238            }
239        }
240        quicksyPlaystore {
241            java {
242                srcDir 'src/quicksyPlaystore/java'
243            }
244            res {
245                srcDir 'src/quicksyPlaystore/res'
246            }
247        }
248        conversationsFree {
249            java {
250                srcDir 'src/conversationsFree/java'
251            }
252        }
253        cheogramFree {
254            java {
255                srcDir 'src/conversationsFree/java'
256            }
257        }
258        conversationsPlaystore {
259            java {
260                srcDir 'src/conversationsPlaystore/java'
261            }
262            res {
263                srcDir 'src/conversationsPlaystore/res'
264            }
265        }
266    }
267
268    buildTypes {
269        release {
270            shrinkResources true
271            minifyEnabled true
272            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
273            ndk.debugSymbolLevel = 'full'
274        }
275    }
276
277
278    if (new File("signing.properties").exists()) {
279        Properties props = new Properties()
280        props.load(new FileInputStream(file("signing.properties")))
281
282        signingConfigs {
283            release {
284                storeFile file(props['keystore'])
285                storePassword props['keystore.password']
286                keyAlias props['keystore.alias']
287                keyPassword props['keystore.password']
288            }
289        }
290        buildTypes.release.signingConfig = signingConfigs.release
291    }
292
293    lintOptions {
294        disable 'MissingTranslation', 'InvalidPackage','AppCompatResource'
295        abortOnError false
296    }
297
298    subprojects {
299
300        afterEvaluate {
301            if (getPlugins().hasPlugin('android') ||
302                    getPlugins().hasPlugin('android-library')) {
303
304                configure(android.lintOptions) {
305                    disable 'AndroidGradlePluginVersion', 'MissingTranslation'
306                    abortOnError false
307                }
308            }
309
310        }
311    }
312    packagingOptions {
313        resources {
314            excludes += ['META-INF/BCKEY.DSA', 'META-INF/BCKEY.SF', 'META-INF/versions/9/OSGI-INF/MANIFEST.MF']
315        }
316    }
317    lint {
318        disable 'MissingTranslation', 'InvalidPackage', 'AppCompatResource'
319    }
320    buildFeatures {
321        buildConfig true
322    }
323
324    android.applicationVariants.configureEach { variant ->
325        variant.outputs.each { output ->
326            def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(com.android.build.OutputFile.ABI))
327            if (baseAbiVersionCode != null) {
328                output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + baseAbiVersionCode
329            } else {
330                output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + 1
331            }
332        }
333
334    }
335}