build.gradle

  1import com.android.build.OutputFile
  2
  3// Top-level build file where you can add configuration options common to all
  4// sub-projects/modules.
  5buildscript {
  6    repositories {
  7        google()
  8        jcenter()
  9    }
 10    dependencies {
 11        classpath 'com.android.tools.build:gradle:3.6.2'
 12    }
 13}
 14
 15apply plugin: 'com.android.application'
 16
 17repositories {
 18    google()
 19    jcenter()
 20    mavenCentral()
 21}
 22
 23configurations {
 24    playstoreImplementation
 25    compatImplementation
 26    conversationsFreeCompatImplementation
 27    conversationsPlaystoreCompatImplementation
 28    conversationsPlaystoreSystemImplementation
 29    quicksyFreeCompatImplementation
 30    quicksyImplementation
 31}
 32
 33ext {
 34    supportLibVersion = '28.0.0'
 35}
 36
 37dependencies {
 38    //should remain that low because later versions introduce dependency to androidx (not sure exactly from what version)
 39    playstoreImplementation('com.google.firebase:firebase-messaging:17.3.4') {
 40        exclude group: 'com.google.firebase', module: 'firebase-core'
 41        exclude group: 'com.google.firebase', module: 'firebase-analytics'
 42        exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
 43    }
 44    conversationsPlaystoreCompatImplementation("com.android.installreferrer:installreferrer:1.1.2")
 45    conversationsPlaystoreSystemImplementation("com.android.installreferrer:installreferrer:1.1.2")
 46    implementation 'org.sufficientlysecure:openpgp-api:10.0'
 47    implementation('com.theartofdev.edmodo:android-image-cropper:2.7.+') {
 48        exclude group: 'com.android.support', module: 'appcompat-v7'
 49        exclude group: 'com.android.support', module: 'exifinterface'
 50    }
 51    implementation "com.android.support:support-v13:$supportLibVersion"
 52    implementation "com.android.support:appcompat-v7:$supportLibVersion"
 53    implementation "com.android.support:exifinterface:$supportLibVersion"
 54    implementation "com.android.support:cardview-v7:$supportLibVersion"
 55    implementation "com.android.support:support-emoji:$supportLibVersion"
 56    implementation "com.android.support:design:$supportLibVersion"
 57    compatImplementation "com.android.support:support-emoji-appcompat:$supportLibVersion"
 58    conversationsFreeCompatImplementation "com.android.support:support-emoji-bundled:$supportLibVersion"
 59    quicksyFreeCompatImplementation "com.android.support:support-emoji-bundled:$supportLibVersion"
 60    implementation 'org.bouncycastle:bcmail-jdk15on:1.64'
 61    //zxing stopped supporting Java 7 so we have to stick with 3.3.3
 62    //https://github.com/zxing/zxing/issues/1170
 63    implementation 'com.google.zxing:core:3.3.3'
 64    implementation 'de.measite.minidns:minidns-hla:0.2.4'
 65    implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
 66    implementation 'org.whispersystems:signal-protocol-java:2.6.2'
 67    implementation 'com.makeramen:roundedimageview:2.3.0'
 68    implementation "com.wefika:flowlayout:0.4.1"
 69    implementation 'net.ypresto.androidtranscoder:android-transcoder:0.3.0'
 70    implementation 'org.jxmpp:jxmpp-jid:0.6.4'
 71    implementation 'org.osmdroid:osmdroid-android:6.1.5'
 72    implementation 'org.hsluv:hsluv:0.2'
 73    implementation 'org.conscrypt:conscrypt-android:2.2.1'
 74    implementation 'me.drakeet.support:toastcompat:1.1.0'
 75    implementation "com.leinardi.android:speed-dial:2.0.1"
 76    //retrofit needs to stick with 2.6.x (https://github.com/square/retrofit/blob/master/CHANGELOG.md)
 77    implementation "com.squareup.retrofit2:retrofit:2.6.4"
 78    implementation "com.squareup.retrofit2:converter-gson:2.6.4"
 79    //okhttp needs to stick with 3.12.x
 80    implementation 'com.squareup.okhttp3:okhttp:3.12.12'
 81    implementation 'com.google.guava:guava:27.1-android'
 82    quicksyImplementation 'io.michaelrocks:libphonenumber-android:8.11.1'
 83    implementation fileTree(include: ['libwebrtc-m83.aar'], dir: 'libs')
 84}
 85
 86ext {
 87    travisBuild = System.getenv("TRAVIS") == "true"
 88    preDexEnabled = System.getProperty("pre-dex", "true")
 89    abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
 90}
 91
 92android {
 93    compileSdkVersion 29
 94
 95    defaultConfig {
 96        minSdkVersion 16
 97        targetSdkVersion 28
 98        versionCode 393
 99        versionName "2.8.7"
100        archivesBaseName += "-$versionName"
101        applicationId "eu.siacs.conversations"
102        resValue "string", "applicationId", applicationId
103        resValue "string", "app_name", "Conversations"
104        buildConfigField "String", "LOGTAG", "\"conversations\""
105    }
106
107    splits {
108        abi {
109            universalApk true
110            enable true
111        }
112    }
113
114    dataBinding {
115        enabled true
116    }
117
118    dexOptions {
119        // Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
120        preDexLibraries = preDexEnabled && !travisBuild
121        jumboMode true
122    }
123
124    compileOptions {
125        sourceCompatibility JavaVersion.VERSION_1_8
126        targetCompatibility JavaVersion.VERSION_1_8
127    }
128
129    flavorDimensions("mode", "distribution", "emoji")
130
131    productFlavors {
132
133        quicksy {
134            dimension "mode"
135            applicationId = "im.quicksy.client"
136            resValue "string", "app_name", "Quicksy"
137            resValue "string", "applicationId", applicationId
138            buildConfigField "String", "LOGTAG", "\"quicksy\""
139        }
140
141        conversations {
142            dimension "mode"
143        }
144
145        playstore {
146            dimension "distribution"
147            versionNameSuffix "+p"
148        }
149        free {
150            dimension "distribution"
151            versionNameSuffix "+f"
152        }
153        system {
154            dimension "emoji"
155            versionNameSuffix "s"
156        }
157        compat {
158            dimension "emoji"
159            versionNameSuffix "c"
160        }
161    }
162
163    sourceSets {
164        quicksyFreeCompat {
165            java {
166                srcDir 'src/freeCompat/java'
167            }
168        }
169        quicksyPlaystoreCompat {
170            java {
171                srcDir 'src/playstoreCompat/java'
172            }
173            res {
174                srcDir 'src/playstoreCompat/res'
175                srcDir 'src/quicksyPlaystore/res'
176            }
177        }
178        quicksyPlaystoreSystem {
179            res {
180                srcDir 'src/quicksyPlaystore/res'
181            }
182        }
183        conversationsFreeCompat {
184            java {
185                srcDir 'src/freeCompat/java'
186                srcDir 'src/conversationsFree/java'
187            }
188        }
189        conversationsFreeSystem {
190            java {
191                srcDir 'src/conversationsFree/java'
192            }
193        }
194        conversationsPlaystoreCompat {
195            java {
196                srcDir 'src/playstoreCompat/java'
197                srcDir 'src/conversationsPlaystore/java'
198            }
199            res {
200                srcDir 'src/playstoreCompat/res'
201                srcDir 'src/conversationsPlaystore/res'
202            }
203        }
204        conversationsPlaystoreSystem {
205            java {
206                srcDir 'src/conversationsPlaystore/java'
207            }
208            res {
209                srcDir 'src/conversationsPlaystore/res'
210            }
211        }
212    }
213
214    buildTypes {
215        release {
216            shrinkResources true
217            minifyEnabled true
218            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
219            versionNameSuffix "r"
220        }
221        debug {
222            shrinkResources true
223            minifyEnabled true
224            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
225            versionNameSuffix "d"
226        }
227    }
228
229
230    if (new File("signing.properties").exists()) {
231        Properties props = new Properties()
232        props.load(new FileInputStream(file("signing.properties")))
233
234        signingConfigs {
235            release {
236                storeFile file(props['keystore'])
237                storePassword props['keystore.password']
238                keyAlias props['keystore.alias']
239                keyPassword props['keystore.password']
240            }
241        }
242        buildTypes.release.signingConfig = signingConfigs.release
243    }
244
245    lintOptions {
246        disable 'ExtraTranslation', 'MissingTranslation', 'InvalidPackage', 'MissingQuantity', 'AppCompatResource'
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                }
258            }
259
260        }
261    }
262
263    packagingOptions {
264        exclude 'META-INF/BCKEY.DSA'
265        exclude 'META-INF/BCKEY.SF'
266    }
267
268    android.applicationVariants.all { variant ->
269        variant.outputs.each { output ->
270            def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))
271            if (baseAbiVersionCode != null) {
272                output.versionCodeOverride = (100 * variant.versionCode) + baseAbiVersionCode
273            } else {
274                output.versionCodeOverride = (100 * variant.versionCode)
275            }
276        }
277
278    }
279}