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 urlFile('https://cloudflare-ipfs.com/ipfs/QmeqMiLxHi8AAjXobxr3QTfa1bSSLyAu86YviAqQnjxCjM/libwebrtc.aar', 'libwebrtc.aar')
 98    // INSERT
 99}
100
101ext {
102    travisBuild = System.getenv("TRAVIS") == "true"
103    preDexEnabled = System.getProperty("pre-dex", "true")
104    abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
105}
106
107android {
108    compileSdkVersion 31
109
110    defaultConfig {
111        minSdkVersion 24
112        targetSdkVersion 29
113        versionCode 42024 + grgit.tag.list().size()
114        versionName grgit.describe(tags: true, always: true)
115        archivesBaseName += "-$versionName"
116        applicationId "eu.siacs.conversations"
117        resValue "string", "applicationId", applicationId
118        def appName = "Conversations"
119        resValue "string", "app_name", appName
120        buildConfigField "String", "APP_NAME", "\"$appName\"";
121    }
122
123
124    configurations {
125        implementation.exclude group: 'org.jetbrains' , module:'annotations'
126    }
127
128    dataBinding {
129        enabled true
130    }
131
132    compileOptions {
133        sourceCompatibility JavaVersion.VERSION_1_8
134        targetCompatibility JavaVersion.VERSION_1_8
135    }
136
137    flavorDimensions("mode", "distribution")
138
139    productFlavors {
140
141        quicksy {
142            dimension "mode"
143            applicationId = "im.quicksy.client"
144            resValue "string", "applicationId", applicationId
145
146            def appName = "Quicksy"
147            resValue "string", "app_name", appName
148            buildConfigField "String", "APP_NAME", "\"$appName\"";
149        }
150
151        conversations {
152            dimension "mode"
153        }
154
155        cheogram {
156            dimension "mode"
157
158            applicationId = "com.cheogram.android"
159            resValue "string", "applicationId", applicationId
160
161            def appName = "Cheogram"
162            resValue "string", "app_name", appName
163            buildConfigField "String", "APP_NAME", "\"$appName\"";
164        }
165
166        playstore {
167            dimension "distribution"
168            versionNameSuffix "+playstore"
169        }
170        free {
171            dimension "distribution"
172            versionNameSuffix "+free"
173        }
174    }
175
176    sourceSets {
177        quicksyFree {
178            java {
179                srcDir 'src/quicksyFree/java'
180            }
181        }
182        quicksyPlaystore {
183            java {
184                srcDir 'src/quicksyPlaystore/java'
185            }
186            res {
187                srcDir 'src/quicksyPlaystore/res'
188            }
189        }
190        conversationsFree {
191            java {
192                srcDir 'src/conversationsFree/java'
193            }
194        }
195        cheogramFree {
196            java {
197                srcDir 'src/conversationsFree/java'
198            }
199        }
200        conversationsPlaystore {
201            java {
202                srcDir 'src/conversationsPlaystore/java'
203            }
204            res {
205                srcDir 'src/conversationsPlaystore/res'
206            }
207        }
208    }
209
210    buildTypes {
211        release {
212            shrinkResources true
213            minifyEnabled true
214            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
215        }
216        debug {
217            shrinkResources true
218            minifyEnabled true
219            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
220        }
221    }
222
223
224    if (new File("signing.properties").exists()) {
225        Properties props = new Properties()
226        props.load(new FileInputStream(file("signing.properties")))
227
228        signingConfigs {
229            release {
230                storeFile file(props['keystore'])
231                storePassword props['keystore.password']
232                keyAlias props['keystore.alias']
233                keyPassword props['keystore.password']
234            }
235        }
236        buildTypes.release.signingConfig = signingConfigs.release
237    }
238
239    lintOptions {
240        disable 'MissingTranslation', 'InvalidPackage','AppCompatResource'
241        abortOnError false
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                    abortOnError false
253                }
254            }
255
256        }
257    }
258    packagingOptions {
259        resources {
260            excludes += ['META-INF/BCKEY.DSA', 'META-INF/BCKEY.SF']
261        }
262    }
263    lint {
264        disable 'MissingTranslation', 'InvalidPackage', 'AppCompatResource'
265    }
266
267
268    android.applicationVariants.all { variant ->
269        variant.outputs.each { output ->
270            def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(com.android.build.OutputFile.ABI))
271            if (baseAbiVersionCode != null) {
272                output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + baseAbiVersionCode
273            } else {
274                output.versionCodeOverride = 100 * project.android.defaultConfig.versionCode
275            }
276        }
277
278    }
279}