forked from Arcaniax-Development/goPaint_1.14
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
220 lines (199 loc) · 6.96 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
import io.papermc.hangarpublishplugin.model.Platforms
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
import net.minecrell.pluginyml.paper.PaperPluginDescription
import xyz.jpenilla.runpaper.task.RunServer
import kotlin.system.exitProcess
plugins {
id("java")
alias(libs.plugins.shadowJar)
alias(libs.plugins.publishdata)
alias(libs.plugins.paper.run)
alias(libs.plugins.paper.yml)
alias(libs.plugins.hangar)
alias(libs.plugins.modrinth)
alias(libs.plugins.spotless)
id("olf.build-logic")
`maven-publish`
}
if (!File("$rootDir/.git").exists()) {
logger.lifecycle("""
**************************************************************************************
You need to fork and clone this repository! Don't download a .zip file.
If you need assistance, consult the GitHub docs: https://docs.github.com/get-started/quickstart/fork-a-repo
**************************************************************************************
""".trimIndent()
).also { exitProcess(1) }
}
allprojects {
group = "net.onelitefeather.bettergopaint"
version = "1.1.0"
}
group = "net.onelitefeather.bettergopaint"
val supportedMinecraftVersions = listOf(
"1.19.4",
"1.20.6",
"1.21"
)
repositories {
mavenCentral()
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://maven.enginehub.org/repo/")
}
dependencies {
// Paper / Spigot
compileOnly(libs.paper)
// Fawe / WorldEdit
implementation(platform(libs.fawe.bom))
compileOnly(libs.fawe.bukkit)
// Utils
implementation(libs.serverlib)
implementation(libs.paperlib)
implementation(libs.semver)
// Stats
implementation(libs.bstats)
// Commands
implementation(libs.cloud.command.annotations)
implementation(libs.cloud.command.extras)
implementation(libs.cloud.command.paper)
annotationProcessor(libs.cloud.command.annotations)
}
publishData {
useEldoNexusRepos(false)
publishTask("shadowJar")
}
paper {
name = "BetterGoPaint"
main = "net.onelitefeather.bettergopaint.BetterGoPaint"
authors = listOf("Arcaniax", "TheMeinerLP")
apiVersion = "1.20"
serverDependencies {
register("FastAsyncWorldEdit") {
load = PaperPluginDescription.RelativeLoadOrder.BEFORE
required = true
}
}
website = "https://github.com/OneLiteFeatherNET/BetterGoPaint"
provides = listOf("goPaint")
permissions {
register("bettergopaint.command.admin.reload") {
default = BukkitPluginDescription.Permission.Default.OP
}
register("bettergopaint.notify.admin.update") {
default = BukkitPluginDescription.Permission.Default.OP
}
register("bettergopaint.notify.disable.donation") {
default = BukkitPluginDescription.Permission.Default.FALSE
}
register("bettergopaint.use") {
default = BukkitPluginDescription.Permission.Default.OP
}
register("bettergopaint.admin") {
default = BukkitPluginDescription.Permission.Default.FALSE
}
register("bettergopaint.world.bypass") {
default = BukkitPluginDescription.Permission.Default.FALSE
}
}
}
spotless {
java {
licenseHeaderFile(rootProject.file("HEADER.txt"))
target("**/*.java")
}
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
tasks {
jar {
archiveClassifier.set("unshaded")
}
compileJava {
options.release.set(21)
options.encoding = "UTF-8"
}
shadowJar {
archiveClassifier.set("")
dependencies {
relocate("com.cryptomorin.xseries", "${rootProject.group}.xseries")
relocate("org.incendo.serverlib", "${rootProject.group}.serverlib")
relocate("org.bstats", "${rootProject.group}.metrics")
relocate("io.papermc.lib", "${rootProject.group}.paperlib")
}
}
build {
dependsOn(shadowJar)
}
supportedMinecraftVersions.forEach { serverVersion ->
register<RunServer>("run-$serverVersion") {
minecraftVersion(serverVersion)
jvmArgs("-DPaper.IgnoreJavaVersion=true", "-Dcom.mojang.eula.agree=true")
group = "run paper"
runDirectory.set(file("run-$serverVersion"))
pluginJars(rootProject.tasks.shadowJar.map { it.archiveFile }.get())
}
}
}
val branch = rootProject.branchName()
val baseVersion = publishData.getVersion(false)
val isRelease = !baseVersion.contains('-')
val isMainBranch = branch == "master"
if (!isRelease || isMainBranch) { // Only publish releases from the main branch
val suffixedVersion = if (isRelease) baseVersion else baseVersion + "+" + System.getenv("GITHUB_RUN_NUMBER")
val changelogContent = if (isRelease) {
"See [GitHub](https://github.com/OneLiteFeatherNET/BetterGoPaint) for release notes."
} else {
val commitHash = rootProject.latestCommitHash()
"[$commitHash](https://github.com/OneLiteFeatherNET/BetterGoPaint/commit/$commitHash) ${rootProject.latestCommitMessage()}"
}
hangarPublish {
publications.register("BetterGoPaint") {
version.set(suffixedVersion)
channel.set(if (isRelease) "Release" else "Snapshot")
changelog.set(changelogContent)
apiKey.set(System.getenv("HANGAR_SECRET"))
id.set("BetterGoPaint")
platforms {
register(Platforms.PAPER) {
jar.set(tasks.shadowJar.flatMap { it.archiveFile })
platformVersions.set(supportedMinecraftVersions)
}
}
}
}
modrinth {
token.set(System.getenv("MODRINTH_TOKEN"))
projectId.set("qf7sNg9A")
versionType.set(if (isRelease) "release" else "beta")
versionNumber.set(suffixedVersion)
versionName.set(suffixedVersion)
changelog.set(changelogContent)
uploadFile.set(tasks.shadowJar.flatMap { it.archiveFile })
gameVersions.addAll(supportedMinecraftVersions)
loaders.add("paper")
loaders.add("bukkit")
loaders.add("folia")
}
}
publishing {
publications.create<MavenPublication>("maven") {
// Configure our maven publication
publishData.configurePublication(this)
}
repositories {
// We add EldoNexus as our repository. The used url is defined by the publish data.
maven {
authentication {
credentials(PasswordCredentials::class) {
// Those credentials need to be set under "Settings -> Secrets -> Actions" in your repository
username = System.getenv("ELDO_USERNAME")
password = System.getenv("ELDO_PASSWORD")
}
}
name = "EldoNexus"
setUrl(publishData.getRepository())
}
}
}