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
 13plugins {
 14    id 'org.ajoberstar.grgit' version '4.1.1'
 15    // PLUGIN INSERT
 16}
 17
 18apply plugin: 'com.android.application'
 19
 20repositories {
 21    google()
 22    mavenCentral()
 23    maven { url='https://jitpack.io'}
 24}
 25
 26def tags = grgit.tag.list().findAll { it.dateTime != null }.sort { it.dateTime }
 27
 28// ROOT INSERT
 29
 30configurations {
 31    playstoreImplementation
 32    freeImplementation
 33    conversationsFreeImplementation
 34    cheogramPlaystoreImplementation
 35    conversationsPlaystoreImplementation
 36    quicksyPlaystoreImplementation
 37    quicksyPlaystoreImplementation
 38    quicksyFreeImplementation
 39    quicksyImplementation
 40}
 41
 42dependencies {
 43    androidTestImplementation 'tools.fastlane:screengrab:2.1.1'
 44    androidTestImplementation 'junit:junit:4.13.2'
 45    androidTestImplementation 'androidx.test:runner:1.3.0'
 46    androidTestImplementation 'androidx.test:rules:1.3.0'
 47    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
 48    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
 49
 50    implementation "androidx.core:core:1.10.1"
 51    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
 52
 53    implementation 'androidx.viewpager:viewpager:1.0.0'
 54
 55    playstoreImplementation('com.google.firebase:firebase-messaging:23.4.1') {
 56        exclude group: 'com.google.firebase', module: 'firebase-core'
 57        exclude group: 'com.google.firebase', module: 'firebase-analytics'
 58        exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
 59    }
 60    cheogramPlaystoreImplementation("com.android.installreferrer:installreferrer:2.2")
 61    cheogramPlaystoreImplementation 'com.github.singpolyma:play-licensing:1c637ea03c'
 62    conversationsPlaystoreImplementation("com.android.installreferrer:installreferrer:2.2")
 63    quicksyPlaystoreImplementation 'com.google.android.gms:play-services-auth-api-phone:18.0.2'
 64    implementation 'com.github.open-keychain.open-keychain:openpgp-api:v5.7.1'
 65    implementation("com.github.CanHub:Android-Image-Cropper:2.0.0")
 66    implementation 'androidx.appcompat:appcompat:1.6.1'
 67    implementation 'androidx.exifinterface:exifinterface:1.3.7'
 68    implementation 'androidx.cardview:cardview:1.0.0'
 69    implementation "androidx.preference:preference:1.2.1"
 70    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
 71    implementation 'com.google.android.material:material:1.11.0'
 72    implementation 'androidx.work:work-runtime:2.9.0'
 73
 74    implementation "androidx.emoji2:emoji2:1.4.0"
 75    freeImplementation "androidx.emoji2:emoji2-bundled:1.4.0"
 76
 77    implementation 'org.bouncycastle:bcmail-jdk15on:1.64'
 78    //zxing stopped supporting Java 7 so we have to stick with 3.3.3
 79    //https://github.com/zxing/zxing/issues/1170
 80    implementation 'com.google.zxing:core:3.3.3'
 81    implementation 'org.minidns:minidns-hla:1.0.5'
 82    implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
 83    implementation 'org.whispersystems:signal-protocol-java:2.6.2'
 84    implementation "com.wefika:flowlayout:0.4.1"
 85
 86    //noinspection GradleDependency
 87    implementation('com.github.natario1:Transcoder:v0.9.1') {
 88        exclude group: 'com.otaliastudios.opengl', module: 'egloo'
 89    }
 90    implementation 'com.github.natario1:Egloo:v0.4.0'
 91
 92    implementation 'org.jxmpp:jxmpp-jid:1.0.3'
 93    implementation 'org.jxmpp:jxmpp-stringprep-libidn:1.0.3'
 94    implementation 'org.osmdroid:osmdroid-android:6.1.11'
 95    implementation 'org.hsluv:hsluv:0.2'
 96    implementation 'org.conscrypt:conscrypt-android:2.5.2'
 97    implementation 'me.drakeet.support:toastcompat:1.1.0'
 98    implementation "com.leinardi.android:speed-dial:3.3.0"
 99
100    implementation "com.squareup.retrofit2:retrofit:2.9.0"
101    implementation "com.squareup.retrofit2:converter-gson:2.9.0"
102    implementation "com.squareup.okhttp3:okhttp:4.12.0"
103
104    implementation 'com.google.guava:guava:32.1.3-android'
105    implementation 'io.michaelrocks:libphonenumber-android:8.13.28'
106    implementation 'im.conversations.webrtc:webrtc-android:119.0.1'
107    implementation 'io.github.nishkarsh:android-permissions:2.1.6'
108    implementation 'androidx.recyclerview:recyclerview:1.1.0'
109    implementation 'androidx.documentfile:documentfile:1.0.1'
110    implementation 'com.github.martin-stone:hsv-alpha-color-picker-android:3.1.0'
111    implementation 'com.github.ipld:java-cid:v1.3.1'
112    //implementation 'com.splitwise:tokenautocomplete:3.0.2'
113    implementation 'com.github.singpolyma:TokenAutoComplete:bfa93780e0'
114    implementation 'com.github.singpolyma:Better-Link-Movement-Method:4df081e1e4'
115    implementation 'com.github.singpolyma:android-identicons:3361281bd4'
116    implementation 'com.github.woltapp:blurhash:master'
117    implementation 'com.caverock:androidsvg-aar:1.4'
118    implementation 'org.tomlj:tomlj:1.1.0'
119    implementation 'com.tbuonomo:dotsindicator:4.2'
120    implementation 'com.github.Priyansh-Kedia:OpenGraphParser:2.5.6'
121    implementation 'me.xdrop:fuzzywuzzy:1.4.0'
122}
123
124ext {
125    preDexEnabled = System.getProperty("pre-dex", "true")
126    abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
127}
128
129android {
130    namespace 'eu.siacs.conversations'
131    compileSdk 34
132
133    defaultConfig {
134        minSdkVersion 23
135        targetSdkVersion 34
136        versionCode 4204930
137        versionName grgit.describe(always: true)
138        applicationId "eu.siacs.conversations"
139        def appName = "Conversations"
140        resValue "string", "app_name", appName
141        buildConfigField "String", "APP_NAME", "\"$appName\"";
142        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
143    }
144
145    splits {
146        abi {
147            universalApk true
148            enable true
149            reset()
150            //noinspection ChromeOsAbiSupport
151            include project.ext.abiCodes.keySet() as String[]
152        }
153    }
154
155    configurations {
156        implementation.exclude group: 'org.jetbrains' , module:'annotations'
157    }
158
159    dataBinding {
160        enabled true
161    }
162
163    compileOptions {
164        coreLibraryDesugaringEnabled true
165        sourceCompatibility JavaVersion.VERSION_17
166        targetCompatibility JavaVersion.VERSION_17
167    }
168
169    flavorDimensions += "mode"
170    flavorDimensions += "distribution"
171
172    productFlavors {
173
174        quicksy {
175            dimension "mode"
176            applicationId = "im.quicksy.client"
177
178            def appName = "Quicksy"
179            resValue "string", "app_name", appName
180            buildConfigField "String", "APP_NAME", "\"$appName\""
181            buildConfigField "String", "PRIVACY_POLICY", "\"https://quicksy.im/privacy.htm\""
182        }
183
184        conversations {
185            dimension "mode"
186            buildConfigField "String", "PRIVACY_POLICY", "\"https://conversations.im/privacy.html\""
187        }
188
189        cheogram {
190            dimension "mode"
191
192            applicationId = "com.cheogram.android"
193
194            def appName = "Cheogram"
195            resValue "string", "app_name", appName
196            buildConfigField "String", "APP_NAME", "\"$appName\"";
197            buildConfigField "String", "PRIVACY_POLICY", "\"https://cheogram.com/android-privacy.html\""
198        }
199
200        playstore {
201            dimension "distribution"
202            versionNameSuffix "+playstore"
203            applicationIdSuffix "playstore"
204        }
205        free {
206            dimension "distribution"
207            versionNameSuffix "+free"
208        }
209    }
210
211    applicationVariants.all { variant ->
212      variant.resValue "string", "applicationId", applicationId
213    }
214
215    sourceSets {
216        quicksyFree {
217            java {
218                srcDir 'src/quicksyFree/java'
219            }
220        }
221        quicksyPlaystore {
222            java {
223                srcDir 'src/quicksyPlaystore/java'
224            }
225            res {
226                srcDir 'src/quicksyPlaystore/res'
227            }
228        }
229        conversationsFree {
230            java {
231                srcDir 'src/conversationsFree/java'
232            }
233        }
234        cheogramFree {
235            java {
236                srcDir 'src/conversationsFree/java'
237            }
238        }
239        conversationsPlaystore {
240            java {
241                srcDir 'src/conversationsPlaystore/java'
242            }
243            res {
244                srcDir 'src/conversationsPlaystore/res'
245            }
246        }
247    }
248
249    buildTypes {
250        release {
251            shrinkResources true
252            minifyEnabled true
253            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
254            ndk.debugSymbolLevel = 'full'
255        }
256        debug {
257            shrinkResources true
258            minifyEnabled true
259            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
260        }
261    }
262
263
264    if (new File("signing.properties").exists()) {
265        Properties props = new Properties()
266        props.load(new FileInputStream(file("signing.properties")))
267
268        signingConfigs {
269            release {
270                storeFile file(props['keystore'])
271                storePassword props['keystore.password']
272                keyAlias props['keystore.alias']
273                keyPassword props['keystore.password']
274            }
275        }
276        buildTypes.release.signingConfig = signingConfigs.release
277    }
278
279    lintOptions {
280        disable 'MissingTranslation', 'InvalidPackage','AppCompatResource'
281        abortOnError false
282    }
283
284    subprojects {
285
286        afterEvaluate {
287            if (getPlugins().hasPlugin('android') ||
288                    getPlugins().hasPlugin('android-library')) {
289
290                configure(android.lintOptions) {
291                    disable 'AndroidGradlePluginVersion', 'MissingTranslation'
292                    abortOnError false
293                }
294            }
295
296        }
297    }
298    packagingOptions {
299        resources {
300            excludes += ['META-INF/BCKEY.DSA', 'META-INF/BCKEY.SF']
301        }
302    }
303    lint {
304        disable 'MissingTranslation', 'InvalidPackage', 'AppCompatResource'
305    }
306    buildFeatures {
307        buildConfig true
308    }
309
310    /*android.applicationVariants.configureEach { variant ->
311        variant.outputs.each { output ->
312            def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(com.android.build.OutputFile.ABI))
313            if (baseAbiVersionCode != null) {
314                output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + baseAbiVersionCode
315            } else {
316                output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + grgit.log(includes: ["HEAD"], excludes: [tags.last()]).size()
317            }
318        }
319
320    }*/
321}