-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
179 lines (153 loc) · 4.57 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
// https://youtrack.jetbrains.com/issue/KTIJ-19369
@file:Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage")
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.report.ReportMergeTask
import org.jetbrains.gradle.ext.ActionDelegationConfig
import org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.PLATFORM
import org.jetbrains.gradle.ext.ProjectSettings
import org.jetbrains.gradle.ext.TaskTriggersConfig
plugins {
id("pklAllProjects")
id("pklGraalVm")
`project-reports`
`test-report-aggregation`
alias(libs.plugins.ideaExt)
alias(libs.plugins.gradleDoctor) apply false
alias(libs.plugins.jmh) apply false
alias(libs.plugins.nexusPublish)
alias(libs.plugins.versionCheck)
alias(libs.plugins.owasp)
alias(libs.plugins.sbom)
alias(libs.plugins.kotlinValidator)
alias(libs.plugins.kover)
alias(libs.plugins.detekt)
alias(libs.plugins.spotless)
}
group = "org.pkl-lang"
description = "Configuration that is Programmable, Scalable, and Safe"
nexusPublishing {
repositories {
sonatype {
nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
}
}
val apiLockedProjects =
listOf(
projects.pklCli,
projects.pklConfigKotlin,
projects.pklGradle,
)
.map { it.name }
apiValidation {
ignoredProjects =
ignoredProjects
.plus(allprojects.filter { it.name !in apiLockedProjects }.map { it.name })
.toMutableSet()
}
idea {
project {
this as ExtensionAware
configure<ProjectSettings> {
this as ExtensionAware
configure<ActionDelegationConfig> {
delegateBuildRunToGradle = true
testRunner = PLATFORM
}
configure<TaskTriggersConfig> {
afterSync(provider { project(":pkl-core").tasks.named("makeIntelliJAntlrPluginHappy") })
}
}
}
}
spotless {
kotlinGradle {
isEnforceCheck = false
ktfmt(libs.versions.ktfmt.get()).googleStyle()
}
}
dependencies {
listOf(
projects.pklCli,
projects.pklCodegenJava,
projects.pklCodegenKotlin,
projects.pklCommons,
projects.pklCommonsCli,
projects.pklConfigJava,
projects.pklConfigKotlin,
projects.pklDoc,
projects.pklExecutor,
projects.pklGradle,
projects.pklServer,
projects.pklTools,
)
.forEach {
kover(it)
testReportAggregation(it)
}
}
val message =
"""
====
Gradle version : ${gradle.gradleVersion}
Java version : ${System.getProperty("java.version")}
isParallel : ${gradle.startParameter.isParallelProjectExecutionEnabled}
maxWorkerCount : ${gradle.startParameter.maxWorkerCount}
Architecture : ${buildInfo.arch}
Project Version : ${project.version}
Pkl Version : ${buildInfo.pklVersion}
Pkl Non-Unique Version : ${buildInfo.pklVersionNonUnique}
Git Commit ID : ${buildInfo.commitId}
====
"""
val formattedMessage =
message.replace("\n====", "\n" + "=".repeat(message.lines().maxByOrNull { it.length }!!.length))
logger.info(formattedMessage)
detekt {
toolVersion = libs.versions.detekt.get()
config.from(layout.projectDirectory.file("config/detekt/detekt.yml"))
buildUponDefaultConfig = true
enableCompilerPlugin = true
}
dependencyCheck {
nvd.apiKey = System.getenv("NVD_API_KEY")
suppressionFiles = listOf("config/owasp/suppressions.xml")
}
val allTestsReport by
reporting.reports.creating(AggregateTestReport::class) { testType = TestSuiteType.UNIT_TEST }
tasks {
val clean by getting(Delete::class) { delete(layout.buildDirectory) }
val printVersion by registering { doFirst { println(buildInfo.pklVersion) } }
// --- Tasks: Detekt
//
val detektMergeSarif: TaskProvider<ReportMergeTask> by
registering(ReportMergeTask::class) {
output.set(layout.buildDirectory.file("reports/detekt/detekt.sarif"))
}
val detektMergeXml: TaskProvider<ReportMergeTask> by
registering(ReportMergeTask::class) {
output.set(layout.buildDirectory.file("reports/detekt/detekt.xml"))
}
withType(Detekt::class) detekt@{
finalizedBy(detektMergeSarif, detektMergeXml)
reports.sarif.required = true
reports.xml.required = true
}
val coverageReports by registering {
dependsOn(koverBinaryReport, koverXmlReport, koverHtmlReport)
}
val reports by registering {
description = "Generates all reports"
group = "Reporting"
dependsOn(named("allTestsReport"))
}
val check: Task by getting {
description = "Runs all checks"
group = "Verification"
finalizedBy(
reports,
coverageReports,
)
}
}