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