Skip to content

Commit 7d56cbd

Browse files
committed
Merged in versionCattalogExperiment (pull request #5)
[VersionCatalog] Moving dependancies to version catalog * [VersionCatalog] Draft implementation of version catalog in YTemplate * [VersionCatalog] Draft implementation of version catalog in YTemplate * [VersionCatalog] Reverting unused files * [VersionCatalog] Moving to version catalog from Dependencies.kt and cleaning up files * [VersionCatalog] Moving to version catalog from Dependencies.kt and cleaning up files * [VersionCatalog] Moving dependencies to version catalog Approved-by: Ananthakrishna Bhaskar Approved-by: Deepak K K
1 parent 238e9f6 commit 7d56cbd

File tree

5 files changed

+135
-129
lines changed

5 files changed

+135
-129
lines changed

app/build.gradle.kts

Lines changed: 28 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ plugins {
99

1010
android {
1111
namespace ="ytemplate.android"
12-
val androidSDK = ytemplate.android.build.AndroidSdk
13-
compileSdk = androidSDK.COMPILE_SDK
12+
compileSdk = versionCatalogLibs.versions.compile.sdk.get().toInt()
1413

1514
defaultConfig {
1615
applicationId="ytemplate.android"
17-
minSdk = androidSDK.MIN_SDK
18-
targetSdk = androidSDK.TARGET_SDK
16+
minSdk = versionCatalogLibs.versions.min.sdk.get().toInt()
17+
targetSdk = versionCatalogLibs.versions.target.sdk.get().toInt()
1918
versionCode = 1
2019
versionName = "1.0"
2120

@@ -46,7 +45,7 @@ android {
4645
compose = true
4746
}
4847
composeOptions {
49-
kotlinCompilerExtensionVersion = ytemplate.android.build.BuildPlugins.COMPOSE_COMPILER
48+
kotlinCompilerExtensionVersion = versionCatalogLibs.versions.compose.compiler.get()
5049
}
5150
packagingOptions {
5251
resources {
@@ -56,51 +55,33 @@ android {
5655
}
5756

5857
dependencies {
59-
androidTestImplementation(project(mapOf("path" to ":app")))
60-
val androidLib = ytemplate.android.build.AndroidLib
61-
val testLib = ytemplate.android.build.TestLib
62-
implementation (androidLib.CORE_KTX)
63-
implementation (androidLib.RUNTIME_KTX)
64-
65-
implementation (androidLib.COMPOSE_ACTIVITY)
66-
implementation (androidLib.COMPOSE_UI)
67-
implementation (androidLib.COMPOSE_PREVIEW)
68-
implementation (androidLib.COMPOSE_MATERIAL)
69-
implementation(androidLib.COMPOSE_VIEW_MODEL)
70-
implementation(androidLib.COMPOSE_NAV)
71-
androidTestImplementation(androidLib.COMPOSE_NAV_TEST)
72-
implementation(androidLib.HILT_ANDROID)
73-
kapt(androidLib.HILT_COMPILER)
74-
implementation(androidLib.HILT_NAV_COMPOSE)
75-
//Hilt instrumented test
76-
androidTestImplementation(androidLib.HILT_TEST)
77-
kaptAndroidTest(androidLib.HILT_COMPILER)
78-
58+
//Compose
59+
implementation (versionCatalogLibs.bundles.compose)
60+
androidTestImplementation(versionCatalogLibs.compose.nav.test)
61+
//ktx
62+
implementation (versionCatalogLibs.bundles.ktx)
63+
//hilt
64+
implementation(versionCatalogLibs.bundles.hilt)
65+
kapt(versionCatalogLibs.hilt.compiler)
66+
androidTestImplementation(versionCatalogLibs.hilt.test)
67+
kaptAndroidTest(versionCatalogLibs.hilt.compiler)
7968
//coroutine
80-
implementation(androidLib.COROUTINE)
81-
testImplementation(androidLib.COROUTINE_TEST)
82-
testImplementation(androidLib.COROUTINE_TURBINE)
69+
implementation(versionCatalogLibs.coroutine)
70+
testImplementation(versionCatalogLibs.bundles.coroutine.test)
8371
//Room
84-
implementation(androidLib.ROOM_RUNTIME)
85-
annotationProcessor(androidLib.ROOM_COMPILER)
86-
kapt(androidLib.ROOM_COMPILER)
87-
implementation(androidLib.ROOM_KTX)
88-
testImplementation(androidLib.ROOM_TEST)
72+
implementation(versionCatalogLibs.bundles.room)
73+
annotationProcessor(versionCatalogLibs.room.compiler)
74+
kapt(versionCatalogLibs.room.compiler)
75+
testImplementation(versionCatalogLibs.room.test)
8976
//Ktor
90-
implementation(androidLib.KTOR_CORE)
91-
implementation(androidLib.KTOR_CLIENT)
92-
implementation(androidLib.KTOR_CONTENT_NEGOTIATION)
93-
implementation(androidLib.KTOR_SERILIZATION)
94-
implementation(androidLib.KTOR_CLIENT_LOGGING)
95-
implementation(androidLib.KOTLINX_SERILIZATION)
96-
testImplementation(androidLib.KTOR_CLIENT_MOCK)
97-
androidTestImplementation(androidLib.KTOR_CLIENT_MOCK)
77+
implementation (versionCatalogLibs.bundles.ktor)
78+
testImplementation(versionCatalogLibs.ktor.client.mock)
79+
androidTestImplementation(versionCatalogLibs.ktor.client.mock)
80+
//Android Testing
81+
androidTestImplementation (versionCatalogLibs.bundles.android.test)
82+
testImplementation (versionCatalogLibs.junit)
83+
debugImplementation (versionCatalogLibs.bundles.android.debug.test)
9884

99-
testImplementation (testLib.JUNIT)
100-
androidTestImplementation (androidLib.JUNIT_ANDROID)
101-
androidTestImplementation (androidLib.ESPRESSO_TEST)
102-
androidTestImplementation (androidLib.COMPOSE_UI_TESTING)
103-
debugImplementation (androidLib.COMPOSE_TOOLING_TESTING)
104-
debugImplementation (androidLib.COMPOSE_UI_MANIFEST_TEST)
85+
androidTestImplementation(project(mapOf("path" to ":app")))
10586

10687
}

build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11

22
plugins {
3-
val buildVersion = ytemplate.android.build.BuildPlugins
4-
id("com.google.dagger.hilt.android") version buildVersion.HILT_PLUGIN apply false
3+
alias(versionCatalogLibs.plugins.hilt.plugin) apply false
54
}
65

76
buildscript {
87
repositories {
98
google()
109
mavenCentral()
1110
}
12-
}
11+
}

buildSrc/src/main/java/ytemplate/android/build/Dependencies.kt

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

gradle/libs.versions.toml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
[versions]
2+
# Define the dependency versions
3+
#compose
4+
compose_ui = "1.3.2"
5+
compose_material = "1.1.1"
6+
compose_activity="1.6.1"
7+
compose_navigation = "2.5.3"
8+
compose_compiler = "1.3.2"
9+
10+
#ktx
11+
core_ktx = "1.9.0"
12+
android_life_cycle = "2.5.1"
13+
14+
#hilt
15+
hilt = "2.44"
16+
hilt_nav_compose = "1.0.0"
17+
18+
#coroutine
19+
coroutine = "1.6.4"
20+
turbine = "0.12.1"
21+
22+
#room
23+
room= "2.4.3"
24+
25+
#ktor
26+
ktor = "2.2.2"
27+
28+
#android test
29+
kotlinx_serialization = "1.4.0"
30+
android_junit = "1.1.4"
31+
espresso = "3.5.0"
32+
junit = "4.13.2"
33+
34+
#android sdk
35+
min_sdk = "26"
36+
target_sdk = "32"
37+
compile_sdk = "33"
38+
39+
[libraries]
40+
#compose
41+
compose_ui = { module = "androidx.compose.ui:ui", version.ref = "compose_ui" }
42+
compose_material = { module = "androidx.compose.material:material", version.ref = "compose_material" }
43+
compose_activity = { module = "androidx.activity:activity-compose", version.ref = "compose_activity" }
44+
compose_preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose_ui" }
45+
compose_nav = { module = "androidx.navigation:navigation-compose", version.ref = "compose_navigation" }
46+
compose_view_model = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "android_life_cycle" }
47+
compose_nav_test = { module = "androidx.navigation:navigation-testing", version.ref = "compose_navigation" }
48+
49+
#hilt
50+
hilt_compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hilt" }
51+
hilt_android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
52+
hilt_test = { module = "com.google.dagger:hilt-android-testing", version.ref = "hilt" }
53+
hilt_nav_compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hilt_nav_compose" }
54+
55+
#ktx
56+
core_ktx = { module = "androidx.core:core-ktx", version.ref = "core_ktx" }
57+
runtime_ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "android_life_cycle" }
58+
59+
#Coroutine
60+
coroutine = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutine" }
61+
coroutine_test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutine" }
62+
coroutine_turbins = { module = "app.cash.turbine:turbine", version.ref = "turbine" }
63+
64+
#Room database
65+
room_runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
66+
room_compiler = { module = "androidx.room:room-compiler", version.ref = "room" }
67+
room_ktx = { module = "androidx.room:room-ktx", version.ref = "room" }
68+
room_test = { module = "androidx.room:room-testing", version.ref = "room" }
69+
70+
#Remote setup
71+
ktor_core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
72+
ktor_client = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
73+
ktor_content_negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" }
74+
ktor_serialization = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
75+
ktor_client_logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }
76+
kotlinx_serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx_serialization" }
77+
ktor_client_mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor" }
78+
79+
#Android Testing
80+
junit = { module = "junit:junit", version.ref = "junit" }
81+
junit_android = { module = "androidx.test.ext:junit", version.ref = "android_junit" }
82+
espresso_test = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso" }
83+
compose_ui_testing = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose_ui" }
84+
compose_tooling_testing = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose_ui" }
85+
compose_ui_manifest_test = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "compose_ui" }
86+
87+
[bundles]
88+
# Define bundles/groups of libraries
89+
compose = ["compose.ui", "compose.material","compose.activity","compose.preview","compose.nav","compose.view.model"]
90+
ktx = ["core.ktx", "runtime.ktx"]
91+
hilt = ["hilt.android", "hilt.nav.compose"]
92+
coroutine_test = ["coroutine.test", "coroutine.turbins"]
93+
room = ["room.runtime", "room.ktx"]
94+
ktor = ["ktor.core", "ktor.client","ktor.content.negotiation","ktor.serialization","ktor.client.logging","kotlinx.serialization"]
95+
android_test = ["junit.android", "espresso.test","compose.ui.testing"]
96+
android_debug_test = ["compose.tooling.testing", "compose.ui.manifest.test"]
97+
98+
[plugins]
99+
# Define Plugins
100+
hilt_plugin = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }

settings.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ dependencyResolutionManagement {
1111
google()
1212
mavenCentral()
1313
}
14+
versionCatalogs {
15+
create("versionCatalogLibs") {
16+
from(files("gradle/libs.versions.toml"))
17+
}
18+
}
1419
}
1520
rootProject.name = "YTemplate"
1621
include (":app")

0 commit comments

Comments
 (0)