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