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