This repository has been archived by the owner on Sep 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
130 lines (114 loc) · 4.56 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
import dev.racci.minix.gradle.data.MCTarget
import dev.racci.minix.gradle.support.KotlinJvmPluginSupport.kotlin
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import io.gitlab.arturbosch.detekt.report.ReportMergeTask
import kotlinx.validation.KotlinApiBuildTask
import kotlinx.validation.KotlinApiCompareTask
plugins {
id(libs.plugins.minix.get().pluginId) version "0.5.3"
id("org.jetbrains.kotlinx.kover") version "0.6.1" // TODO: Catalog and convention
id("io.gitlab.arturbosch.detekt") version "1.22.0" // TODO: Catalog and convention
alias(libs.plugins.kotlin.plugin.dokka)
alias(libs.plugins.kotlin.plugin.binaryValidator)
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.mpp) apply false
alias(libs.plugins.shadow) apply false
alias(libs.plugins.kotlin.plugin.atomicfu) apply false
alias(libs.plugins.kotlin.plugin.serialization) apply false
id(libs.plugins.slimjar.get().pluginId) version "2.0.0-SNAPSHOT" apply false
}
koverMerged {
enable()
filters {
projects {
excludes += "minix-plugin"
excludes += "minix-modules"
}
classes {
includes += "dev.racci.minix"
}
}
htmlReport {
onCheck.set(false)
reportDir.set(layout.buildDirectory.dir("reports/kover/html"))
}
}
apiValidation {
ignoredProjects = subprojects.filter { it.name.contains("core") }.map(Project::getName).toMutableSet()
ignoredPackages.add("dev.racci.minix.core")
nonPublicMarkers.add("dev.racci.minix.api.MinixInternal")
}
minix {
ignoredTargets += "minix-plugin"
ignoredTargets += "module-common"
minecraft {
fun target(
project: String,
platform: MCTarget.Platform = MCTarget.Platform.PAPER
) = withMCTarget(project(":minix-modules:module-$project"), platform, applyMinix = false)
target("integrations")
target("jumper")
target("data", MCTarget.Platform.PURPUR)
}
}
dependencies {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.22.0")
}
val reportMerge by tasks.creating(ReportMergeTask::class) {
output.set(rootProject.layout.buildDirectory.file("reports/detekt/detekt.sarif"))
}
subprojects {
extensions.findByType<DetektExtension>()?.apply {
toolVersion = "1.22.0"
config = rootProject.files("config/detekt/detekt.yml")
buildUponDefaultConfig = true
parallel = true
basePath = rootProject.projectDir.path
}
tasks.withType<Detekt> detekt@{
reportMerge.input.from([email protected])
finalizedBy(reportMerge)
reports {
md.required.set(false)
html.required.set(false)
txt.required.set(false)
xml.required.set(false)
sarif {
required.set(true)
outputLocation.set(rootProject.buildDir.resolve("reports/detekt/detekt-${project.name}.sarif"))
}
}
}
// tasks {
// // For some reason this task likes to delete the entire folder contents,
// // So we need all projects to have their own sub folder.
// val name = if (prefix != null) "plugin-$prefix" else project.name
// val subDir = "api/${name.toLowerCase()}"
// val apiDir = rootProject.layout.projectDirectory.file("config/$subDir").asFile
// apiTask<KotlinApiBuildTask>(prefix, "Build") {
// outputApiDir = rootProject.buildDir.resolve("api/$subDir")
// }
// apiTask<Sync>(prefix, "Dump") { destinationDir = apiDir }
// apiTask<KotlinApiCompareTask>(prefix, "Check") { projectApiDir = apiDir }
// }
// For some reason these tasks like to delete the entire folder contents,
// So we need all projects to have their own sub folder.
afterEvaluate {
if (tasks.findByName("apiCheck") == null) return@afterEvaluate
fun Task.dirName(): String = buildString {
if (!name.startsWith("api")) append(name.substringBefore("Api")).append('/')
append(project.name)
}
tasks.withType<KotlinApiBuildTask> {
outputApiDir = rootProject.buildDir.resolve("api").resolve(dirName())
}
tasks.withType<Sync> {
if (!name.endsWith("piDump")) return@withType
destinationDir = rootProject.layout.projectDirectory.file("config/api/${dirName()}").asFile
}
tasks.withType<KotlinApiCompareTask> {
projectApiDir = rootProject.projectDir.resolve("config/api").resolve(dirName())
}
}
}