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.2.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    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.0.7') {
 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.0'
 63    implementation 'androidx.exifinterface:exifinterface:1.3.3'
 64    implementation 'androidx.cardview:cardview:1.0.0'
 65    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
 66    implementation 'com.google.android.material:material:1.4.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.makeramen:roundedimageview:2.3.0'
 79    implementation "com.wefika:flowlayout:0.4.1"
 80    implementation 'com.otaliastudios:transcoder:0.10.4'
 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 'com.github.ipld:java-cid:v1.3.1'
 98    implementation 'com.splitwise:tokenautocomplete:3.0.2'
 99    implementation 'me.saket:better-link-movement-method:2.2.0'
100    implementation 'org.snikket:webrtc-android:107.0.0'
101    // INSERT
102}
103
104ext {
105    travisBuild = System.getenv("TRAVIS") == "true"
106    preDexEnabled = System.getProperty("pre-dex", "true")
107    abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
108}
109
110android {
111    namespace 'eu.siacs.conversations'
112    compileSdkVersion 32
113
114    defaultConfig {
115        minSdkVersion 21
116        targetSdkVersion 30
117        versionCode 42024 + tags.size()
118        versionName grgit.describe(always: true)
119        applicationId "eu.siacs.conversations"
120        resValue "string", "applicationId", applicationId
121        def appName = "Conversations"
122        resValue "string", "app_name", appName
123        buildConfigField "String", "APP_NAME", "\"$appName\"";
124        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
125    }
126
127
128    configurations {
129        implementation.exclude group: 'org.jetbrains' , module:'annotations'
130    }
131
132    dataBinding {
133        enabled true
134    }
135
136    compileOptions {
137        coreLibraryDesugaringEnabled true
138        sourceCompatibility JavaVersion.VERSION_1_8
139        targetCompatibility JavaVersion.VERSION_1_8
140    }
141
142    flavorDimensions("mode", "distribution")
143
144    productFlavors {
145
146        quicksy {
147            dimension "mode"
148            applicationId = "im.quicksy.client"
149            resValue "string", "applicationId", applicationId
150
151            def appName = "Quicksy"
152            resValue "string", "app_name", appName
153            buildConfigField "String", "APP_NAME", "\"$appName\"";
154        }
155
156        conversations {
157            dimension "mode"
158        }
159
160        cheogram {
161            dimension "mode"
162
163            applicationId = "com.cheogram.android"
164            resValue "string", "applicationId", applicationId
165
166            def appName = "Cheogram"
167            resValue "string", "app_name", appName
168            buildConfigField "String", "APP_NAME", "\"$appName\"";
169        }
170
171        playstore {
172            dimension "distribution"
173            versionNameSuffix "+playstore"
174        }
175        free {
176            dimension "distribution"
177            versionNameSuffix "+free"
178        }
179    }
180
181    sourceSets {
182        quicksyFree {
183            java {
184                srcDir 'src/quicksyFree/java'
185            }
186        }
187        quicksyPlaystore {
188            java {
189                srcDir 'src/quicksyPlaystore/java'
190            }
191            res {
192                srcDir 'src/quicksyPlaystore/res'
193            }
194        }
195        conversationsFree {
196            java {
197                srcDir 'src/conversationsFree/java'
198            }
199        }
200        cheogramFree {
201            java {
202                srcDir 'src/conversationsFree/java'
203            }
204        }
205        conversationsPlaystore {
206            java {
207                srcDir 'src/conversationsPlaystore/java'
208            }
209            res {
210                srcDir 'src/conversationsPlaystore/res'
211            }
212        }
213    }
214
215    buildTypes {
216        release {
217            shrinkResources true
218            minifyEnabled true
219            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
220        }
221        debug {
222            shrinkResources true
223            minifyEnabled true
224            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
225        }
226    }
227
228
229    if (new File("signing.properties").exists()) {
230        Properties props = new Properties()
231        props.load(new FileInputStream(file("signing.properties")))
232
233        signingConfigs {
234            release {
235                storeFile file(props['keystore'])
236                storePassword props['keystore.password']
237                keyAlias props['keystore.alias']
238                keyPassword props['keystore.password']
239            }
240        }
241        buildTypes.release.signingConfig = signingConfigs.release
242    }
243
244    lintOptions {
245        disable 'MissingTranslation', 'InvalidPackage','AppCompatResource'
246        abortOnError false
247    }
248
249    subprojects {
250
251        afterEvaluate {
252            if (getPlugins().hasPlugin('android') ||
253                    getPlugins().hasPlugin('android-library')) {
254
255                configure(android.lintOptions) {
256                    disable 'AndroidGradlePluginVersion', 'MissingTranslation'
257                    abortOnError false
258                }
259            }
260
261        }
262    }
263    packagingOptions {
264        resources {
265            excludes += ['META-INF/BCKEY.DSA', 'META-INF/BCKEY.SF']
266        }
267    }
268    lint {
269        disable 'MissingTranslation', 'InvalidPackage', 'AppCompatResource'
270    }
271
272    android.applicationVariants.all { variant ->
273        variant.outputs.each { output ->
274            def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(com.android.build.OutputFile.ABI))
275            if (baseAbiVersionCode != null) {
276                output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + baseAbiVersionCode
277            } else {
278                output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + grgit.log(includes: ["HEAD"], excludes: [tags.last()]).size()
279            }
280        }
281
282    }
283}