-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
150 lines (118 loc) · 3.06 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
150 lines (118 loc) · 3.06 KB
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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
application
idea
java
`maven-publish`
alias(libraries.plugins.shadow)
}
description = "A simple plugin for Minecraft that hides commands for players " +
"who do not have privileges to use those commands."
group = "me.kvdpxne"
version = "0.1.0"
// The latest LTS version of Java.
val latestJavaVersion = 21
// The Java version in which the project will be compiled.
val targetJavaVersion = 8
application {
mainClass = "me.kvdpxne.hc.HideCommands"
}
idea {
project {
jdkName = latestJavaVersion.toString()
}
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}
dependencies {
compileOnly(libraries.bukkit) {
sequenceOf(
"commons-lang",
"com.googlecode.json-simple",
"com.google.guava",
"org.avaje"
).forEach {
exclude(it)
}
}
compileOnly(libraries.protocollib.legacy) {
// The Spigot module that used ProtocolLib in the legacy version currently
// does not exist in the official Spigot repository but its exclusion and
// use of another API will not cause problems during compilation.
exclude("org.spigotmc")
// ProtocolLib has compiled these dependencies in itself.
exclude("com.comphenix.executors")
exclude("cglib")
}
implementation(libraries.notchity)
}
java {
val javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks {
withType<Wrapper> {
distributionType = Wrapper.DistributionType.ALL
}
withType<JavaCompile> {
options.apply {
if (10 <= targetJavaVersion || JavaVersion.current().isJava10Compatible) {
release = targetJavaVersion
}
encoding = Charsets.UTF_8.name()
compilerArgs.add("-Xlint:-options")
}
}
withType<ProcessResources> {
val properties = mapOf(
"description" to rootProject.description,
"version" to rootProject.version
)
inputs.properties(properties)
filteringCharset = Charsets.UTF_8.name()
filesMatching(listOf("plugin.yaml", "plugin.yml")) {
expand(properties)
}
}
withType<Test> {
useJUnitPlatform()
}
withType<ShadowJar> {
archiveFileName = rootProject.run {
"$name-v$version-bukkit.jar"
}
val group = rootProject.group.toString()
val destination = "$group.hc.dependencies"
sequenceOf(
"notchity"
).forEach {
relocate("$group.$it", "$destination.$it")
}
mergeServiceFiles()
minimize()
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
pom {
name = rootProject.name
description = rootProject.description
url = "https://github.com/kvdpxne/hide-commands"
licenses {
license {
name = "MIT License"
url = "https://opensource.org/licenses/MIT"
}
}
}
from(components["java"])
}
}
}