forked from igorwojda/android-showcase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.gradle.kts
179 lines (150 loc) · 8.25 KB
/
settings.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
rootProject.buildFileName = "build.gradle.kts"
// Set single lock file (gradle.lockfile)
// This preview feature should be enabled by default in Gradle 7
// More: https://docs.gradle.org/current/userguide/dependency_locking.html#single_lock_file_per_project
enableFeaturePreview("ONE_LOCKFILE_PER_PROJECT")
include(
":app",
":feature_album",
":feature_profile",
":feature_favourite",
":library_test_utils"
)
// Gradle plugins are added via plugin management, not the classpath
pluginManagement {
repositories {
gradlePluginPortal()
google()
}
// Using the plugins DSL allows generating type-safe accessors for Kotlin DSL
plugins {
// See Dependency management section in README.md
// https://github.com/igorwojda/android-showcase#dependency-management
val agpVersion: String by settings
id("com.android.application") version agpVersion
id("com.android.library") version agpVersion
id("com.android.dynamic-feature") version agpVersion
val kotlinVersion: String by settings
id("org.jetbrains.kotlin.jvm") version kotlinVersion
id("org.jetbrains.kotlin.android") version kotlinVersion
val navigationVersion: String by settings
id("androidx.navigation.safeargs.kotlin") version navigationVersion
val detektVersion: String by settings
id("io.gitlab.arturbosch.detekt") version detektVersion
val ktlintVersion: String by settings
id("org.jlleitschuh.gradle.ktlint") version ktlintVersion
val androidJUnit5Version: String by settings
id("de.mannodermaus.android-junit5") version androidJUnit5Version
}
resolutionStrategy {
eachPlugin {
when (requested.id.id) {
"com.android.application",
"com.android.library",
"com.android.dynamic-feature" -> {
val agpCoordinates: String by settings
useModule(agpCoordinates)
}
"androidx.navigation.safeargs.kotlin" -> {
val navigationCoordinates: String by settings
useModule(navigationCoordinates)
}
"de.mannodermaus.android-junit5" -> {
val androidJnit5Coordinates: String by settings
useModule(androidJnit5Coordinates) // navigationVersion
}
}
}
}
}
// See Dependency management section in README.md
// https://github.com/igorwojda/android-showcase#dependency-management
@Suppress("detekt.StringLiteralDuplication")
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
val kotlinVersion: String by settings
version("kotlin", kotlinVersion)
// Required by Android dynamic feature modules and SafeArgs
alias("kotlin-reflect").to("org.jetbrains.kotlin", "kotlin-reflect").versionRef("kotlin")
version("coroutines", "1.+")
alias("coroutines").to("org.jetbrains.kotlinx", "kotlinx-coroutines-android").versionRef("coroutines")
bundle("kotlin", listOf("kotlin-reflect", "coroutines"))
version("retrofit", "2.+")
alias("retrofit-core").to("com.squareup.retrofit2", "retrofit").versionRef("retrofit")
alias("converter-moshi").to("com.squareup.retrofit2", "converter-moshi").versionRef("retrofit")
bundle("retrofit", listOf("retrofit-core", "converter-moshi"))
// Retrofit will use okhttp 4 (it has binary capability with okhttp 3)
// See: https://square.github.io/okhttp/upgrading_to_okhttp_4/
version("okhttp", "4.+")
alias("okhttp-okhttp").to("com.squareup.okhttp3", "okhttp").versionRef("okhttp")
alias("okhttp-interceptor").to("com.squareup.okhttp3", "logging-interceptor").versionRef("okhttp")
// bundle is basically an alias for several dependencies
bundle("okhttp", listOf("okhttp-okhttp", "okhttp-interceptor"))
version("stetho", "1.5.0") // 1.5.1 has critical bug and newer version is unlikely to be release
alias("stetho-core").to("com.facebook.stetho", "stetho").versionRef("stetho")
alias("stetho-okhttp3").to("com.facebook.stetho", "stetho-okhttp3").versionRef("stetho")
bundle("stetho", listOf("stetho-core", "stetho-okhttp3"))
version("kodein", "6.+")
// Required by Android dynamic feature modules and SafeArgs
alias("kodein-core").to("org.kodein.di", "kodein-di-generic-jvm").versionRef("kodein")
alias("kodein-android-x").to("org.kodein.di", "kodein-di-framework-android-x").versionRef("kodein")
bundle("kodein", listOf("kodein-core", "kodein-android-x"))
alias("timber").to("com.jakewharton.timber:timber:4.+")
alias("constraintlayout").to("androidx.constraintlayout:constraintlayout:2.+")
alias("coordinatorlayout").to("androidx.coordinatorlayout:coordinatorlayout:1.+")
alias("appcompat").to("androidx.appcompat:appcompat:1.+")
alias("recyclerview").to("androidx.recyclerview:recyclerview:1.+")
alias("material").to("com.google.android.material:material:1.+")
alias("lottie").to("com.airbnb.android:lottie:2.+")
alias("coil").to("io.coil-kt:coil:1.+")
alias("play-core").to("com.google.android.play:core:1.+")
alias("core-ktx").to("androidx.core:core-ktx:1.+")
alias("fragment-ktx").to("androidx.fragment:fragment-ktx:1.+")
bundle("ktx", listOf("core-ktx", "fragment-ktx"))
version("lifecycle", "2.+")
alias("viewmodel-ktx").to("androidx.lifecycle", "lifecycle-viewmodel-ktx").versionRef("lifecycle")
alias("livedata-ktx").to("androidx.lifecycle", "lifecycle-livedata-ktx").versionRef("lifecycle")
alias("lifecycle-common").to("androidx.lifecycle", "lifecycle-common-java8").versionRef("lifecycle")
bundle("lifecycle", listOf("viewmodel-ktx", "livedata-ktx", "lifecycle-common"))
val navigationVersion: String by settings
version("navigation", navigationVersion)
alias("navigation-fragment").to("androidx.navigation", "navigation-fragment-ktx").versionRef("navigation")
alias("navigation-dynamic")
.to("androidx.navigation", "navigation-dynamic-features-fragment")
.versionRef("navigation")
alias("navigation-ui-ktx").to("androidx.navigation", "navigation-ui-ktx").versionRef("navigation")
bundle("navigation", listOf("navigation-fragment", "navigation-dynamic", "navigation-ui-ktx"))
version("room", "2.+")
alias("room-ktx").to("androidx.room", "room-ktx").versionRef("room")
alias("room-runtime").to("androidx.room", "room-runtime").versionRef("room")
bundle("room", listOf("room-ktx", "room-runtime"))
alias("room.compiler").to("androidx.room", "room-compiler").versionRef("room")
// Test dependencies
alias("test-coroutines").to("org.jetbrains.kotlinx", "kotlinx-coroutines-test").versionRef("coroutines")
version("kluent", "1.+")
alias("kluent-core").to("org.amshove.kluent", "kluent").versionRef("kluent")
alias("kluent-android").to("org.amshove.kluent", "kluent-android").versionRef("kluent")
alias("test-runner").to("androidx.test:runner:1.+")
alias("espresso").to("androidx.test.espresso:espresso-core:3.+")
alias("mockk").to("io.mockk:mockk:1.+")
alias("arch").to("androidx.arch.core:core-testing:2.+")
version("junit", "5.+")
alias("junit-jupiter-api").to("org.junit.jupiter", "junit-jupiter-api").versionRef("junit")
bundle(
"test",
listOf(
"test-coroutines",
"kluent-core",
"kluent-android",
"test-runner",
"espresso",
"mockk",
"arch",
"junit-jupiter-api"
)
)
alias("junit-jupiter-engine").to("org.junit.jupiter", "junit-jupiter-engine").versionRef("junit")
}
}
}