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.1.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}
 24
 25// https://stackoverflow.com/a/38105112/8611
 26def urlFile = { url, name ->
 27    File file = new File("$buildDir/download/${name}")
 28    file.parentFile.mkdirs()
 29    if (!file.exists()) {
 30        new URL(url).withInputStream { downloadStream ->
 31            file.withOutputStream { fileOut ->
 32                fileOut << downloadStream
 33            }
 34        }
 35    }
 36    files(file.absolutePath)
 37}
 38
 39configurations {
 40    playstoreImplementation
 41    freeImplementation
 42    conversationsFreeImplementation
 43    conversationsPlaystorImplementation
 44    conversationsPlaystoreImplementation
 45    quicksyPlaystoreImplementation
 46    quicksyPlaystoreImplementation
 47    quicksyFreeImplementation
 48    quicksyImplementation
 49}
 50
 51dependencies {
 52    implementation 'androidx.viewpager:viewpager:1.0.0'
 53
 54    playstoreImplementation('com.google.firebase:firebase-messaging:23.0.0') {
 55        exclude group: 'com.google.firebase', module: 'firebase-core'
 56        exclude group: 'com.google.firebase', module: 'firebase-analytics'
 57        exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
 58    }
 59    conversationsPlaystoreImplementation("com.android.installreferrer:installreferrer:2.2")
 60    quicksyPlaystoreImplementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1'
 61    implementation 'org.sufficientlysecure:openpgp-api:10.0'
 62    implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
 63    implementation 'androidx.appcompat:appcompat:1.4.1'
 64    implementation 'androidx.exifinterface:exifinterface:1.3.3'
 65    implementation 'androidx.cardview:cardview:1.0.0'
 66    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
 67    implementation 'com.google.android.material:material:1.4.0'
 68
 69    implementation "androidx.emoji2:emoji2:1.1.0-rc01"
 70    freeImplementation "androidx.emoji2:emoji2-bundled:1.1.0-rc01"
 71
 72    implementation 'org.bouncycastle:bcmail-jdk15on:1.64'
 73    //zxing stopped supporting Java 7 so we have to stick with 3.3.3
 74    //https://github.com/zxing/zxing/issues/1170
 75    implementation 'com.google.zxing:core:3.3.3'
 76    implementation 'de.measite.minidns:minidns-hla:0.2.4'
 77    implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
 78    implementation 'org.whispersystems:signal-protocol-java:2.6.2'
 79    implementation 'com.makeramen:roundedimageview:2.3.0'
 80    implementation "com.wefika:flowlayout:0.4.1"
 81    implementation 'com.otaliastudios:transcoder:0.10.4'
 82
 83    implementation 'org.jxmpp:jxmpp-jid:1.0.2'
 84    implementation 'org.osmdroid:osmdroid-android:6.1.10'
 85    implementation 'org.hsluv:hsluv:0.2'
 86    implementation 'org.conscrypt:conscrypt-android:2.5.2'
 87    implementation 'me.drakeet.support:toastcompat:1.1.0'
 88    implementation "com.leinardi.android:speed-dial:3.2.0"
 89
 90    implementation "com.squareup.retrofit2:retrofit:2.9.0"
 91    implementation "com.squareup.retrofit2:converter-gson:2.9.0"
 92    implementation "com.squareup.okhttp3:okhttp:4.9.3"
 93
 94    implementation 'com.google.guava:guava:30.1.1-android'
 95    implementation 'io.michaelrocks:libphonenumber-android:8.12.36'
 96    implementation 'io.github.nishkarsh:android-permissions:2.1.6'
 97    implementation 'androidx.recyclerview:recyclerview:1.1.0'
 98    implementation urlFile('https://cloudflare-ipfs.com/ipfs/QmeqMiLxHi8AAjXobxr3QTfa1bSSLyAu86YviAqQnjxCjM/libwebrtc.aar', 'libwebrtc.aar')
 99    // INSERT
100}
101
102ext {
103    travisBuild = System.getenv("TRAVIS") == "true"
104    preDexEnabled = System.getProperty("pre-dex", "true")
105    abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
106}
107
108android {
109    compileSdkVersion 31
110
111    defaultConfig {
112        minSdkVersion 24
113        targetSdkVersion 29
114        versionCode 42024 + grgit.tag.list().size()
115        versionName grgit.describe(tags: true, always: true)
116        archivesBaseName += "-$versionName"
117        applicationId "eu.siacs.conversations"
118        resValue "string", "applicationId", applicationId
119        def appName = "Conversations"
120        resValue "string", "app_name", appName
121        buildConfigField "String", "APP_NAME", "\"$appName\"";
122    }
123
124
125    configurations {
126        implementation.exclude group: 'org.jetbrains' , module:'annotations'
127    }
128
129    dataBinding {
130        enabled true
131    }
132
133    compileOptions {
134        sourceCompatibility JavaVersion.VERSION_1_8
135        targetCompatibility JavaVersion.VERSION_1_8
136    }
137
138    flavorDimensions("mode", "distribution")
139
140    productFlavors {
141
142        quicksy {
143            dimension "mode"
144            applicationId = "im.quicksy.client"
145            resValue "string", "applicationId", applicationId
146
147            def appName = "Quicksy"
148            resValue "string", "app_name", appName
149            buildConfigField "String", "APP_NAME", "\"$appName\"";
150        }
151
152        conversations {
153            dimension "mode"
154        }
155
156        cheogram {
157            dimension "mode"
158
159            applicationId = "com.cheogram.android"
160            resValue "string", "applicationId", applicationId
161
162            def appName = "Cheogram"
163            resValue "string", "app_name", appName
164            buildConfigField "String", "APP_NAME", "\"$appName\"";
165        }
166
167        playstore {
168            dimension "distribution"
169            versionNameSuffix "+playstore"
170        }
171        free {
172            dimension "distribution"
173            versionNameSuffix "+free"
174        }
175    }
176
177    sourceSets {
178        quicksyFree {
179            java {
180                srcDir 'src/quicksyFree/java'
181            }
182        }
183        quicksyPlaystore {
184            java {
185                srcDir 'src/quicksyPlaystore/java'
186            }
187            res {
188                srcDir 'src/quicksyPlaystore/res'
189            }
190        }
191        conversationsFree {
192            java {
193                srcDir 'src/conversationsFree/java'
194            }
195        }
196        cheogramFree {
197            java {
198                srcDir 'src/conversationsFree/java'
199            }
200        }
201        conversationsPlaystore {
202            java {
203                srcDir 'src/conversationsPlaystore/java'
204            }
205            res {
206                srcDir 'src/conversationsPlaystore/res'
207            }
208        }
209    }
210
211    buildTypes {
212        release {
213            shrinkResources true
214            minifyEnabled true
215            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
216        }
217        debug {
218            shrinkResources true
219            minifyEnabled true
220            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
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        abortOnError false
243    }
244
245    subprojects {
246
247        afterEvaluate {
248            if (getPlugins().hasPlugin('android') ||
249                    getPlugins().hasPlugin('android-library')) {
250
251                configure(android.lintOptions) {
252                    disable 'AndroidGradlePluginVersion', 'MissingTranslation'
253                    abortOnError false
254                }
255            }
256
257        }
258    }
259    packagingOptions {
260        resources {
261            excludes += ['META-INF/BCKEY.DSA', 'META-INF/BCKEY.SF']
262        }
263    }
264    lint {
265        disable 'MissingTranslation', 'InvalidPackage', 'AppCompatResource'
266    }
267
268
269    android.applicationVariants.all { variant ->
270        variant.outputs.each { output ->
271            def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(com.android.build.OutputFile.ABI))
272            if (baseAbiVersionCode != null) {
273                output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + baseAbiVersionCode
274            } else {
275                output.versionCodeOverride = 100 * project.android.defaultConfig.versionCode
276            }
277        }
278
279    }
280}