build: migrate to version catalogs

This commit is contained in:
Oscar Mira 2025-01-27 16:38:44 +01:00
parent 8dbf0ffb6b
commit 9f54eadc61
No known key found for this signature in database
GPG key ID: B371B98C5DC32237
6 changed files with 99 additions and 83 deletions

View file

@ -1,10 +1,9 @@
plugins {
id('com.android.application') version '8.8.0' apply false
id('com.android.library') version '8.8.0' apply false
id('org.jetbrains.kotlin.android') version '1.9.10' apply false
id('org.jetbrains.kotlin.plugin.parcelize') version '1.9.10' apply false
id('com.google.devtools.ksp') version '1.9.10-1.0.13' apply false
id('com.google.protobuf') version '0.9.4' apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.parcelize) apply false
alias(libs.plugins.ksp) apply false
}
wrapper {

View file

@ -5,9 +5,6 @@ apply plugin: 'com.google.devtools.ksp'
ext {
composeVersion = '1.6.2'
composeCompilerVersion = '1.5.3'
lifecycleVersion = '2.7.0'
navigationVersion = '2.7.7'
roomVersion = '2.6.1'
}
android {
@ -64,29 +61,27 @@ android {
}
dependencies {
implementation "androidx.core:core-ktx:1.9.0"
implementation libs.core.ktx
implementation "androidx.compose.ui:ui:$composeVersion"
implementation "androidx.compose.material3:material3:1.2.0"
implementation "androidx.compose.ui:ui-tooling-preview:$composeVersion"
implementation "com.google.accompanist:accompanist-systemuicontroller:0.32.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-runtime-compose:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-service:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-process:$lifecycleVersion"
implementation "androidx.activity:activity-compose:1.8.2"
implementation "androidx.datastore:datastore-preferences:1.0.0"
implementation "androidx.room:room-runtime:$roomVersion"
implementation "androidx.room:room-ktx:$roomVersion"
implementation "androidx.navigation:navigation-runtime-ktx:$navigationVersion"
implementation "androidx.navigation:navigation-compose:$navigationVersion"
ksp "androidx.room:room-compiler:$roomVersion"
implementation libs.accompanist.systemuicontroller
implementation libs.androidx.lifecycle.viewmodel.compose
implementation libs.androidx.lifecycle.runtime.compose
implementation libs.androidx.lifecycle.service
implementation libs.androidx.activity.compose
implementation libs.androidx.datastore.preferences
implementation libs.androidx.room.runtime
implementation libs.androidx.room.ktx
implementation libs.androidx.navigation.compose
ksp libs.androidx.room.compiler
implementation project(':lib')
testImplementation "junit:junit:4.13.2"
testImplementation testLibs.junit4
androidTestImplementation "androidx.test.ext:junit:1.1.5"
androidTestImplementation "androidx.test.espresso:espresso-core:3.5.1"
androidTestImplementation testLibs.androidx.test.ext.junit
androidTestImplementation testLibs.androidx.test.espresso.core
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$composeVersion"
debugImplementation "androidx.compose.ui:ui-tooling:$composeVersion"

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

@ -0,0 +1,37 @@
[versions]
accompanist = "0.32.0"
android-gradle-plugin = "8.8.0"
androidx-activity = "1.8.2"
androidx-datastore = "1.0.0"
androidx-lifecycle = "2.5.1"
androidx-navigation = "2.7.7"
core-ktx = "1.9.0"
kotlin = "1.9.10"
kotlinx-coroutines = '1.6.4'
ksp = "1.9.10-1.0.13"
okhttp = "4.10.0"
room = "2.6.1"
[libraries]
accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanist" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" }
androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "androidx-datastore" }
androidx-lifecycle-service = { module = "androidx.lifecycle:lifecycle-service", version.ref = "androidx-lifecycle" }
androidx-lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "androidx-lifecycle" }
androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" }
androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle" }
androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "androidx-navigation" }
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" }
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
core-ktx = { module = "androidx.core:core-ktx", version.ref = "core-ktx" }
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines"}
okhttp = { module = "com.squareup.okhttp3:okhttp" }
okhttp-bom = { module = "com.squareup.okhttp3:okhttp-bom", version.ref = "okhttp" }
[plugins]
android-application = { id = "com.android.application", version.ref = "android-gradle-plugin" }
android-library = { id = "com.android.library", version.ref = "android-gradle-plugin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }

View file

@ -0,0 +1,21 @@
[versions]
androidx-test-core = "1.4.0"
androidx-test-espresso = "3.5.1"
androidx-test-ext-junit = "1.1.3"
androidx-test-ext-truth = "1.4.0"
junit4 = "4.13.2"
mockk = "1.12.5"
truth = "1.1.3"
[libraries]
androidx-test-core = { module = "androidx.test:core", version.ref = "androidx-test-core" }
androidx-test-core-ktx = { module = "androidx.test:core-ktx", version.ref = "androidx-test-core" }
androidx-test-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-test-espresso" }
androidx-test-ext-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-test-ext-junit" }
androidx-test-ext-junit-ktx = { module = "androidx.test.ext:junit-ktx", version.ref = "androidx-test-ext-junit" }
androidx-test-ext-truth = { module = "androidx.test.ext:truth", version.ref = "androidx-test-ext-truth" }
androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidx-test-core" }
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test-core" }
junit4 = { module = "junit:junit", version.ref = "junit4" }
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }
truth = { module = "com.google.truth:truth", version.ref = "truth" }

View file

@ -1,27 +1,8 @@
apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'org.jetbrains.kotlin.plugin.parcelize'
apply plugin: 'com.google.protobuf'
//apply from: 'deploy.gradle' // FIXME
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.20.1'
}
generateProtoTasks {
all().each { task ->
task.builtins {
java {
option "lite"
}
kotlin {
option "lite"
}
}
}
}
}
android {
namespace = "im.molly.monero"
@ -97,46 +78,24 @@ android {
}
dependencies {
api 'com.squareup.okhttp3:okhttp:4.10.0'
api platform(libs.okhttp.bom)
api libs.okhttp
implementation 'androidx.core:core-ktx:1.9.0'
// implementation 'androidx.appcompat:appcompat:1.3.0'
// implementation 'com.google.android.material:material:1.4.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
implementation 'com.google.protobuf:protobuf-kotlin-lite:3.20.1'
implementation 'androidx.datastore:datastore-core:1.0.0'
implementation 'androidx.lifecycle:lifecycle-service:2.5.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
implementation libs.core.ktx
implementation libs.kotlinx.coroutines.android
implementation libs.androidx.lifecycle.runtime.ktx
implementation libs.androidx.lifecycle.service
testImplementation 'junit:junit:4.13.2'
testImplementation "com.google.truth:truth:1.1.3"
testImplementation "io.mockk:mockk:1.12.5"
testImplementation testLibs.junit4
testImplementation testLibs.mockk
testImplementation testLibs.truth
// androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// To use the androidx.test.core APIs
androidTestImplementation "androidx.test:core:1.4.0"
// Kotlin extensions for androidx.test.core
androidTestImplementation "androidx.test:core-ktx:1.4.0"
// To use the androidx.test.espresso
// androidTestImplementation "androidx.test:espresso:espresso-core:3.4.0"
// To use the JUnit Extension APIs
androidTestImplementation "androidx.test.ext:junit:1.1.3"
// Kotlin extensions for androidx.test.ext.junit
androidTestImplementation "androidx.test.ext:junit-ktx:1.1.3"
// To use the Truth Extension APIs
androidTestImplementation "androidx.test.ext:truth:1.4.0"
// To use the androidx.test.runner APIs
androidTestImplementation "androidx.test:runner:1.4.0"
// To use android test orchestrator
// androidTestUtil "androidx.test:orchestrator:1.4.1"
androidTestImplementation "androidx.test:rules:1.4.0"
androidTestImplementation "io.mockk:mockk-android:1.12.5"
androidTestImplementation testLibs.androidx.test.core
androidTestImplementation testLibs.androidx.test.core.ktx
androidTestImplementation testLibs.androidx.test.ext.junit
androidTestImplementation testLibs.androidx.test.ext.junit.ktx
androidTestImplementation testLibs.androidx.test.ext.truth
androidTestImplementation testLibs.androidx.test.rules
androidTestImplementation testLibs.androidx.test.runner
androidTestImplementation testLibs.mockk
}

View file

@ -12,6 +12,11 @@ dependencyResolutionManagement {
google()
mavenCentral()
}
versionCatalogs {
testLibs {
from(files('gradle/test-libs.versions.toml'))
}
}
}
includeProject(':lib', 'lib/android')