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