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