-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
146 lines (119 loc) · 4.14 KB
/
build.gradle.kts
File metadata and controls
146 lines (119 loc) · 4.14 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import net.ltgt.gradle.errorprone.CheckSeverity
import net.ltgt.gradle.errorprone.errorprone
import net.ltgt.gradle.nullaway.nullaway
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
base
`jacoco-report-aggregation`
alias(libs.plugins.spotless)
alias(libs.plugins.licenser)
alias(libs.plugins.errorProne) apply false
alias(libs.plugins.nullaway) apply false
}
repositories { mavenCentral() }
group = "io.github.iyanging"
subprojects {
apply(plugin = rootProject.libs.plugins.licenser.get().pluginId)
group = rootProject.group
repositories { mavenCentral() }
plugins.withType<JavaPlugin> {
apply(plugin = rootProject.libs.plugins.errorProne.get().pluginId)
apply(plugin = rootProject.libs.plugins.nullaway.get().pluginId)
extensions.getByType<JavaPluginExtension>().apply {
toolchain { languageVersion = JavaLanguageVersion.of(21) }
}
dependencies {
val errorprone = configurations["errorprone"]
errorprone(libs.errorProneCore)
errorprone(libs.nullaway)
}
tasks.withType<JavaCompile> {
options.errorprone {
disableWarningsInGeneratedCode = true
errorproneArgs = listOf("-XepAllSuggestionsAsWarnings")
checks =
mapOf(
"ReferenceEquality" to CheckSeverity.ERROR,
"UnnecessaryParentheses" to CheckSeverity.OFF,
"MisformattedTestData" to CheckSeverity.OFF,
)
nullaway {
error()
annotatedPackages.add(project.group.toString())
}
}
}
tasks.withType<JacocoReport>().forEach {
it.reports { xml.required = true }
tasks.check { dependsOn(it) }
}
}
tasks.withType<Test>().all {
testLogging {
events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
exceptionFormat = TestExceptionFormat.FULL
}
}
plugins.withType<JacocoPlugin> { rootProject.dependencies { jacocoAggregation(project) } }
license { rule(file("$rootDir/configs/license-template.txt")) }
plugins.withType<BasePlugin> { tasks.check { dependsOn(tasks.checkLicenses) } }
}
val asis =
project("error-prone-asis") {
plugins.withType<JavaPlugin> {
dependencies {
val annotationProcessor = configurations["annotationProcessor"]
annotationProcessor(project(":error-prone-asis-docgen"))
}
}
}
tasks.register<Copy>("generateDocs") {
group = "documentation"
dependsOn(asis.tasks["compileJava"])
val asisGeneratedSource =
asis.tasks.named<JavaCompile>("compileJava") {
options.generatedSourceOutputDirectory.get()
}
delete("$rootDir/docs/generated")
from("${asisGeneratedSource}/docs", "$rootDir/docs")
into("$rootDir/generated-docs")
}
spotless {
java {
target("**/*.java")
targetExclude("**/build/")
importOrderFile("$rootDir/configs/eclipse-organize-imports.importorder")
removeUnusedImports()
eclipse().configFile("$rootDir/configs/eclipse-code-formatter.xml")
}
kotlinGradle {
target("**/*.gradle.kts")
ktfmt("0.50").kotlinlangStyle().configure {
it.setBlockIndent(4)
it.setContinuationIndent(4)
it.setRemoveUnusedImports(true)
}
}
yaml {
target("**/*.yaml", "**/*.yml")
targetExclude("**/.venv/")
leadingTabsToSpaces(2)
trimTrailingWhitespace()
endWithNewline()
}
json {
target("**/*.json")
targetExclude("**/.venv/")
gson().indentWithSpaces(2)
trimTrailingWhitespace()
endWithNewline()
}
}
reporting {
reports {
@Suppress("UnstableApiUsage")
create<JacocoCoverageReport>("testCodeCoverageReport") { testSuiteName = "test" }
}
}
tasks.check { dependsOn(tasks["testCodeCoverageReport"]) }