-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathbuild.gradle.kts
126 lines (115 loc) · 3.46 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
import io.papermc.hangarpublishplugin.model.Platforms
plugins {
alias(libs.plugins.standardConvention)
id("com.modrinth.minotaur")
id("xyz.jpenilla.run-paper") version "2.3.1"
id("io.papermc.hangar-publish-plugin") version "0.1.2"
id("com.github.ben-manes.versions") version "0.51.0"
}
val minecraft = property("minecraft_version")!!.toString()
dependencies {
fun searchAll(target: Project) {
val sub = target.subprojects
if (sub.isNotEmpty()) sub.forEach {
searchAll(it)
} else dokka(target)
}
searchAll(rootProject)
}
val sourcesJar by tasks.registering(Jar::class) {
dependsOn(tasks.classes)
fun getProjectSource(project: Project): Array<File> {
return if (project.subprojects.isEmpty()) project.sourceSets.main.get().allSource.srcDirs.toTypedArray() else ArrayList<File>().apply {
project.subprojects.forEach {
addAll(getProjectSource(it))
}
}.toTypedArray()
}
archiveClassifier = "sources"
from(*getProjectSource(project))
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
val javadocJar by tasks.registering(Jar::class) {
dependsOn(tasks.dokkaGenerate)
archiveClassifier = "javadoc"
from(layout.buildDirectory.dir("dokka/html").orNull?.asFile)
}
runPaper {
disablePluginJarDetection()
}
val bukkit = project("bootstrap:bukkit")
val fabric = project("bootstrap:fabric")
val velocity = project("bootstrap:velocity")
tasks.register("pluginJar") {
dependsOn(bukkit.tasks.build)
}
tasks.register("fabricJar") {
dependsOn(fabric.tasks.build)
}
tasks.register("velocityJar") {
dependsOn(velocity.tasks.build)
}
tasks.register("modrinthPublish") {
finalizedBy(
tasks.modrinthSyncBody,
bukkit.tasks.modrinth,
fabric.tasks.modrinth,
velocity.tasks.modrinth
)
}
tasks {
runServer {
version(minecraft)
pluginJars(bukkit.tasks.jar.flatMap {
it.archiveFile
})
pluginJars(fileTree("plugins"))
downloadPlugins {
hangar("ViaVersion", "5.2.1")
hangar("ViaBackwards", "5.2.1")
hangar("PlaceholderAPI", "2.11.6")
hangar("Skript", "2.9.5")
}
}
build {
dependsOn(
bukkit.tasks.build,
fabric.tasks.build,
velocity.tasks.build
)
finalizedBy(
sourcesJar,
javadocJar
)
}
}
hangarPublish {
publications.register("plugin") {
version = project.version as String
id = "BetterHud"
apiKey = System.getenv("HANGAR_API_TOKEN")
val log = System.getenv("COMMIT_MESSAGE")
if (log != null) {
changelog = log
channel = "Snapshot"
} else {
changelog = rootProject.file("changelog/${project.version}.md").readText()
channel = "Release"
}
platforms {
register(Platforms.PAPER) {
jar = file("build/libs/${project.name}-bukkit-${project.version}.jar")
platformVersions = SUPPORTED_MINECRAFT_VERSION
}
register(Platforms.VELOCITY) {
jar = file("build/libs/${project.name}-velocity-${project.version}.jar")
platformVersions = listOf("3.3", "3.4")
}
}
}
}
modrinth {
token = System.getenv("MODRINTH_API_TOKEN")
projectId = "betterhud2"
syncBodyFrom = rootProject.file("BANNER.md").readText()
}