Skip to content

Commit

Permalink
Migrate to a Gradle version catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyhs committed Sep 1, 2024
1 parent 65dbcb6 commit a105f15
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 66 deletions.
99 changes: 44 additions & 55 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id 'com.android.application'
id 'com.google.dagger.hilt.android'
id 'com.google.devtools.ksp'
id 'org.jetbrains.kotlin.android'
alias libs.plugins.android.application
alias libs.plugins.hilt.android
alias libs.plugins.kotlin.android
alias libs.plugins.ksp
}

def secretProps = new Properties()
Expand Down Expand Up @@ -69,59 +69,48 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation libs.kotlin.stdlib

final coroutinesVersion = '1.8.1'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion"
implementation libs.coroutines.android
testImplementation libs.coroutines.test

final composeBom = platform('androidx.compose:compose-bom:2024.08.00')
final composeBom = platform(libs.compose.bom)
implementation composeBom
testImplementation composeBom
implementation 'androidx.compose.material3:material3'
implementation 'androidx.compose.runtime:runtime-livedata'
implementation 'androidx.compose.ui:ui-tooling-preview'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
debugImplementation 'androidx.compose.ui:ui-tooling'

final activityVersion = '1.9.1'
implementation "androidx.activity:activity-compose:$activityVersion"
implementation "androidx.activity:activity-ktx:$activityVersion"
implementation 'androidx.annotation:annotation:1.8.2'
implementation 'androidx.appcompat:appcompat:1.7.0'
final lifecycleVersion = '2.8.4'
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"

[
"com.google.dagger:hilt-compiler:$daggerVersion",
].each {
ksp it
kspTest it
}
implementation "com.google.dagger:hilt-android:$daggerVersion"
testImplementation "com.google.dagger:hilt-android-testing:$daggerVersion"

final moshiVersion = '1.15.0'
implementation "com.squareup.moshi:moshi:$moshiVersion"
ksp "com.squareup.moshi:moshi-kotlin-codegen:$moshiVersion"

final retrofitVersion = '2.11.0'
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-moshi:$retrofitVersion"
ksp "com.squareup.retrofit2:response-type-keeper:$retrofitVersion"

testImplementation 'androidx.arch.core:core-testing:2.2.0'
testImplementation 'androidx.compose.ui:ui-test-junit4'
testImplementation 'androidx.test:core:1.6.1'
final espressoVersion = '3.6.1'
testImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
testImplementation "androidx.test.espresso:espresso-intents:$espressoVersion"
testImplementation 'androidx.test.ext:junit:1.2.1'

final accompanistVersion = '0.30.0'
testImplementation "com.google.accompanist:accompanist-testharness:$accompanistVersion"
testImplementation 'io.mockk:mockk:1.13.9'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.robolectric:robolectric:4.11.1'
implementation libs.compose.material3
implementation libs.compose.runtime.livedata
implementation libs.compose.ui.tooling.preview
debugImplementation libs.compose.ui.test.manifest
debugImplementation libs.compose.ui.tooling

implementation libs.activity.compose
implementation libs.activity.ktx
implementation libs.androidx.annotation
implementation libs.appcompat
implementation libs.lifecycle.livedata.ktx
implementation libs.lifecycle.viewmodel.ktx

ksp libs.hilt.compiler
kspTest libs.hilt.compiler
implementation libs.hilt.android
testImplementation libs.hilt.android.testing

implementation libs.moshi
ksp libs.moshi.kotlin.codegen

implementation libs.retrofit
implementation libs.retrofit.converter.moshi
ksp libs.retrofit.responseTypeKeeper

testImplementation libs.androidx.core.testing
testImplementation libs.compose.ui.test.junit4
testImplementation libs.androidx.test.core
testImplementation libs.espresso.core
testImplementation libs.espresso.intents
testImplementation libs.androidx.junit

testImplementation libs.accompanist.testharness
testImplementation libs.mockk
testImplementation libs.junit
testImplementation libs.robolectric
}
15 changes: 4 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext {
daggerVersion = '2.49'
kotlinVersion = '1.9.21'
}
}

plugins {
id 'com.android.application' version '8.5.2' apply false
id 'com.google.dagger.hilt.android' version "$daggerVersion" apply false
id 'com.google.devtools.ksp' version '1.9.21-1.0.16' apply false
id 'org.jetbrains.kotlin.android' version "$kotlinVersion" apply false
alias libs.plugins.android.application apply false
alias libs.plugins.hilt.android apply false
alias libs.plugins.kotlin.android apply false
alias libs.plugins.ksp apply false
}
62 changes: 62 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[versions]
accompanist = "0.30.0"
activity = "1.9.1"
agp = "8.5.2"
androidxAnnotation = "1.8.2"
androidxCoreTesting = "2.2.0"
androidxJunit = "1.2.1"
androidxTestCore = "1.6.1"
appcompat = "1.7.0"
composeBom = "2024.08.00"
coroutines = "1.8.1"
dagger = "2.49"
espresso = "3.6.1"
junit = "4.13.2"
kotlin = "1.9.21"
ksp = "1.9.21-1.0.16"
lifecycle = "2.8.4"
mockk = "1.13.9"
moshi = "1.15.0"
retrofit = "2.11.0"
robolectric = "4.11.1"

[libraries]
accompanist-testharness = { module = "com.google.accompanist:accompanist-testharness", version.ref = "accompanist" }
activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity" }
activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "activity" }
androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "androidxAnnotation" }
androidx-core-testing = { module = "androidx.arch.core:core-testing", version.ref = "androidxCoreTesting" }
androidx-junit = { module = "androidx.test.ext:junit", version.ref = "androidxJunit" }
androidx-test-core = { module = "androidx.test:core", version.ref = "androidxTestCore" }
appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" }
compose-material3 = { module = "androidx.compose.material3:material3" }
compose-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata" }
compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" }
compose-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest" }
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" }
coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso" }
espresso-intents = { module = "androidx.test.espresso:espresso-intents", version.ref = "espresso" }
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "dagger" }
hilt-android-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "dagger" }
hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "dagger" }
junit = { module = "junit:junit", version.ref = "junit" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
lifecycle-livedata-ktx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "lifecycle" }
lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycle" }
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }
moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" }
moshi-kotlin-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi" }
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
retrofit-converter-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit" }
retrofit-responseTypeKeeper = { module = "com.squareup.retrofit2:response-type-keeper", version.ref = "retrofit" }
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
hilt-android = { id = "com.google.dagger.hilt.android", version.ref = "dagger" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }

0 comments on commit a105f15

Please sign in to comment.