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.makeramen:roundedimageview:2.3.0'
 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 '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 'org.snikket:webrtc-android:107.0.0'
102    // INSERT
103}
104
105ext {
106    preDexEnabled = System.getProperty("pre-dex", "true")
107    abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
108}
109
110android {
111    namespace 'eu.siacs.conversations'
112    compileSdkVersion 32
113
114    defaultConfig {
115        minSdkVersion 21
116        targetSdkVersion 30
117        versionCode 42024 + tags.size()
118        versionName grgit.describe(always: true)
119        applicationId "eu.siacs.conversations"
120        resValue "string", "applicationId", applicationId
121        def appName = "Conversations"
122        resValue "string", "app_name", appName
123        buildConfigField "String", "APP_NAME", "\"$appName\"";
124        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
125    }
126
127    configurations {
128        implementation.exclude group: 'org.jetbrains' , module:'annotations'
129    }
130
131    dataBinding {
132        enabled true
133    }
134
135    compileOptions {
136        coreLibraryDesugaringEnabled true
137        sourceCompatibility JavaVersion.VERSION_1_8
138        targetCompatibility JavaVersion.VERSION_1_8
139    }
140
141    flavorDimensions("mode", "distribution")
142
143    productFlavors {
144
145        quicksy {
146            dimension "mode"
147            applicationId = "im.quicksy.client"
148            resValue "string", "applicationId", applicationId
149
150            def appName = "Quicksy"
151            resValue "string", "app_name", appName
152            buildConfigField "String", "APP_NAME", "\"$appName\""
153        }
154
155        conversations {
156            dimension "mode"
157        }
158
159        cheogram {
160            dimension "mode"
161
162            applicationId = "com.cheogram.android"
163            resValue "string", "applicationId", applicationId
164
165            def appName = "Cheogram"
166            resValue "string", "app_name", appName
167            buildConfigField "String", "APP_NAME", "\"$appName\"";
168        }
169
170        playstore {
171            dimension "distribution"
172            versionNameSuffix "+playstore"
173        }
174        free {
175            dimension "distribution"
176            versionNameSuffix "+free"
177        }
178    }
179
180    sourceSets {
181        quicksyFree {
182            java {
183                srcDir 'src/quicksyFree/java'
184            }
185        }
186        quicksyPlaystore {
187            java {
188                srcDir 'src/quicksyPlaystore/java'
189            }
190            res {
191                srcDir 'src/quicksyPlaystore/res'
192            }
193        }
194        conversationsFree {
195            java {
196                srcDir 'src/conversationsFree/java'
197            }
198        }
199        cheogramFree {
200            java {
201                srcDir 'src/conversationsFree/java'
202            }
203        }
204        conversationsPlaystore {
205            java {
206                srcDir 'src/conversationsPlaystore/java'
207            }
208            res {
209                srcDir 'src/conversationsPlaystore/res'
210            }
211        }
212    }
213
214    buildTypes {
215        release {
216            shrinkResources true
217            minifyEnabled true
218            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
219        }
220        debug {
221            shrinkResources true
222            minifyEnabled true
223            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
224        }
225    }
226
227
228    if (new File("signing.properties").exists()) {
229        Properties props = new Properties()
230        props.load(new FileInputStream(file("signing.properties")))
231
232        signingConfigs {
233            release {
234                storeFile file(props['keystore'])
235                storePassword props['keystore.password']
236                keyAlias props['keystore.alias']
237                keyPassword props['keystore.password']
238            }
239        }
240        buildTypes.release.signingConfig = signingConfigs.release
241    }
242
243    lintOptions {
244        disable 'MissingTranslation', 'InvalidPackage','AppCompatResource'
245        abortOnError false
246    }
247
248    subprojects {
249
250        afterEvaluate {
251            if (getPlugins().hasPlugin('android') ||
252                    getPlugins().hasPlugin('android-library')) {
253
254                configure(android.lintOptions) {
255                    disable 'AndroidGradlePluginVersion', 'MissingTranslation'
256                    abortOnError false
257                }
258            }
259
260        }
261    }
262    packagingOptions {
263        resources {
264            excludes += ['META-INF/BCKEY.DSA', 'META-INF/BCKEY.SF']
265        }
266    }
267    lint {
268        disable 'MissingTranslation', 'InvalidPackage', 'AppCompatResource'
269    }
270
271    android.applicationVariants.all { variant ->
272        variant.outputs.each { output ->
273            def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(com.android.build.OutputFile.ABI))
274            if (baseAbiVersionCode != null) {
275                output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + baseAbiVersionCode
276            } else {
277                output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + grgit.log(includes: ["HEAD"], excludes: [tags.last()]).size()
278            }
279        }
280
281    }
282}