Skip to content

Commit 8c60d2c

Browse files
committed
chore: Add version catalog to hold dependencies and versions
1 parent 271c414 commit 8c60d2c

File tree

8 files changed

+114
-124
lines changed

8 files changed

+114
-124
lines changed

build.gradle.kts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
plugins {
22
//trick: for the same plugin versions in all sub-modules
3-
id("com.android.application").version(Versions.GRADLE_PLUGIN).apply(false)
4-
id("com.android.library").version(Versions.GRADLE_PLUGIN).apply(false)
5-
id("com.vanniktech.maven.publish").version(Versions.PUBLISH_PLUGIN).apply(false)
6-
id("io.gitlab.arturbosch.detekt").version(Versions.DETEKT_PLUGIN).apply(false)
7-
id("org.jlleitschuh.gradle.ktlint").version(Versions.KTLINT_PLUGIN).apply(false)
8-
id("org.jetbrains.kotlinx.kover").version(Versions.KOVER_PLUGIN).apply(false)
9-
kotlin("android").version(Versions.KOTLIN).apply(false)
10-
kotlin("multiplatform").version(Versions.KOTLIN).apply(false)
3+
id("com.android.application") version libs.versions.gradlePlugin apply false
4+
id("com.android.library").version(libs.versions.gradlePlugin).apply(false)
5+
id("com.vanniktech.maven.publish").version(libs.versions.publishPlugin).apply(false)
6+
id("io.gitlab.arturbosch.detekt").version(libs.versions.detektPlugin).apply(false)
7+
id("org.jlleitschuh.gradle.ktlint").version(libs.versions.ktlintPlugin).apply(false)
8+
id("org.jetbrains.kotlinx.kover").version(libs.versions.koverPlugin).apply(false)
9+
kotlin("android").version(libs.versions.kotlin).apply(false)
10+
kotlin("multiplatform").version(libs.versions.kotlin).apply(false)
1111
}
1212

1313
tasks.register("clean", Delete::class) {

buildSrc/src/main/kotlin/Config.kt

Lines changed: 0 additions & 5 deletions
This file was deleted.

buildSrc/src/main/kotlin/Dependencies.kt

Lines changed: 0 additions & 67 deletions
This file was deleted.

gradle/libs.versions.toml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
[versions]
2+
coil = "2.2.2"
3+
compose = "1.3.3"
4+
composeActivity = "1.6.1"
5+
composeFoundation = "1.3.1"
6+
composeLivedata = "1.3.3"
7+
composeNavigation = "2.5.3"
8+
config-compile-sdk-version = "33"
9+
config-min-sdk-version = "23"
10+
config-target-sdk-version = "33"
11+
detektPlugin = "1.22.0"
12+
gradlePlugin = "7.3.0"
13+
koin = "3.2.0"
14+
kotlin = "1.7.20"
15+
koverPlugin = "0.6.1"
16+
ktlintPlugin = "11.0.0"
17+
ktor = "2.2.2"
18+
mockk = "1.13.4"
19+
mockkCommon = "1.12.5"
20+
publishPlugin = "0.24.0"
21+
spmPlugin = "2.0.5-arm64"
22+
spring = "2.4.5"
23+
24+
[libraries]
25+
# Spring
26+
spring-boot-dependencies = { group = "org.springframework.boot", name = "spring-boot-dependencies", version.ref = "spring" }
27+
spring-boot-web = { group = "org.springframework.boot", name = "spring-boot-starter-web" }
28+
29+
#Network
30+
ktor-android = { group = "io.ktor", name = "ktor-client-android", version.ref = "ktor" }
31+
ktor-core = { group = "io.ktor", name = "ktor-client-core", version.ref = "ktor" }
32+
ktor-darwin = { group = "io.ktor", name = "ktor-client-darwin", version.ref = "ktor" }
33+
ktor-ios = { group = "io.ktor", name = "ktor-client-ios", version.ref = "ktor" }
34+
ktor-logging = { group = "io.ktor", name = "ktor-client-logging", version.ref = "ktor" }
35+
ktor-negotiation = { group = "io.ktor", name = "ktor-client-content-negotiation", version.ref = "ktor" }
36+
ktor-okhttp = { group = "io.ktor", name = "ktor-client-okhttp", version.ref = "ktor" }
37+
ktor-serialization = { group = "io.ktor", name = "ktor-serialization-kotlinx-json", version.ref = "ktor" }
38+
39+
# DI
40+
koin-android = { group = "io.insert-koin", name = "koin-android", version.ref = "koin" }
41+
koin-compose = { group = "io.insert-koin", name = "koin-androidx-compose", version.ref = "koin" }
42+
koin-core = { group = "io.insert-koin", name = "koin-core", version.ref = "koin" }
43+
44+
#UI
45+
androidx-compose-activity = { group = "androidx.activity", name = "activity-compose", version.ref = "composeActivity" }
46+
androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation", version.ref = "composeFoundation" }
47+
androidx-compose-livedata = { group = "androidx.compose.runtime", name = "runtime-livedata", version.ref = "composeLivedata" }
48+
androidx-compose-material = { group = "androidx.compose.material", name = "material", version.ref = "composeFoundation" }
49+
androidx-compose-navigation = { group = "androidx.navigation", name = "navigation-compose", version.ref = "composeNavigation" }
50+
androidx-compose-tooling = { group = "androidx.compose.ui", name = "ui-tooling", version.ref = "compose" }
51+
androidx-compose-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview", version.ref = "compose" }
52+
coil = { group = "io.coil-kt", name = "coil-compose", version.ref = "coil" }
53+
54+
#Test
55+
koin-test = { group = "io.insert-koin", name = "koin-test", version.ref = "koin" }
56+
ktor-client-mock = { group = "io.ktor", name = "ktor-client-mock", version.ref = "ktor" }
57+
mockk = { group = "io.mockk", name = "mockk", version.ref = "mockk" }
58+
mockk-common = { group = "io.mockk", name = "mockk-common", version.ref = "mockkCommon" }
59+
mockk-jvm = { group = "io.mockk", name = "mockk-jvm", version.ref = "mockk" }
60+
61+
[plugins]
62+
android-application = { id = "com.android.application", version.ref = "gradlePlugin" }
63+
android-library = { id = "com.android.library", version.ref = "gradlePlugin" }

sample/android/build.gradle.kts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ plugins {
77

88
android {
99
namespace = "co.yml.ychat.android"
10-
compileSdk = Config.COMPILE_SDK_VERSION
10+
compileSdk = libs.versions.config.compile.sdk.version.get().toInt()
1111
defaultConfig {
1212
applicationId = "co.yml.ychat.android"
13-
minSdk = Config.MIN_SDK_VERSION
14-
targetSdk = Config.TARGET_SDK_VERSION
13+
minSdk = libs.versions.config.min.sdk.version.get().toInt()
14+
targetSdk = libs.versions.config.target.sdk.version.get().toInt()
1515
versionCode = 1
1616
versionName = "1.0"
1717

@@ -45,16 +45,15 @@ android {
4545

4646
dependencies {
4747
implementation(project(":ychat"))
48-
implementation(Dependencies.UI.COMPOSE_UI)
49-
implementation(Dependencies.UI.COMPOSE_TOOLING)
50-
implementation(Dependencies.UI.COMPOSE_TOOLING_PREVIEW)
51-
implementation(Dependencies.UI.COMPOSE_FOUNDATION)
52-
implementation(Dependencies.UI.COMPOSE_MATERIAL)
53-
implementation(Dependencies.UI.COMPOSE_ACTIVITY)
54-
implementation(Dependencies.UI.COMPOSE_NAVIGATION)
55-
implementation(Dependencies.UI.COMPOSE_LIVEDATA)
56-
implementation(Dependencies.UI.COIL)
57-
implementation(Dependencies.DI.KOIN_CORE)
58-
implementation(Dependencies.DI.KOIN_ANDROID)
59-
implementation(Dependencies.DI.KOIN_COMPOSE)
48+
implementation(libs.androidx.compose.tooling)
49+
implementation(libs.androidx.compose.tooling.preview)
50+
implementation(libs.androidx.compose.foundation)
51+
implementation(libs.androidx.compose.material)
52+
implementation(libs.androidx.compose.activity)
53+
implementation(libs.androidx.compose.navigation)
54+
implementation(libs.androidx.compose.livedata)
55+
implementation(libs.coil)
56+
implementation(libs.koin.core)
57+
implementation(libs.koin.android)
58+
implementation(libs.koin.compose)
6059
}

sample/jvm/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id("org.springframework.boot").version(Versions.SPRING)
2+
id("org.springframework.boot").version(libs.versions.spring)
33
java
44
}
55

@@ -10,6 +10,6 @@ java {
1010

1111
dependencies {
1212
implementation(project(":ychat"))
13-
implementation(platform(Dependencies.Spring.SPRING_DEP))
14-
implementation(Dependencies.Spring.SPRING_WEB)
13+
implementation(platform(libs.spring.boot.dependencies))
14+
implementation(libs.spring.boot.web)
1515
}

ychat-core/build.gradle.kts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,23 @@ kotlin {
3737
sourceSets {
3838
val commonMain by getting {
3939
dependencies {
40-
api(Dependencies.Network.KTOR_NEGOTIATION)
41-
api(Dependencies.Network.KTOR_SERIALIZATION)
42-
api(Dependencies.Network.KTOR_CORE)
43-
api(Dependencies.Network.KTOR_LOGGING)
40+
api(libs.ktor.negotiation)
41+
api(libs.ktor.serialization)
42+
api(libs.ktor.core)
43+
api(libs.ktor.logging)
4444
}
4545
}
4646
val commonTest by getting {
4747
dependencies {
4848
implementation(kotlin("test"))
49-
implementation(Dependencies.Test.MOCKK_COMMON)
50-
implementation(Dependencies.Test.KTOR)
51-
implementation(Dependencies.Test.KOIN)
49+
implementation(libs.mockk.common)
50+
implementation(libs.ktor.client.mock)
51+
implementation(libs.koin.test)
5252
}
5353
}
5454
val androidMain by getting {
5555
dependencies {
56-
implementation(Dependencies.Network.KTOR_OKHTTP)
56+
implementation(libs.ktor.okhttp)
5757
}
5858
}
5959
val iosX64Main by getting
@@ -65,7 +65,7 @@ kotlin {
6565
iosArm64Main.dependsOn(this)
6666
iosSimulatorArm64Main.dependsOn(this)
6767
dependencies {
68-
implementation(Dependencies.Network.KTOR_IOS)
68+
implementation(libs.ktor.ios)
6969
}
7070
}
7171
val macosArm64Main by getting
@@ -75,31 +75,31 @@ kotlin {
7575
macosArm64Main.dependsOn(this)
7676
macosX64Main.dependsOn(this)
7777
dependencies {
78-
implementation(Dependencies.Network.KTOR_DARWIN)
78+
implementation(libs.ktor.darwin)
7979
}
8080
}
8181
val iosTest by creating {
8282
dependsOn(commonTest)
8383
}
8484
val jvmMain by getting {
8585
dependencies {
86-
implementation(Dependencies.Network.KTOR_OKHTTP)
86+
implementation(libs.ktor.okhttp)
8787
}
8888
}
8989
val jvmTest by getting {
9090
dependencies {
91-
implementation(Dependencies.Test.MOCKK_JVM)
91+
implementation(libs.mockk.jvm)
9292
}
9393
}
9494
}
9595
}
9696

9797
android {
9898
namespace = "co.yml.ychat.core"
99-
compileSdk = Config.COMPILE_SDK_VERSION
99+
compileSdk = libs.versions.config.compile.sdk.version.get().toInt()
100100
defaultConfig {
101-
minSdk = Config.MIN_SDK_VERSION
102-
targetSdk = Config.TARGET_SDK_VERSION
101+
minSdk = libs.versions.config.min.sdk.version.get().toInt()
102+
targetSdk = libs.versions.config.target.sdk.version.get().toInt()
103103
}
104104
}
105105

ychat/build.gradle.kts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
kotlin("multiplatform")
3-
kotlin("plugin.serialization").version(Versions.KOTLIN)
4-
id("io.github.luca992.multiplatform-swiftpackage").version(Versions.SPM_PLUGIN)
3+
kotlin("plugin.serialization").version(libs.versions.kotlin)
4+
id("io.github.luca992.multiplatform-swiftpackage").version(libs.versions.spmPlugin)
55
id("com.vanniktech.maven.publish")
66
id("com.android.library")
77
id("io.gitlab.arturbosch.detekt")
@@ -53,22 +53,22 @@ kotlin {
5353
sourceSets {
5454
val commonMain by getting {
5555
dependencies {
56-
implementation(Dependencies.DI.KOIN_CORE)
56+
implementation(libs.koin.core)
5757
implementation(project(":ychat-core"))
5858
}
5959
}
6060
val commonTest by getting {
6161
dependencies {
6262
implementation(kotlin("test"))
63-
implementation(Dependencies.Test.MOCKK_COMMON)
64-
implementation(Dependencies.Test.KTOR)
65-
implementation(Dependencies.Test.KOIN)
63+
implementation(libs.mockk.common)
64+
implementation(libs.ktor.client.mock)
65+
implementation(libs.koin.test)
6666
}
6767
}
6868
val androidMain by getting
6969
val androidTest by getting {
7070
dependencies {
71-
implementation(Dependencies.Test.MOCKK)
71+
implementation(libs.mockk)
7272
}
7373
}
7474
val iosX64Main by getting
@@ -99,18 +99,18 @@ kotlin {
9999
val jvmMain by getting
100100
val jvmTest by getting {
101101
dependencies {
102-
implementation(Dependencies.Test.MOCKK_JVM)
102+
implementation(libs.mockk.jvm)
103103
}
104104
}
105105
}
106106
}
107107

108108
android {
109109
namespace = "co.yml.ychat"
110-
compileSdk = Config.COMPILE_SDK_VERSION
110+
compileSdk = libs.versions.config.compile.sdk.version.get().toInt()
111111
defaultConfig {
112-
minSdk = Config.MIN_SDK_VERSION
113-
targetSdk = Config.TARGET_SDK_VERSION
112+
minSdk = libs.versions.config.min.sdk.version.get().toInt()
113+
targetSdk = libs.versions.config.target.sdk.version.get().toInt()
114114
}
115115
}
116116

0 commit comments

Comments
 (0)