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