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