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