forked from IntellectualSites/FastAsyncWorldEdit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
131 lines (118 loc) · 4.26 KB
/
build.gradle.kts
File metadata and controls
131 lines (118 loc) · 4.26 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
import org.ajoberstar.grgit.Grgit
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED
import java.time.format.DateTimeFormatter
import xyz.jpenilla.runpaper.task.RunServer
plugins {
alias(libs.plugins.codecov)
jacoco
id("buildlogic.common")
id("com.gradleup.nmcp.aggregation") version "1.2.0"
id("xyz.jpenilla.run-paper") version "3.0.2"
}
var rootVersion by extra("2.14.1")
var snapshot by extra("SNAPSHOT")
var revision: String by extra("")
var buildNumber by extra("")
var date: String by extra("")
ext {
val git: Grgit = Grgit.open {
dir = File("$rootDir/.git")
}
date = git.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd"))
revision = "-${git.head().abbreviatedId}"
buildNumber = if (project.hasProperty("buildnumber")) {
snapshot + "-" + project.properties["buildnumber"] as String
} else {
project.properties["snapshot"] as String
}
}
version = String.format("%s-%s", rootVersion, buildNumber)
if (!project.hasProperty("gitCommitHash")) {
apply(plugin = "org.ajoberstar.grgit")
ext["gitCommitHash"] = try {
extensions.getByName<Grgit>("grgit").head()?.abbreviatedId
} catch (e: Exception) {
logger.warn("Error getting commit hash", e)
"no.git.id"
}
}
val totalReport = tasks.register<JacocoReport>("jacocoTotalReport") {
for (proj in subprojects) {
proj.apply(plugin = "jacoco")
proj.plugins.withId("java") {
executionData(
fileTree(proj.layout.buildDirectory).include("**/jacoco/*.exec")
)
sourceSets(proj.the<JavaPluginExtension>().sourceSets["main"])
reports {
xml.required.set(true)
xml.outputLocation.set(rootProject.layout.buildDirectory.file("reports/jacoco/report.xml"))
html.required.set(true)
}
dependsOn(proj.tasks.named("test"))
}
}
}
afterEvaluate {
totalReport.configure {
classDirectories.setFrom(classDirectories.files.map {
fileTree(it).apply {
exclude("**/*AutoValue_*")
exclude("**/*Registration.*")
}
})
}
}
codecov {
reportTask.set(totalReport)
}
allprojects {
gradle.projectsEvaluated {
tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.addAll(listOf("--add-modules", "jdk.incubator.vector"))
options.compilerArgs.addAll(arrayOf("-Xmaxerrs", "1000"))
}
tasks.withType<Test>().configureEach {
jvmArgs("--add-modules", "jdk.incubator.vector")
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
testLogging {
events(FAILED)
exceptionFormat = FULL
showExceptions = true
showCauses = true
showStackTraces = true
}
}
tasks.withType<JavaExec>().configureEach {
jvmArgs("--add-modules", "jdk.incubator.vector")
}
}
}
val supportedVersions: List<String> = listOf("1.20.4", "1.20.5", "1.20.6", "1.21", "1.21.1", "1.21.3", "1.21.4")
tasks {
supportedVersions.forEach {
register<RunServer>("runServer-$it") {
minecraftVersion(it)
pluginJars(*project(":worldedit-bukkit").getTasksByName("shadowJar", false).map { (it as Jar).archiveFile }
.toTypedArray())
jvmArgs("-DPaper.IgnoreJavaVersion=true", "-Dcom.mojang.eula.agree=true", "--add-modules=jdk.incubator.vector")
group = "run paper"
runDirectory.set(file("run-$it"))
}
}
runServer<RunServer> {
minecraftVersion(supportedVersions.last())
pluginJars(*project(":worldedit-bukkit").getTasksByName("shadowJar", false).map { (it as Jar).archiveFile }
.toTypedArray())
jvmArgs("-Dcom.mojang.eula.agree=true")
}
}
nmcpAggregation {
centralPortal {
publishingType = "AUTOMATIC"
username = providers.gradleProperty("mavenCentralUsername")
password = providers.gradleProperty("mavenCentralPassword")
}
publishAllProjectsProbablyBreakingProjectIsolation()
}