-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
132 lines (119 loc) · 4.02 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
132 lines (119 loc) · 4.02 KB
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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.compose.multiplatform) apply false
alias(libs.plugins.compose.hotReload) apply false
alias(libs.plugins.kotlin.compose.compiler) apply false
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.maven.publish) apply false
alias(libs.plugins.dokka)
alias(libs.plugins.kover)
alias(libs.plugins.spotless)
}
private val publicModules = setOf(
":soil-experimental:soil-lazyload",
":soil-experimental:soil-optimistic-update",
":soil-experimental:soil-reacty",
":soil-query-core",
":soil-query-compose",
":soil-query-receivers:ktor",
":soil-query-test",
":soil-form",
":soil-space"
)
allprojects {
tasks.withType<KotlinCompilationTask<*>>().configureEach {
compilerOptions {
// Note: Kotlin 2.0.20 ~
// https://kotlinlang.org/docs/whatsnew2020.html#data-class-copy-function-to-have-the-same-visibility-as-constructor
freeCompilerArgs.add("-Xconsistent-data-class-copy-visibility")
}
}
tasks.withType<Test>().configureEach {
testLogging {
if (gradle.startParameter.logLevel <= LogLevel.INFO) {
events(TestLogEvent.PASSED, TestLogEvent.STARTED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
} else {
events(TestLogEvent.FAILED)
}
exceptionFormat = TestExceptionFormat.FULL
showStandardStreams = true
}
}
// NOTE: Source code link to GitHub
// https://kotlinlang.org/docs/dokka-migration.html#source-links
plugins.withId("org.jetbrains.dokka") {
val githubSourceUrl = providers.zip(
providers.gradleProperty("source"),
providers.gradleProperty("version")
) { source, version ->
val modulePath = project.path.replace(":", "/")
"${source}${version}${modulePath}/src"
}
configure<org.jetbrains.dokka.gradle.DokkaExtension> {
dokkaSourceSets.all {
sourceLink {
localDirectory.set(file("src"))
remoteUrl(githubSourceUrl)
remoteLineSuffix.set("#L")
}
}
}
}
apply(plugin = "com.diffplug.spotless")
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
format("format") {
target("src/**/*.kt", "*.gradle.kts")
targetExclude("$projectDir/build/**/*.kt")
trimTrailingWhitespace()
leadingTabsToSpaces()
endWithNewline()
}
format("formatYaml") {
target(".github/**/*.yml")
trimTrailingWhitespace()
leadingTabsToSpaces()
endWithNewline()
}
if (project.path in publicModules) {
kotlin {
// ref. https://github.com/diffplug/spotless/tree/main/plugin-gradle#how-can-i-enforce-formatting-gradually-aka-ratchet
// ratchetFrom = "origin/main"
target("**/*.kt")
targetExclude("$projectDir/build/**/*.kt")
licenseHeaderFile(rootProject.file("spotless/copyright.txt"))
}
}
}
}
tasks.register("buildLibs") {
group = "build"
description = "Build all public modules"
dependsOn(
subprojects
.filter { it.path in publicModules }
.map { it.tasks.named("build") }
)
}
dependencies {
for (module in publicModules) {
kover(project(module))
dokka(project(module))
}
}
kover {
reports {
filters {
excludes {
androidGeneratedClasses()
}
}
}
}
dokka {
moduleName.set("Soil")
}