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