-
Notifications
You must be signed in to change notification settings - Fork 11.6k
/
build.gradle.kts
200 lines (172 loc) · 7.24 KB
/
build.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kapt)
alias(libs.plugins.ksp)
alias(libs.plugins.hilt)
}
android {
compileSdk = libs.versions.compileSdk.get().toInt()
defaultConfig {
applicationId = "com.example.android.architecture.blueprints.main"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "com.example.android.architecture.blueprints.todoapp.CustomTestRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments += "room.incremental" to "true"
}
}
}
buildTypes {
getByName("debug") {
isMinifyEnabled = false
isTestCoverageEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
testProguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguardTest-rules.pro")
}
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
testProguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguardTest-rules.pro")
}
}
// Always show the result of every unit test, even if it passes.
testOptions.unitTests {
isIncludeAndroidResources = true
all { test ->
with(test) {
testLogging {
events = setOf(
org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED,
org.gradle.api.tasks.testing.logging.TestLogEvent.SKIPPED,
org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED,
org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_OUT,
org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_ERROR,
)
}
}
}
}
buildFeatures {
compose = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
packagingOptions {
excludes += "META-INF/AL2.0"
excludes += "META-INF/LGPL2.1"
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.androidxComposeCompiler.get()
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
freeCompilerArgs += "-opt-in=kotlin.Experimental"
}
}
}
/*
Dependency versions are defined in the top level build.gradle file. This helps keeping track of
all versions in a single place. This improves readability and helps managing project complexity.
*/
dependencies {
// App dependencies
implementation(libs.androidx.annotation)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.timber)
implementation(libs.androidx.test.espresso.idling.resources)
// Architecture Components
implementation(libs.room.runtime)
implementation(libs.room.ktx)
ksp(libs.room.compiler)
implementation(libs.androidx.lifecycle.runtimeCompose)
implementation(libs.androidx.lifecycle.viewModelCompose)
// Hilt
implementation(libs.hilt.android.core)
implementation(libs.androidx.hilt.navigation.compose)
ksp(libs.hilt.compiler)
// Jetpack Compose
val composeBom = platform(libs.androidx.compose.bom)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.compose.compiler)
implementation(composeBom)
implementation(libs.androidx.compose.foundation.core)
implementation(libs.androidx.compose.foundation.layout)
implementation(libs.androidx.compose.animation)
implementation(libs.androidx.compose.material.core)
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.androidx.navigation.compose)
implementation(libs.androidx.lifecycle.runtimeCompose)
implementation(libs.androidx.lifecycle.viewModelCompose)
implementation(libs.accompanist.appcompat.theme)
implementation(libs.accompanist.swiperefresh)
debugImplementation(composeBom)
debugImplementation(libs.androidx.compose.ui.tooling.core)
debugImplementation(libs.androidx.compose.ui.test.manifest)
// Dependencies for local unit tests
testImplementation(composeBom)
testImplementation(libs.junit4)
testImplementation(libs.androidx.archcore.testing)
testImplementation(libs.kotlinx.coroutines.android)
testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.androidx.navigation.testing)
testImplementation(libs.androidx.test.espresso.core)
testImplementation(libs.androidx.test.espresso.contrib)
testImplementation(libs.androidx.test.espresso.intents)
testImplementation(libs.google.truth)
testImplementation(libs.androidx.compose.ui.test.junit)
// JVM tests - Hilt
testImplementation(libs.hilt.android.testing)
kspTest(libs.hilt.compiler)
// Dependencies for Android unit tests
androidTestImplementation(composeBom)
androidTestImplementation(libs.junit4)
androidTestImplementation(libs.kotlinx.coroutines.test)
androidTestImplementation(libs.androidx.compose.ui.test.junit)
// AndroidX Test - JVM testing
testImplementation(libs.androidx.test.core.ktx)
testImplementation(libs.androidx.test.ext)
testImplementation(libs.androidx.test.rules)
testImplementation(project(":shared-test"))
// AndroidX Test - Instrumented testing
androidTestImplementation(libs.androidx.test.core.ktx)
androidTestImplementation(libs.androidx.test.ext)
androidTestImplementation(libs.androidx.test.rules)
androidTestImplementation(libs.room.testing)
androidTestImplementation(libs.androidx.archcore.testing)
androidTestImplementation(libs.androidx.navigation.testing)
androidTestImplementation(libs.androidx.test.espresso.core)
androidTestImplementation(libs.androidx.test.espresso.contrib)
androidTestImplementation(libs.androidx.test.espresso.intents)
androidTestImplementation(libs.androidx.test.espresso.idling.resources)
androidTestImplementation(libs.androidx.test.espresso.idling.concurrent)
androidTestImplementation(project(":shared-test"))
// AndroidX Test - Hilt testing
androidTestImplementation(libs.hilt.android.testing)
kspAndroidTest(libs.hilt.compiler)
}