-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
75 lines (67 loc) · 2.58 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
plugins {
id("build-logic")
alias(libs.plugins.compose.compiler).apply(false)
alias(libs.plugins.ktlint)
}
allprojects {
// configure the project version
if (!project.findProperty("releaseBuild")?.toString().toBoolean()) {
project.findProperty("versionSuffix")?.toString()
?.takeIf { it.matches(Regex("\\S+")) }
?.let { version = "$version-$it" }
version = "$version-SNAPSHOT"
}
afterEvaluate {
configurations.all {
resolutionStrategy {
force(libs.androidx.annotation)
force(libs.androidx.appcompat)
force(libs.androidx.core)
force(libs.androidx.lifecycle.livedata.core)
force(libs.androidx.sqlite)
force(libs.kotlin.coroutines)
force(libs.okio)
dependencySubstitution {
// use the new condensed version of hamcrest
substitute(module("org.hamcrest:hamcrest-core"))
.using(module("org.hamcrest:hamcrest:${libs.versions.hamcrest.get()}"))
substitute(module("org.hamcrest:hamcrest-library"))
.using(module("org.hamcrest:hamcrest:${libs.versions.hamcrest.get()}"))
}
}
}
if (extensions.findByType<com.android.build.gradle.BaseExtension>() != null) {
dependencies {
add("implementation", libs.kotlin.stdlib)
add("compileOnly", libs.androidx.annotation)
add("testImplementation", libs.androidx.test.junit)
add("testImplementation", libs.junit)
add("testImplementation", kotlin("test"))
add("testImplementation", libs.mockito)
add("testImplementation", libs.mockito.kotlin)
add("testImplementation", libs.mockk)
add("testImplementation", libs.robolectric)
}
}
}
}
// region checkstyle
allprojects {
afterEvaluate {
apply(plugin = "checkstyle")
extensions.configure<CheckstyleExtension> {
toolVersion = libs.versions.checkstyle.get()
}
val task = tasks.register<Checkstyle>("checkstyle") {
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
setSource("src")
include("*/java/**/*.java")
ignoreFailures = false
isShowViolations = true
classpath = files()
}
tasks.findByName("check")?.dependsOn(task)
}
}
// endregion checkstyle
configureKtlint()