-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
68 lines (53 loc) · 1.51 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.7.20"
}
group = "me.apyr"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}
dependencies {
compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT")
// provided by server
compileOnly("org.apache.httpcomponents:httpcore:4.4.14")
// testImplementation(kotlin("test"))
}
/*tasks.test {
useJUnitPlatform()
}*/
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "11"
}
val jar by tasks.getting(Jar::class) {
archiveFileName.set("ChatEmotes-nostdlib.jar")
}
val fatJar: Jar = task("fatJar", type = Jar::class) {
archiveFileName.set("ChatEmotes.jar")
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) }) {
exclude("META-INF", "META-INF/**")
}
with(tasks.jar.get() as CopySpec)
}
tasks {
register("printPluginVersion") {
println(getPluginVersion())
}
build {
dependsOn(fatJar)
}
processResources {
val pluginVersion: String = getPluginVersion()
inputs.property("pluginVersion", pluginVersion) // process resources on property change
filesMatching("plugin.yml") {
expand("pluginVersion" to pluginVersion)
}
}
}
fun getPluginVersion(): String {
val projectVersion: String = project.version.toString()
return System.getenv("GITHUB_RUN_NUMBER")?.toIntOrNull()
?.let { run -> projectVersion.replace("-SNAPSHOT", "-dev$run") }
?: projectVersion
}