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