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