-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle.kts
73 lines (54 loc) · 1.56 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
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
java
idea
}
group = "nexus.slime"
version = "3.5"
val targetJavaVersion = 8
// Dependencies
repositories {
mavenCentral()
maven("https://hub.spigotmc.org/nexus/content/groups/public/")
maven("https://repo.dmulloy2.net/repository/public/")
}
dependencies {
compileOnly("org.spigotmc:spigot-api:1.9.4-R0.1-SNAPSHOT")
compileOnly("io.netty:netty-all:4.1.90.Final")
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0")
compileOnly("net.luckperms:api:5.4")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.2")
}
// Set java version
java {
val javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain {
languageVersion.set(JavaLanguageVersion.of(targetJavaVersion))
}
}
}
tasks.withType(JavaCompile::class) {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible) {
options.release.set(targetJavaVersion)
}
}
// Set the right test framework
tasks.test {
useJUnitPlatform()
}
// Add version to plugin.yml
tasks.processResources {
val props = mapOf("version" to version)
inputs.properties(props)
filteringCharset = "UTF-8"
filesMatching("plugin.yml") {
expand(props)
}
filesMatching("config.yml") {
filter(ReplaceTokens::class, mapOf("tokens" to props))
}
}