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