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    cheogramPlaystoreImplementation 'com.github.singpolyma:play-licensing:1c637ea03c'
 59    conversationsPlaystoreImplementation("com.android.installreferrer:installreferrer:2.2")
 60    quicksyPlaystoreImplementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1'
 61    implementation 'org.sufficientlysecure:openpgp-api:10.0'
 62    implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
 63    implementation 'androidx.appcompat:appcompat:1.5.1'
 64    implementation 'androidx.exifinterface:exifinterface:1.3.5'
 65    implementation 'androidx.cardview:cardview:1.0.0'
 66    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
 67    implementation 'com.google.android.material:material:1.7.0'
 68
 69    implementation "androidx.emoji2:emoji2:1.2.0"
 70    freeImplementation "androidx.emoji2:emoji2-bundled:1.2.0"
 71
 72    implementation 'org.bouncycastle:bcmail-jdk15on:1.64'
 73    //zxing stopped supporting Java 7 so we have to stick with 3.3.3
 74    //https://github.com/zxing/zxing/issues/1170
 75    implementation 'com.google.zxing:core:3.3.3'
 76    implementation 'de.measite.minidns:minidns-hla:0.2.4'
 77    implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
 78    implementation 'org.whispersystems:signal-protocol-android:2.6.2'
 79    implementation "com.wefika:flowlayout:0.4.1"
 80    //noinspection GradleDependency
 81    implementation 'com.otaliastudios:transcoder:0.9.1'
 82
 83    implementation 'org.jxmpp:jxmpp-jid:1.0.3'
 84    implementation 'org.osmdroid:osmdroid-android:6.1.11'
 85    implementation 'org.hsluv:hsluv:0.2'
 86    implementation 'org.conscrypt:conscrypt-android:2.5.2'
 87    implementation 'me.drakeet.support:toastcompat:1.1.0'
 88    implementation "com.leinardi.android:speed-dial:3.2.0"
 89
 90    implementation "com.squareup.retrofit2:retrofit:2.9.0"
 91    implementation "com.squareup.retrofit2:converter-gson:2.9.0"
 92    implementation "com.squareup.okhttp3:okhttp:4.10.0"
 93
 94    implementation 'com.google.guava:guava:31.1-android'
 95    implementation 'io.michaelrocks:libphonenumber-android:8.12.49'
 96    implementation 'io.github.nishkarsh:android-permissions:2.1.6'
 97    implementation 'androidx.recyclerview:recyclerview:1.1.0'
 98    implementation 'androidx.documentfile:documentfile:1.0.1'
 99    implementation 'com.github.martin-stone:hsv-alpha-color-picker-android:2.4.2'
100    implementation 'com.github.ipld:java-cid:v1.3.1'
101    implementation 'com.splitwise:tokenautocomplete:3.0.2'
102    implementation 'me.saket:better-link-movement-method:2.2.0'
103    implementation 'com.github.singpolyma:android-identicons:master-SNAPSHOT'
104    implementation 'org.snikket:webrtc-android:107.0.0'
105    implementation 'com.github.woltapp:blurhash:master'
106    implementation 'com.caverock:androidsvg-aar:1.4'
107    implementation 'com.tbuonomo.andrui:viewpagerdotsindicator:4.1.2'
108    // INSERT
109}
110
111ext {
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 33
119
120    defaultConfig {
121        minSdkVersion 21
122        targetSdkVersion 32
123        versionCode 42024 + tags.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    configurations {
134        implementation.exclude group: 'org.jetbrains' , module:'annotations'
135    }
136
137    dataBinding {
138        enabled true
139    }
140
141    compileOptions {
142        coreLibraryDesugaringEnabled true
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            applicationIdSuffix "playstore"
180        }
181        free {
182            dimension "distribution"
183            versionNameSuffix "+free"
184        }
185    }
186
187    sourceSets {
188        quicksyFree {
189            java {
190                srcDir 'src/quicksyFree/java'
191            }
192        }
193        quicksyPlaystore {
194            java {
195                srcDir 'src/quicksyPlaystore/java'
196            }
197            res {
198                srcDir 'src/quicksyPlaystore/res'
199            }
200        }
201        conversationsFree {
202            java {
203                srcDir 'src/conversationsFree/java'
204            }
205        }
206        cheogramFree {
207            java {
208                srcDir 'src/conversationsFree/java'
209            }
210        }
211        conversationsPlaystore {
212            java {
213                srcDir 'src/conversationsPlaystore/java'
214            }
215            res {
216                srcDir 'src/conversationsPlaystore/res'
217            }
218        }
219    }
220
221    buildTypes {
222        release {
223            shrinkResources true
224            minifyEnabled true
225            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
226            ndk.debugSymbolLevel = 'full'
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) + grgit.log(includes: ["HEAD"], excludes: [tags.last()]).size()
286            }
287        }
288
289    }
290}