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.1'
 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.6') {
 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.2'
 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-android: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.10.0"
101
102    implementation 'com.google.guava:guava:30.1.1-android'
103    implementation 'io.michaelrocks:libphonenumber-android:8.12.49'
104    implementation 'io.github.nishkarsh:android-permissions:2.1.6'
105    implementation 'androidx.recyclerview:recyclerview:1.1.0'
106    implementation urlFile('https://gateway.pinata.cloud/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    namespace 'eu.siacs.conversations'
118    compileSdkVersion 32
119
120    defaultConfig {
121        minSdkVersion 21
122        targetSdkVersion 30
123        versionCode 42024 + grgit.tag.list().findAll { it.dateTime != null }.size()
124        versionName grgit.describe(always: true)
125        applicationId "eu.siacs.conversations"
126        resValue "string", "applicationId", applicationId
127        def appName = "Conversations"
128        resValue "string", "app_name", appName
129        buildConfigField "String", "APP_NAME", "\"$appName\"";
130        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
131    }
132
133
134    configurations {
135        implementation.exclude group: 'org.jetbrains' , module:'annotations'
136    }
137
138    dataBinding {
139        enabled true
140    }
141
142    compileOptions {
143        sourceCompatibility JavaVersion.VERSION_1_8
144        targetCompatibility JavaVersion.VERSION_1_8
145    }
146
147    flavorDimensions("mode", "distribution")
148
149    productFlavors {
150
151        quicksy {
152            dimension "mode"
153            applicationId = "im.quicksy.client"
154            resValue "string", "applicationId", applicationId
155
156            def appName = "Quicksy"
157            resValue "string", "app_name", appName
158            buildConfigField "String", "APP_NAME", "\"$appName\"";
159        }
160
161        conversations {
162            dimension "mode"
163        }
164
165        cheogram {
166            dimension "mode"
167
168            applicationId = "com.cheogram.android"
169            resValue "string", "applicationId", applicationId
170
171            def appName = "Cheogram"
172            resValue "string", "app_name", appName
173            buildConfigField "String", "APP_NAME", "\"$appName\"";
174        }
175
176        playstore {
177            dimension "distribution"
178            versionNameSuffix "+playstore"
179        }
180        free {
181            dimension "distribution"
182            versionNameSuffix "+free"
183        }
184    }
185
186    sourceSets {
187        quicksyFree {
188            java {
189                srcDir 'src/quicksyFree/java'
190            }
191        }
192        quicksyPlaystore {
193            java {
194                srcDir 'src/quicksyPlaystore/java'
195            }
196            res {
197                srcDir 'src/quicksyPlaystore/res'
198            }
199        }
200        conversationsFree {
201            java {
202                srcDir 'src/conversationsFree/java'
203            }
204        }
205        cheogramFree {
206            java {
207                srcDir 'src/conversationsFree/java'
208            }
209        }
210        conversationsPlaystore {
211            java {
212                srcDir 'src/conversationsPlaystore/java'
213            }
214            res {
215                srcDir 'src/conversationsPlaystore/res'
216            }
217        }
218    }
219
220    buildTypes {
221        release {
222            shrinkResources true
223            minifyEnabled true
224            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
225        }
226        debug {
227            shrinkResources true
228            minifyEnabled true
229            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
230        }
231    }
232
233
234    if (new File("signing.properties").exists()) {
235        Properties props = new Properties()
236        props.load(new FileInputStream(file("signing.properties")))
237
238        signingConfigs {
239            release {
240                storeFile file(props['keystore'])
241                storePassword props['keystore.password']
242                keyAlias props['keystore.alias']
243                keyPassword props['keystore.password']
244            }
245        }
246        buildTypes.release.signingConfig = signingConfigs.release
247    }
248
249    lintOptions {
250        disable 'MissingTranslation', 'InvalidPackage','AppCompatResource'
251        abortOnError false
252    }
253
254    subprojects {
255
256        afterEvaluate {
257            if (getPlugins().hasPlugin('android') ||
258                    getPlugins().hasPlugin('android-library')) {
259
260                configure(android.lintOptions) {
261                    disable 'AndroidGradlePluginVersion', 'MissingTranslation'
262                    abortOnError false
263                }
264            }
265
266        }
267    }
268    packagingOptions {
269        resources {
270            excludes += ['META-INF/BCKEY.DSA', 'META-INF/BCKEY.SF']
271        }
272    }
273    lint {
274        disable 'MissingTranslation', 'InvalidPackage', 'AppCompatResource'
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}