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