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.9.3'
 10        classpath "com.diffplug.spotless:spotless-plugin-gradle:7.0.2"
 11    }
 12}
 13
 14apply plugin: 'com.android.application'
 15apply plugin: "com.diffplug.spotless"
 16
 17repositories {
 18    google()
 19    mavenCentral()
 20    maven { url='https://jitpack.io'}
 21}
 22
 23configurations {
 24    playstoreImplementation
 25    freeImplementation
 26    conversationsFreeImplementation
 27    conversationsPlaystorImplementation
 28    conversationsPlaystoreImplementation
 29    quicksyPlaystoreImplementation
 30    quicksyPlaystoreImplementation
 31    quicksyFreeImplementation
 32    quicksyImplementation
 33}
 34
 35spotless {
 36    ratchetFrom '2.17.4'
 37    java {
 38        target '**/*.java'
 39        googleJavaFormat().aosp().reflowLongStrings()
 40    }
 41}
 42
 43
 44dependencies {
 45    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
 46
 47    annotationProcessor project(':libs:annotation-processor')
 48    implementation project(':libs:annotation')
 49    implementation 'androidx.appcompat:appcompat:1.7.0'
 50    implementation 'androidx.cardview:cardview:1.0.0'
 51    implementation 'androidx.emoji2:emoji2:1.5.0'
 52    freeImplementation 'androidx.emoji2:emoji2-bundled:1.5.0'
 53    implementation 'androidx.emoji2:emoji2-emojipicker:1.5.0'
 54    implementation 'androidx.exifinterface:exifinterface:1.4.1'
 55    implementation 'androidx.heifwriter:heifwriter:1.1.0-beta01'
 56    implementation 'androidx.preference:preference:1.2.1'
 57    implementation 'androidx.sharetarget:sharetarget:1.2.0'
 58    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
 59    implementation 'androidx.viewpager:viewpager:1.1.0'
 60    implementation 'androidx.work:work-runtime:2.10.1'
 61    implementation 'com.github.open-keychain.open-keychain:openpgp-api:v5.7.1'
 62    implementation 'com.google.android.material:material:1.13.0-alpha13'
 63    implementation 'com.google.guava:guava:33.4.6-android'
 64    implementation 'com.google.zxing:core:3.5.3'
 65    implementation 'com.leinardi.android:speed-dial:3.3.0'
 66    implementation 'com.makeramen:roundedimageview:2.3.0'
 67    implementation 'com.squareup.okhttp3:okhttp:4.12.0'
 68    implementation 'com.squareup.retrofit2:converter-gson:2.11.0'
 69    implementation 'com.squareup.retrofit2:retrofit:2.11.0'
 70    implementation 'com.vanniktech:android-image-cropper:4.6.0'
 71    implementation 'im.conversations.webrtc:webrtc-android:129.0.0'
 72    implementation 'io.deepmedia.community:transcoder-android:0.11.2'
 73    implementation 'me.drakeet.support:toastcompat:1.1.0'
 74    implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
 75    implementation 'org.bouncycastle:bcmail-jdk18on:1.80'
 76    implementation 'org.conscrypt:conscrypt-android:2.5.2'
 77    implementation 'org.hsluv:hsluv:0.2'
 78    implementation 'org.jxmpp:jxmpp-jid:1.0.3'
 79    implementation 'org.jxmpp:jxmpp-stringprep-libidn:1.0.3'
 80    implementation 'org.minidns:minidns-client:1.0.4'
 81    implementation 'org.minidns:minidns-dnssec:1.0.4'
 82    implementation 'org.osmdroid:osmdroid-android:6.1.20'
 83    implementation 'org.whispersystems:signal-protocol-java:2.6.2'
 84    conversationsPlaystoreImplementation 'com.android.installreferrer:installreferrer:2.2'
 85    playstoreImplementation('com.google.firebase:firebase-messaging:24.1.1') {
 86        exclude group: 'com.google.firebase', module: 'firebase-core'
 87        exclude group: 'com.google.firebase', module: 'firebase-analytics'
 88        exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
 89
 90    }
 91    quicksyImplementation 'io.michaelrocks:libphonenumber-android:8.13.52'
 92    quicksyPlaystoreImplementation 'com.google.android.gms:play-services-auth-api-phone:18.2.0'
 93
 94    testImplementation 'junit:junit:4.13.2'
 95    testImplementation 'org.robolectric:robolectric:4.14.1'
 96    androidTestImplementation 'androidx.test.ext:junit:1.2.1'
 97
 98}
 99
100ext {
101    preDexEnabled = System.getProperty("pre-dex", "true")
102    abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
103}
104
105android {
106    namespace 'eu.siacs.conversations'
107    compileSdk 35
108
109    defaultConfig {
110        minSdkVersion 23
111        targetSdkVersion 35
112        versionCode 42143
113        versionName "2.19.0-beta"
114        archivesBaseName += "-$versionName"
115        applicationId "eu.siacs.conversations"
116        resValue "string", "applicationId", applicationId
117        def appName = "Conversations"
118        resValue "string", "app_name", appName
119        buildConfigField "String", "APP_NAME", "\"$appName\""
120    }
121
122    splits {
123        abi {
124            universalApk true
125            enable true
126            reset()
127            //noinspection ChromeOsAbiSupport
128            include project.ext.abiCodes.keySet() as String[]
129        }
130    }
131
132    configurations {
133        implementation.exclude group: 'org.jetbrains' , module:'annotations'
134    }
135
136    dataBinding {
137        enabled true
138    }
139
140    compileOptions {
141        coreLibraryDesugaringEnabled true
142        sourceCompatibility JavaVersion.VERSION_17
143        targetCompatibility JavaVersion.VERSION_17
144    }
145
146    flavorDimensions += "mode"
147    flavorDimensions += "distribution"
148
149    productFlavors {
150
151        quicksy {
152            dimension "mode"
153            applicationId = "im.quicksy.client"
154            resValue "string", "applicationId", applicationId
155
156            def appName = "Quicksy"
157            resValue "string", "app_name", appName
158            buildConfigField "String", "APP_NAME", "\"$appName\""
159            buildConfigField "String", "PRIVACY_POLICY", "\"https://quicksy.im/privacy.htm\""
160        }
161
162        conversations {
163            dimension "mode"
164            buildConfigField "String", "PRIVACY_POLICY", "\"https://conversations.im/privacy.html\""
165        }
166
167        playstore {
168            dimension "distribution"
169            versionNameSuffix "+playstore"
170        }
171        free {
172            dimension "distribution"
173            versionNameSuffix "+free"
174        }
175    }
176
177    sourceSets {
178        quicksyFree {
179            java {
180                srcDir 'src/quicksyFree/java'
181            }
182        }
183        quicksyPlaystore {
184            java {
185                srcDir 'src/quicksyPlaystore/java'
186            }
187            res {
188                srcDir 'src/quicksyPlaystore/res'
189            }
190        }
191        conversationsFree {
192            java {
193                srcDir 'src/conversationsFree/java'
194            }
195        }
196        conversationsPlaystore {
197            java {
198                srcDir 'src/conversationsPlaystore/java'
199            }
200            res {
201                srcDir 'src/conversationsPlaystore/res'
202            }
203        }
204    }
205
206    buildTypes {
207        release {
208            shrinkResources true
209            minifyEnabled true
210            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
211        }
212    }
213
214
215    if (new File("signing.properties").exists()) {
216        Properties props = new Properties()
217        props.load(new FileInputStream(file("signing.properties")))
218
219        signingConfigs {
220            release {
221                storeFile file(props['keystore'])
222                storePassword props['keystore.password']
223                keyAlias props['keystore.alias']
224                keyPassword props['keystore.password']
225            }
226        }
227        buildTypes.release.signingConfig = signingConfigs.release
228    }
229
230
231    subprojects {
232
233        afterEvaluate {
234            if (getPlugins().hasPlugin('android') ||
235                    getPlugins().hasPlugin('android-library')) {
236
237                configure(android.lintOptions) {
238                    disable 'AndroidGradlePluginVersion', 'MissingTranslation'
239                }
240            }
241
242        }
243    }
244    packagingOptions {
245        resources {
246            excludes += ['META-INF/BCKEY.DSA', 'META-INF/BCKEY.SF', 'META-INF/versions/9/OSGI-INF/MANIFEST.MF']
247        }
248    }
249    lint {
250        disable 'MissingTranslation', 'InvalidPackage', 'AppCompatResource'
251    }
252    buildFeatures {
253        buildConfig true
254    }
255
256    android.applicationVariants.configureEach { variant ->
257        variant.outputs.each { output ->
258            def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(com.android.build.OutputFile.ABI))
259            if (baseAbiVersionCode != null) {
260                output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + baseAbiVersionCode
261            } else {
262                output.versionCodeOverride = 100 * project.android.defaultConfig.versionCode
263            }
264        }
265
266    }
267}