forked from GlowstoneMC/Glowstone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
122 lines (96 loc) · 2.93 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
import java.io.ByteArrayOutputStream
import java.util.*
plugins {
java
id("io.freefair.lombok") version "6.0.0-m2"
`maven-publish`
checkstyle
id("com.github.johnrengelman.shadow") version "7.0.0"
}
val buildExtras = System.getenv("BUILD_EXTRAS")?.toBoolean() ?: false
repositories {
mavenLocal()
maven("https://repo.glowstone.net/repository/maven-public/")
maven("https://repo.glowstone.net/repository/snapshots/")
maven("https://libraries.minecraft.net")
}
dependencies {
implementation(libs.bundles.linkstone)
implementation(libs.bundles.glowstone)
implementation(libs.bundles.kotlin)
implementation(libs.jansi)
implementation(libs.jline)
implementation(libs.fastutil)
implementation(libs.flow)
implementation(libs.fastuuid)
implementation(libs.brigadier)
implementation(libs.gluegen)
implementation(libs.jocl)
implementation(libs.naether)
implementation(libs.maven.artifact)
runtimeOnly(libs.slf4j.jdk14)
testImplementation(libs.bundles.junit)
testImplementation(libs.hamcrest)
testImplementation(libs.bundles.powermock)
compileOnly(libs.jetbrains.annotations)
}
group = "net.glowstone"
version = "2021.9.1-SNAPSHOT"
description = "A fast, customizable and compatible open source Minecraft server."
lombok {
setVersion(libs.versions.lombok.get())
}
tasks.javadoc {
exclude("**/*.xml")
}
publishing {
publications {
create<MavenPublication>("maven") {
project.shadow.component(this)
}
}
}
checkstyle {
configFile = File(project.projectDir, "/etc/checkstyle.xml")
configProperties["checkstyle.header.file"] = File(project.projectDir, "LICENSE")
toolVersion = libs.versions.checkstyle.get()
isIgnoreFailures = true
}
fun getGitHash(): String {
val stdout = ByteArrayOutputStream()
exec {
commandLine = listOf("git", "rev-parse", "--short", "HEAD")
standardOutput = stdout
}
return stdout.toString().trim()
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
if (buildExtras) {
withSourcesJar()
withJavadocJar()
}
}
tasks.compileJava {
options.encoding = "UTF-8"
}
tasks.jar {
enabled = false
manifest {
attributes(
"Launcher-Agent-Class" to "net.glowstone.util.ClassPathAgent",
"Main-Class" to "net.glowstone.GlowServer",
"Implementation-Title" to project.name,
"Implementation-Version" to "${project.version}.git-${project.name}-${getGitHash()}",
"Implementation-Vendor" to Date(),
"Specification-Title" to "Bukkit",
"Specification-Version" to libs.versions.api.get()
)
}
}
tasks.shadowJar {
relocate("jline", "org.bukkit.craftbukkit.libs.jline")
relocate("it.unimi", "org.bukkit.craftbukkit.libs.it.unimi")
exclude("mojang-translations/*")
}
tasks.assemble { dependsOn(tasks.shadowJar) }