Migrate dependencies to gradle version catalog

This commit is contained in:
William Brawner 2021-06-03 18:54:02 -06:00
parent e345afb2b7
commit bdacaaae34
5 changed files with 73 additions and 41 deletions

View file

@ -21,13 +21,13 @@ try {
}
android {
compileSdk = 29
compileSdk = libs.versions.maxSdk.get().toInt()
defaultConfig {
applicationId = "com.wbrawner.pihelper"
minSdk = 23
targetSdk = 29
versionCode = 2
versionName = "1.0.0"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.maxSdk.get().toInt()
versionCode = libs.versions.versionCode.get().toInt()
versionName = libs.versions.versionName.get()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
signingConfig = signingConfigs["debug"]
}
@ -63,24 +63,19 @@ android {
dependencies {
implementation(project(":piholeclient"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${rootProject.ext["kotlinVersion"]}")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:${rootProject.ext["coroutinesVersion"]}")
implementation("org.koin:koin-androidx-viewmodel:${rootProject.ext["koinVersion"]}")
implementation("androidx.appcompat:appcompat:1.2.0")
implementation("androidx.core:core-ktx:1.3.2")
implementation(libs.bundles.coroutines)
implementation("io.insert-koin:koin-androidx-viewmodel:${libs.versions.koin.get()}")
implementation(libs.androidx.core)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation("androidx.constraintlayout:constraintlayout:2.0.4")
implementation("com.google.android.material:material:1.3.0-alpha04")
implementation("androidx.legacy:legacy-support-v4:1.0.0")
implementation("androidx.security:security-crypto:1.0.0-rc01")
implementation("androidx.preference:preference-ktx:1.1.1")
testImplementation("junit:junit:4.13.1")
androidTestImplementation("androidx.test.ext:junit:1.1.2")
androidTestImplementation("androidx.test.espresso:espresso-core:3.3.0")
val navigation_version = "2.3.2"
implementation("androidx.navigation:navigation-fragment-ktx:$navigation_version")
implementation("androidx.navigation:navigation-ui-ktx:$navigation_version")
val lifecycle_version = "2.2.0"
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version")
implementation(libs.preference)
testImplementation(libs.junit)
androidTestImplementation(libs.test.ext)
androidTestImplementation(libs.espresso)
implementation(libs.bundles.navigation)
implementation(libs.bundles.lifecycle)
}

View file

@ -3,11 +3,7 @@ buildscript {
google()
mavenCentral()
}
val coroutinesVersion by extra("1.3.2")
val hiltVersion by extra("2.36")
val koinVersion by extra("2.0.1")
val kotlinVersion by extra("1.4.32")
val okHttpVersion by extra("4.2.2")
dependencies {
classpath("com.android.tools.build:gradle:7.0.0-beta03")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")

43
gradle/libs.versions.toml Normal file
View file

@ -0,0 +1,43 @@
[versions]
androidx-core = "1.3.2"
androidx-appcompat = "1.2.0"
coroutines = "1.4.3"
espresso = "3.3.0"
koin = "2.2.3"
kotlin = "1.4.32"
lifecycle = "2.2.0"
material = "1.3.0"
maxSdk = "30"
moshi = "1.9.2"
minSdk = "21"
navigation = "2.3.2"
okhttp = "4.2.2"
versionCode = "1"
versionName = "1.0"
[libraries]
androidx-core = { module = "androidx.core:core-ktx", version.ref = "androidx-core" }
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
material = { module = "com.google.android.material:material", version.ref = "material" }
moshi-core = { module = "com.squareup.moshi:moshi", version.ref = "moshi" }
moshi-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi" }
navigation-fragment = { module = "androidx.navigation:navigation-fragment-ktx", version.ref = "navigation" }
navigation-ui = { module = "androidx.navigation:navigation-ui-ktx", version.ref = "navigation" }
coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" }
preference = { module = "androidx.preference:preference-ktx", version = "1.1.1" }
lifecycle-livedata = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "lifecycle" }
lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycle" }
junit = { module = "junit:junit", version = "4.12" }
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
test-ext = { module = "androidx.test.ext:junit", version = "1.1.2" }
espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso" }
[bundles]
coroutines = ["coroutines-core", "coroutines-android"]
lifecycle = ["lifecycle-livedata", "lifecycle-viewmodel"]
navigation = ["navigation-fragment", "navigation-ui"]

View file

@ -5,10 +5,10 @@ plugins {
}
android {
compileSdk = 29
compileSdk = libs.versions.maxSdk.get().toInt()
defaultConfig {
minSdk = 23
targetSdk = 29
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.maxSdk.get().toInt()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
@ -30,17 +30,14 @@ android {
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${rootProject.ext["kotlinVersion"]}")
implementation("org.jetbrains.kotlin:kotlin-reflect:${rootProject.ext["kotlinVersion"]}")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${rootProject.ext["coroutinesVersion"]}")
implementation("org.koin:koin-core:${rootProject.ext["koinVersion"]}")
implementation("com.squareup.okhttp3:okhttp:${rootProject.ext["okHttpVersion"]}")
implementation("com.squareup.okhttp3:logging-interceptor:${rootProject.ext["okHttpVersion"]}")
implementation("androidx.appcompat:appcompat:1.1.0")
implementation("androidx.core:core-ktx:1.1.0")
implementation("com.squareup.moshi:moshi:1.9.2")
kapt("com.squareup.moshi:moshi-kotlin-codegen:1.9.2")
testImplementation("junit:junit:4.12")
androidTestImplementation("androidx.test.ext:junit:1.1.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0")
implementation("io.insert-koin:koin-core:${libs.versions.koin.get()}")
implementation("com.squareup.okhttp3:okhttp:${libs.versions.okhttp.get()}")
implementation("com.squareup.okhttp3:logging-interceptor:${libs.versions.okhttp.get()}")
implementation(libs.androidx.core)
implementation(libs.androidx.appcompat)
implementation(libs.bundles.coroutines)
implementation(libs.kotlin.reflect)
implementation(libs.moshi.core)
kapt(libs.moshi.codegen)
testImplementation(libs.junit)
}

View file

@ -1,3 +1,4 @@
enableFeaturePreview("VERSION_CATALOGS")
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {