-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
177 lines (152 loc) · 4.53 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
//
// Planetscale/J
//
import java.nio.charset.StandardCharsets
import com.adarshr.gradle.testlogger.theme.ThemeType
plugins {
alias(libs.plugins.sbom)
alias(libs.plugins.sonar)
alias(libs.plugins.kover)
alias(libs.plugins.kotlinx.plugin.abiValidator)
alias(libs.plugins.version.check)
alias(libs.plugins.version.catalogUpdate)
alias(libs.plugins.spotless)
alias(libs.plugins.testLogger)
id(libs.plugins.sigstore.get().pluginId)
id(libs.plugins.nexus.publish.get().pluginId)
`project-report`
idea
}
val stamp: String by properties
val coverageReportPath = "reports/kover/merged/xml/report.xml"
group = PlanetscaleBuild.Library.GROUP
version = if (stamp == "true") {
// if instructed to "stamp" the output libs, include the output from `.version`
layout.projectDirectory.file(".version").asFile.readText(StandardCharsets.UTF_8).trim()
} else {
"1.0-SNAPSHOT"
}
val spotlessPlugin = libs.plugins.spotless.get().pluginId
val sonarPlugin = libs.plugins.sonar.get().pluginId
val koverPlugin = libs.plugins.kover.get().pluginId
val testloggerPlugin = libs.plugins.testLogger.get().pluginId
val sbomPlugin = libs.plugins.sbom.get().pluginId
sonar {
properties {
property("sonar.projectKey", "elide-dev_planetscale-java")
property("sonar.organization", "elide-dev")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.sourceEncoding", "UTF-8")
property("sonar.gradle.skipCompile", "true")
property("sonar.coverage.jacoco.xmlReportPaths", listOf(
coverageReportPath,
"build/reports/kover/report.xml",
).joinToString(","))
}
}
subprojects {
apply(plugin = spotlessPlugin)
apply(plugin = sonarPlugin)
apply(plugin = koverPlugin)
apply(plugin = testloggerPlugin)
apply(plugin = sbomPlugin)
testlogger {
theme = ThemeType.MOCHA
showStackTraces = true
showCauses = true
showFullStackTraces = true
showExceptions = true
}
koverReport {
defaults {
xml {
onCheck = true
setReportFile(layout.buildDirectory.file(coverageReportPath))
}
verify {
onCheck = true
}
}
}
spotless {
ratchetFrom("origin/main")
kotlin {
target("**/*.kt")
targetExclude("**/test/**/*.kt")
ktlint(libs.versions.ktlint.get())
}
}
sonar {
properties {
property("sonar.sources", "src/main/jvm")
property("sonar.tests", "src/test/kotlin")
property("sonar.java.binaries", "build/classes")
}
}
tasks.check.configure {
dependsOn(listOfNotNull(
tasks.findByName("test"),
tasks.findByName("koverXmlReport"),
tasks.findByName("spotlessKotlinCheck"),
))
}
}
apiValidation {
// Projects which are not published or otherwise do not expose a JVM API.
ignoredProjects.addAll(listOf(
"catalog",
"impl-h2",
))
}
dependencies {
kover(projects.subprojects.coreApi)
kover(projects.subprojects.driver)
kover(projects.subprojects.implMysqlj)
kover(projects.subprojects.integrationGraalvm)
kover(projects.subprojects.integrationKotlin)
kover(projects.subprojects.integrationMicronaut)
}
koverReport {
defaults {
html {
onCheck = true
}
xml {
onCheck = true
setReportFile(layout.buildDirectory.file(coverageReportPath))
}
verify {
onCheck = true
}
}
}
// disable top-level project publications
afterEvaluate {
tasks.withType<PublishToMavenRepository>().configureEach { enabled = false }
tasks.withType<PublishToMavenLocal>().configureEach { enabled = false }
}
val preMerge by tasks.registering {
group = "build"
description = "Per-merge build, test, and check"
dependsOn(listOfNotNull(
tasks.build,
tasks.check,
tasks.findByName("apiCheck"),
))
}
val publishSandbox by tasks.registering {
group = "publishing"
description = "Publish all library targets"
dependsOn(listOf(
"core-api",
"driver",
"impl-mysqlj",
"integration-graalvm",
"integration-kotlin",
"integration-micronaut",
).map {
":subprojects:$it:publishMavenPublicationToGitHubPackagesRepository"
}.plus(
":subprojects:catalog:publishCatalogPublicationToGitHubPackagesRepository",
))
}