Optimize dependencies handling

This commit is contained in:
ariskotsomitopoulos 2021-09-15 12:28:58 +03:00
parent 73692bc067
commit c89b2c0536
8 changed files with 137 additions and 97 deletions

View file

@ -18,11 +18,12 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
compileSdk 30
compileSdk versions.compileSdk
defaultConfig {
minSdk 21
targetSdk 30
minSdk versions.minSdk
targetSdk versions.targetSdk
}
buildTypes {
@ -32,8 +33,8 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility versions.sourceCompat
targetCompatibility versions.targetCompat
}
kotlinOptions {
jvmTarget = "11"
@ -49,12 +50,12 @@ dependencies {
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'io.reactivex.rxjava2:rxkotlin:2.4.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation libs.rx.rxKotlin
implementation libs.rx.rxAndroid
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlin}"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation libs.androidx.appCompat
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation 'com.google.android.material:material:1.4.0'

View file

@ -1,9 +1,9 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
// Ref: https://kotlinlang.org/releases.html
ext.kotlin_version = '1.5.30'
ext.kotlin_coroutines_version = "1.5.1"
apply from: 'dependencies.gradle'
repositories {
google()
jcenter()
@ -11,12 +11,13 @@ buildscript {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
// Release notes of Android Gradle Plugin (AGP):
// https://developer.android.com/studio/releases/gradle-plugin
classpath 'com.android.tools.build:gradle:7.0.2'
classpath libs.gradle.gradlePlugin
classpath libs.gradle.kotlinPlugin
classpath 'com.google.gms:google-services:4.3.10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3'
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.4'
classpath "com.likethesalad.android:string-reference:1.2.2"

49
dependencies.gradle Normal file
View file

@ -0,0 +1,49 @@
ext.versions = [
'minSdk' : 21,
'compileSdk' : 30,
'targetSdk' : 30,
'sourceCompat' : JavaVersion.VERSION_11,
'targetCompat' : JavaVersion.VERSION_11,
'kotlin' : '1.5.30',
'kotlinCoroutines' : '1.5.1',
'dagger' : '2.38.1',
'timber' : '5.0.1',
'work' : '2.5.0',
'lifecycle' : '2.2.0',
'moshi' : '1.12.0',
'arch' : '2.1.0',
'markwon' : '4.6.2',
'arrow' : '0.8.2',
'rxKotlin' : '2.4.0',
'rxAndroid' : '2.1.1',
]
ext.libs = [
gradle : [
'gradlePlugin' : "com.android.tools.build:gradle:7.0.2",
'kotlinPlugin' : "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin"
],
jetbrains : [
'kotlinStdlib' : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}",
'coroutinesCore' : "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinCoroutines}",
'coroutinesAndroid' : "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.kotlinCoroutines}",
'coroutinesRx2' : "org.jetbrains.kotlinx:kotlinx-coroutines-rx2:${versions.kotlinCoroutines}"
],
androidx : [
'appCompat' : "androidx.appcompat:appcompat:1.3.1"
],
dagger : [
'dagger' : "com.google.dagger:dagger:${versions.dagger}",
'daggerCompiler' : "com.google.dagger:dagger-compiler:${versions.dagger}"
],
rx : [
'rxKotlin' : "io.reactivex.rxjava2:rxkotlin:${versions.rxKotlin}",
'rxAndroid' : "io.reactivex.rxjava2:rxandroid:${versions.rxAndroid}"
],
jakewharton : [
'timber' : "com.jakewharton.timber:timber:${versions.timber}",
]
]

View file

@ -20,11 +20,11 @@ plugins {
}
android {
compileSdk 30
compileSdk versions.compileSdk
defaultConfig {
minSdk 21
targetSdk 30
minSdk versions.minSdk
targetSdk versions.targetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
@ -38,8 +38,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility versions.sourceCompat
targetCompatibility versions.targetCompat
}
kotlinOptions {
@ -52,7 +52,7 @@ android {
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation libs.androidx.appCompat
implementation 'com.google.android.material:material:1.4.0'
// Pref theme
implementation 'androidx.preference:preference-ktx:1.1.1'

View file

@ -3,11 +3,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdk 30
compileSdk versions.compileSdk
defaultConfig {
minSdk 21
targetSdk 30
minSdk versions.minSdk
targetSdk versions.targetSdk
// Multidex is useful for tests
multiDexEnabled true
@ -22,8 +22,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility versions.sourceCompat
targetCompatibility versions.targetCompat
}
kotlinOptions {
@ -33,14 +33,14 @@ android {
dependencies {
implementation project(":matrix-sdk-android")
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'io.reactivex.rxjava2:rxkotlin:2.4.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-rx2:$kotlin_coroutines_version"
implementation libs.androidx.appCompat
implementation libs.rx.rxKotlin
implementation libs.rx.rxAndroid
implementation libs.jetbrains.coroutinesRx2
// Paging
implementation "androidx.paging:paging-runtime-ktx:2.1.2"
// Logging
implementation 'com.jakewharton.timber:timber:5.0.1'
implementation libs.jakewharton.timber
}

View file

@ -14,12 +14,13 @@ buildscript {
}
android {
compileSdk 30
testOptions.unitTests.includeAndroidResources = true
compileSdk versions.compileSdk
defaultConfig {
minSdk 21
targetSdk 30
minSdk versions.minSdk
targetSdk versions.targetSdk
// Multidex is useful for tests
multiDexEnabled true
@ -65,8 +66,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility versions.sourceCompat
targetCompatibility versions.targetCompat
}
kotlinOptions {
@ -100,24 +101,17 @@ static def gitRevisionDate() {
dependencies {
def arrow_version = "0.8.2"
def moshi_version = '1.12.0'
def lifecycle_version = '2.2.0'
def arch_version = '2.1.0'
def markwon_version = '3.1.0'
def daggerVersion = '2.38.1'
def work_version = '2.5.0'
def retrofit_version = '2.9.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
implementation libs.jetbrains.kotlinStdlib
implementation libs.jetbrains.coroutinesCore
implementation libs.jetbrains.coroutinesAndroid
implementation "androidx.appcompat:appcompat:1.3.1"
implementation libs.androidx.appCompat
implementation "androidx.core:core-ktx:1.6.0"
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-extensions:${versions.lifecycle}"
implementation "androidx.lifecycle:lifecycle-common-java8:${versions.lifecycle}"
// Network
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
@ -128,10 +122,10 @@ dependencies {
implementation 'com.squareup.okhttp3:logging-interceptor'
implementation 'com.squareup.okhttp3:okhttp-urlconnection'
implementation "com.squareup.moshi:moshi-adapters:$moshi_version"
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"
implementation "com.squareup.moshi:moshi-adapters:${versions.moshi}"
kapt "com.squareup.moshi:moshi-kotlin-codegen:${versions.moshi}"
implementation "ru.noties.markwon:core:$markwon_version"
implementation "io.noties.markwon:core:${versions.markwon}"
// Image
implementation 'androidx.exifinterface:exifinterface:1.3.3'
@ -141,21 +135,21 @@ dependencies {
kapt 'dk.ilios:realmfieldnameshelper:2.0.0'
// Work
implementation "androidx.work:work-runtime-ktx:$work_version"
implementation "androidx.work:work-runtime-ktx:${versions.work}"
// FP
implementation "io.arrow-kt:arrow-core:$arrow_version"
implementation "io.arrow-kt:arrow-instances-core:$arrow_version"
implementation "io.arrow-kt:arrow-core:${versions.arrow}"
implementation "io.arrow-kt:arrow-instances-core:${versions.arrow}"
// olm lib is now hosted by jitpack: https://jitpack.io/#org.matrix.gitlab.matrix-org/olm
implementation 'org.matrix.gitlab.matrix-org:olm:3.2.4'
// DI
implementation "com.google.dagger:dagger:$daggerVersion"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
implementation libs.dagger.dagger
kapt libs.dagger.daggerCompiler
// Logging
implementation 'com.jakewharton.timber:timber:5.0.1'
implementation libs.jakewharton.timber
implementation 'com.facebook.stetho:stetho-okhttp3:1.6.0'
// Video compression
@ -170,11 +164,11 @@ dependencies {
// Note: version sticks to 1.9.2 due to https://github.com/mockk/mockk/issues/281
testImplementation 'io.mockk:mockk:1.12.0'
testImplementation 'org.amshove.kluent:kluent-android:1.68'
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
implementation libs.jetbrains.coroutinesAndroid
// Plant Timber tree for test
testImplementation 'net.lachlanmckee:timber-junit-rule:1.0.1'
kaptAndroidTest "com.google.dagger:dagger-compiler:$daggerVersion"
kaptAndroidTest libs.dagger.daggerCompiler
androidTestImplementation 'androidx.test:core:1.4.0'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
@ -182,8 +176,8 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'org.amshove.kluent:kluent-android:1.68'
androidTestImplementation 'io.mockk:mockk-android:1.12.0'
androidTestImplementation "androidx.arch.core:core-testing:$arch_version"
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
androidTestImplementation "androidx.arch.core:core-testing:${versions.arch}"
androidTestImplementation libs.jetbrains.coroutinesAndroid
// Plant Timber tree for test
androidTestImplementation 'net.lachlanmckee:timber-junit-rule:1.0.1'

View file

@ -19,12 +19,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
android {
compileSdk 30
compileSdk versions.compileSdk
defaultConfig {
minSdk 19
targetSdk 30
minSdk versions.minSdk
targetSdk versions.targetSdk
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
@ -39,11 +38,11 @@ android {
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation libs.jetbrains.kotlinStdlib
implementation libs.androidx.appCompat
implementation "androidx.fragment:fragment-ktx:1.3.6"
implementation 'androidx.exifinterface:exifinterface:1.3.3'
// Log
implementation 'com.jakewharton.timber:timber:5.0.1'
implementation libs.jakewharton.timber
}

View file

@ -102,17 +102,20 @@ ext.abiVersionCodes = ["armeabi-v7a": 1, "arm64-v8a": 2, "x86": 3, "x86_64": 4].
def buildNumber = System.env.BUILDKITE_BUILD_NUMBER as Integer ?: 0
android {
compileSdk 30
// Due to a bug introduced in Android gradle plugin 3.6.0, we have to specify the ndk version to use
// Ref: https://issuetracker.google.com/issues/144111441
ndkVersion "21.3.6528147"
compileSdk versions.compileSdk
defaultConfig {
applicationId "im.vector.app"
// Set to API 21: see #405
minSdk 21
targetSdk 30
minSdk versions.minSdk
targetSdk versions.targetSdk
multiDexEnabled true
renderscriptTargetApi 24
@ -289,8 +292,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility versions.sourceCompat
targetCompatibility versions.targetCompat
}
kotlinOptions {
@ -315,16 +318,9 @@ dependencies {
def epoxy_version = '4.6.2'
def fragment_version = '1.3.6'
def arrow_version = "0.8.2"
def markwon_version = '4.1.2'
def big_image_viewer_version = '1.8.1'
def glide_version = '4.12.0'
def moshi_version = '1.12.0'
def daggerVersion = '2.38.1'
def autofill_version = "1.1.0"
def work_version = '2.5.0'
def arch_version = '2.1.0'
def lifecycle_version = '2.2.0'
def rxbinding_version = '3.1.0'
def jjwt_version = '0.11.2'
@ -341,12 +337,12 @@ dependencies {
implementation project(":library:ui-styles")
implementation 'androidx.multidex:multidex:2.0.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
implementation libs.jetbrains.kotlinStdlib
implementation libs.jetbrains.coroutinesCore
implementation libs.jetbrains.coroutinesAndroid
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation libs.androidx.appCompat
implementation "androidx.fragment:fragment-ktx:$fragment_version"
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation "androidx.sharetarget:sharetarget:1.1.0"
@ -357,13 +353,13 @@ dependencies {
implementation "org.threeten:threetenbp:1.4.0:no-tzdb"
implementation "com.gabrielittner.threetenbp:lazythreetenbp:0.9.0"
implementation "com.squareup.moshi:moshi-adapters:$moshi_version"
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
implementation "com.squareup.moshi:moshi-adapters:${versions.moshi}"
implementation "androidx.lifecycle:lifecycle-extensions:${versions.lifecycle}"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"
kapt "com.squareup.moshi:moshi-kotlin-codegen:${versions.moshi}"
// Log
implementation 'com.jakewharton.timber:timber:5.0.1'
implementation libs.jakewharton.timber
// Debug
implementation 'com.facebook.stetho:stetho:1.6.0'
@ -372,8 +368,8 @@ dependencies {
implementation 'com.googlecode.libphonenumber:libphonenumber:8.12.32'
// rx
implementation 'io.reactivex.rxjava2:rxkotlin:2.4.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation libs.rx.rxKotlin
implementation libs.rx.rxAndroid
implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.1'
// RXBinding
implementation "com.jakewharton.rxbinding3:rxbinding:$rxbinding_version"
@ -387,13 +383,13 @@ dependencies {
implementation 'com.airbnb.android:mvrx:1.5.1'
// Work
implementation "androidx.work:work-runtime-ktx:$work_version"
implementation "androidx.work:work-runtime-ktx:${versions.work}"
// Paging
implementation "androidx.paging:paging-runtime-ktx:2.1.2"
// Functional Programming
implementation "io.arrow-kt:arrow-core:$arrow_version"
implementation "io.arrow-kt:arrow-core:${versions.arrow}"
// Pref
implementation 'androidx.preference:preference-ktx:1.1.1'
@ -402,8 +398,8 @@ dependencies {
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'me.gujun.android:span:1.7'
implementation "io.noties.markwon:core:$markwon_version"
implementation "io.noties.markwon:html:$markwon_version"
implementation "io.noties.markwon:core:${versions.markwon}"
implementation "io.noties.markwon:html:${versions.markwon}"
implementation 'com.googlecode.htmlcompressor:htmlcompressor:1.5.2'
implementation 'me.saket:better-link-movement-method:2.2.0'
implementation 'com.google.android:flexbox:2.0.1'
@ -451,8 +447,8 @@ dependencies {
implementation 'nl.dionsegijn:konfetti:1.3.2'
implementation 'com.github.jetradarmobile:android-snowfall:1.2.1'
// DI
implementation "com.google.dagger:dagger:$daggerVersion"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
implementation libs.dagger.dagger
kapt libs.dagger.daggerCompiler
// gplay flavor only
gplayImplementation('com.google.firebase:firebase-messaging:22.0.0') {
@ -517,7 +513,7 @@ dependencies {
androidTestImplementation "androidx.test.espresso:espresso-contrib:$espresso_version"
androidTestImplementation "androidx.test.espresso:espresso-intents:$espresso_version"
androidTestImplementation "org.amshove.kluent:kluent-android:$kluent_version"
androidTestImplementation "androidx.arch.core:core-testing:$arch_version"
androidTestImplementation "androidx.arch.core:core-testing:${versions.arch}"
// Plant Timber tree for test
androidTestImplementation 'net.lachlanmckee:timber-junit-rule:1.0.1'
// "The one who serves a great Espresso"