-
Notifications
You must be signed in to change notification settings - Fork 32
/
build.gradle.kts
223 lines (189 loc) · 7.22 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
221
222
223
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
import net.minecrell.pluginyml.paper.PaperPluginDescription
import java.io.BufferedReader
import java.io.InputStreamReader
plugins {
id("java-library")
id("maven-publish")
id("xyz.jpenilla.run-paper") version "2.2.4"
id("io.github.goooler.shadow") version "8.1.7"
id("net.minecrell.plugin-yml.paper") version "0.6.0"
id("io.papermc.hangar-publish-plugin") version "0.1.2"
id("com.modrinth.minotaur") version "2.+"
}
runPaper.folia.registerTask()
val supportedVersions =
listOf("1.19.4", "1.20", "1.20.1", "1.20.2", "1.20.3", "1.20.4", "1.20.5", "1.20.6", "1.21", "1.21.1")
allprojects {
group = "de.oliver"
val buildId = System.getenv("BUILD_ID")
version = "2.3.2" + (if (buildId != null) ".$buildId" else "")
description = "Simple, lightweight and fast hologram plugin using display entities"
repositories {
mavenLocal()
mavenCentral()
maven(url = "https://repo.papermc.io/repository/maven-public/")
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
maven(url = "https://repo.fancyplugins.de/snapshots")
maven(url = "https://repo.fancyplugins.de/releases")
maven(url = "https://repo.smrt-1.com/releases")
maven(url = "https://repo.viaversion.com/")
}
}
dependencies {
compileOnly("io.papermc.paper:paper-api:${findProperty("minecraftVersion")}-R0.1-SNAPSHOT")
implementation(project(":api"))
implementation(project(":implementation_1_20_4", configuration = "reobf"))
implementation(project(":implementation_1_20_2", configuration = "reobf"))
implementation(project(":implementation_1_20_1", configuration = "reobf"))
implementation(project(":implementation_1_19_4", configuration = "reobf"))
implementation("de.oliver:FancyLib:${findProperty("fancyLibVersion")}")
implementation("de.oliver:FancySitula:${findProperty("fancySitulaVersion")}")
compileOnly("de.oliver:FancyNpcs:${findProperty("fancyNpcsVersion")}")
compileOnly("me.dave:ChatColorHandler:${findProperty("chatcolorhandlerVersion")}")
// implementation("de.oliver.FancyAnalytics:api:${findProperty("fancyAnalyticsVersion")}")
// implementation("org.incendo:cloud-core:${findProperty("cloudCoreVersion")}")
// implementation("org.incendo:cloud-paper:${findProperty("cloudPaperVersion")}")
// implementation("org.incendo:cloud-annotations:${findProperty("cloudAnnotationsVersion")}")
// annotationProcessor("org.incendo:cloud-annotations:${findProperty("cloudAnnotationsVersion")}")
}
paper {
main = "de.oliver.fancyholograms.FancyHolograms"
bootstrapper = "de.oliver.fancyholograms.loaders.FancyHologramsBootstrapper"
loader = "de.oliver.fancyholograms.loaders.FancyHologramsLoader"
foliaSupported = true
version = rootProject.version.toString()
description = "Simple, lightweight and fast hologram plugin using display entities"
apiVersion = "1.19"
load = BukkitPluginDescription.PluginLoadOrder.POSTWORLD
serverDependencies {
register("FancyNpcs") {
required = false
load = PaperPluginDescription.RelativeLoadOrder.BEFORE
}
register("MiniPlaceholders") {
required = false
load = PaperPluginDescription.RelativeLoadOrder.BEFORE
}
register("PlaceholderAPI") {
required = false
load = PaperPluginDescription.RelativeLoadOrder.BEFORE
}
}
}
tasks {
runServer {
minecraftVersion(findProperty("minecraftVersion").toString())
// minecraftVersion("1.20.4")
downloadPlugins {
modrinth("fancynpcs", "2.2.1")
hangar("ViaVersion", "5.0.3")
hangar("ViaBackwards", "5.0.3")
modrinth("multiverse-core", "4.3.11")
hangar("PlaceholderAPI", "2.11.6")
}
}
shadowJar {
archiveClassifier.set("")
dependsOn(":api:shadowJar")
}
publishing {
repositories {
maven {
name = "fancypluginsReleases"
url = uri("https://repo.fancyplugins.de/releases")
credentials(PasswordCredentials::class)
authentication {
isAllowInsecureProtocol = true
create<BasicAuthentication>("basic")
}
}
maven {
name = "fancypluginsSnapshots"
url = uri("https://repo.fancyplugins.de/snapshots")
credentials(PasswordCredentials::class)
authentication {
isAllowInsecureProtocol = true
create<BasicAuthentication>("basic")
}
}
}
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
from(project.components["java"])
}
}
}
compileJava {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
options.release = 21
// For cloud-annotations, see https://cloud.incendo.org/annotations/#command-components
options.compilerArgs.add("-parameters")
}
javadoc {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
}
processResources {
filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything
val props = mapOf(
"description" to project.description,
"version" to project.version,
"hash" to getCurrentCommitHash(),
"build" to (System.getenv("BUILD_ID") ?: "").ifEmpty { "undefined" }
)
inputs.properties(props)
filesMatching("paper-plugin.yml") {
expand(props)
}
filesMatching("version.yml") {
expand(props)
}
}
}
tasks.publishAllPublicationsToHangar {
dependsOn("shadowJar")
}
tasks.modrinth {
dependsOn("shadowJar")
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
fun getCurrentCommitHash(): String {
val process = ProcessBuilder("git", "rev-parse", "HEAD").start()
val reader = BufferedReader(InputStreamReader(process.inputStream))
val commitHash = reader.readLine()
reader.close()
process.waitFor()
if (process.exitValue() == 0) {
return commitHash ?: ""
} else {
throw IllegalStateException("Failed to retrieve the commit hash.")
}
}
hangarPublish {
publications.register("plugin") {
version = project.version as String
id = "FancyHolograms"
channel = "Alpha"
apiKey.set(System.getenv("HANGAR_PUBLISH_API_TOKEN"))
platforms {
paper {
jar = tasks.shadowJar.flatMap { it.archiveFile }
platformVersions = supportedVersions
}
}
}
}
modrinth {
token.set(System.getenv("MODRINTH_PUBLISH_API_TOKEN"))
projectId.set("fancyholograms")
versionNumber.set(project.version.toString())
versionType.set("alpha")
uploadFile.set(file("build/libs/${project.name}-${project.version}.jar"))
gameVersions.addAll(supportedVersions)
loaders.add("paper")
}