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    testImplementation 'org.robolectric:robolectric:4.14.1'
 95    androidTestImplementation 'androidx.test.ext:junit:1.2.1'
 96
 97}
 98
 99ext {
100    preDexEnabled = System.getProperty("pre-dex", "true")
101    abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
102}
103
104android {
105    namespace 'eu.siacs.conversations'
106    compileSdk 35
107
108    defaultConfig {
109        minSdkVersion 23
110        targetSdkVersion 35
111        versionCode 42142
112        versionName "2.18.2"
113        archivesBaseName += "-$versionName"
114        applicationId "eu.siacs.conversations"
115        resValue "string", "applicationId", applicationId
116        def appName = "Conversations"
117        resValue "string", "app_name", appName
118        buildConfigField "String", "APP_NAME", "\"$appName\""
119    }
120
121    splits {
122        abi {
123            universalApk true
124            enable true
125            reset()
126            //noinspection ChromeOsAbiSupport
127            include project.ext.abiCodes.keySet() as String[]
128        }
129    }
130
131    configurations {
132        implementation.exclude group: 'org.jetbrains' , module:'annotations'
133    }
134
135    dataBinding {
136        enabled true
137    }
138
139    compileOptions {
140        coreLibraryDesugaringEnabled true
141        sourceCompatibility JavaVersion.VERSION_17
142        targetCompatibility JavaVersion.VERSION_17
143    }
144
145    flavorDimensions += "mode"
146    flavorDimensions += "distribution"
147
148    productFlavors {
149
150        quicksy {
151            dimension "mode"
152            applicationId = "im.quicksy.client"
153            resValue "string", "applicationId", applicationId
154
155            def appName = "Quicksy"
156            resValue "string", "app_name", appName
157            buildConfigField "String", "APP_NAME", "\"$appName\""
158            buildConfigField "String", "PRIVACY_POLICY", "\"https://quicksy.im/privacy.htm\""
159        }
160
161        conversations {
162            dimension "mode"
163            buildConfigField "String", "PRIVACY_POLICY", "\"https://conversations.im/privacy.html\""
164        }
165
166        playstore {
167            dimension "distribution"
168            versionNameSuffix "+playstore"
169        }
170        free {
171            dimension "distribution"
172            versionNameSuffix "+free"
173        }
174    }
175
176    sourceSets {
177        quicksyFree {
178            java {
179                srcDir 'src/quicksyFree/java'
180            }
181        }
182        quicksyPlaystore {
183            java {
184                srcDir 'src/quicksyPlaystore/java'
185            }
186            res {
187                srcDir 'src/quicksyPlaystore/res'
188            }
189        }
190        conversationsFree {
191            java {
192                srcDir 'src/conversationsFree/java'
193            }
194        }
195        conversationsPlaystore {
196            java {
197                srcDir 'src/conversationsPlaystore/java'
198            }
199            res {
200                srcDir 'src/conversationsPlaystore/res'
201            }
202        }
203    }
204
205    buildTypes {
206        release {
207            shrinkResources true
208            minifyEnabled true
209            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
210        }
211    }
212
213
214    if (new File("signing.properties").exists()) {
215        Properties props = new Properties()
216        props.load(new FileInputStream(file("signing.properties")))
217
218        signingConfigs {
219            release {
220                storeFile file(props['keystore'])
221                storePassword props['keystore.password']
222                keyAlias props['keystore.alias']
223                keyPassword props['keystore.password']
224            }
225        }
226        buildTypes.release.signingConfig = signingConfigs.release
227    }
228
229
230    subprojects {
231
232        afterEvaluate {
233            if (getPlugins().hasPlugin('android') ||
234                    getPlugins().hasPlugin('android-library')) {
235
236                configure(android.lintOptions) {
237                    disable 'AndroidGradlePluginVersion', 'MissingTranslation'
238                }
239            }
240
241        }
242    }
243    packagingOptions {
244        resources {
245            excludes += ['META-INF/BCKEY.DSA', 'META-INF/BCKEY.SF', 'META-INF/versions/9/OSGI-INF/MANIFEST.MF']
246        }
247    }
248    lint {
249        disable 'MissingTranslation', 'InvalidPackage', 'AppCompatResource'
250    }
251    buildFeatures {
252        buildConfig true
253    }
254
255    android.applicationVariants.configureEach { variant ->
256        variant.outputs.each { output ->
257            def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(com.android.build.OutputFile.ABI))
258            if (baseAbiVersionCode != null) {
259                output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + baseAbiVersionCode
260            } else {
261                output.versionCodeOverride = 100 * project.android.defaultConfig.versionCode
262            }
263        }
264
265    }
266}