-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle.kts
106 lines (90 loc) · 2.9 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "2.0.0"
kotlin("plugin.serialization") version "2.0.0"
id("com.github.johnrengelman.shadow") version "8.1.1"
}
group = "top.e404"
version = "1.7.1"
val epluginVersion = "1.3.0"
fun kotlinx(id: String, version: String) = "org.jetbrains.kotlinx:kotlinx-$id:$version"
fun eplugin(id: String, version: String = epluginVersion) = "top.e404:eplugin-$id:$version"
repositories {
// spigot
// maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
// paper
maven("https://repo.papermc.io/repository/maven-public/")
// papi
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
// mm
maven("https://mvn.lumine.io/repository/maven-public/")
mavenCentral()
mavenLocal()
}
dependencies {
// spigot
// compileOnly("org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT")
compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
// eplugin
implementation(eplugin("core"))
implementation(eplugin("serialization"))
implementation(eplugin("menu"))
implementation(eplugin("adventure"))
implementation(eplugin("serialization-adventure"))
implementation(eplugin("hook-slimefun"))
implementation(eplugin("hook-mmoitems"))
// sf
compileOnly("com.github.slimefun:Slimefun:a3ef74c-Beta")
// networks
compileOnly("io.github.sefiraat:networks:MODIFIED_1.2.0")
// mi
compileOnly("net.Indyuce:MMOItems:6.7.3")
}
tasks {
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
withType<JavaCompile> {
targetCompatibility = "17"
}
processResources {
filesMatching("plugin.yml") {
expand(project.properties)
}
}
build {
finalizedBy(shadowJar)
}
var prepare = false
create("prepare") {
doFirst {
prepare = true
}
}
shadowJar {
archiveFileName.set("${project.name}-${project.version}.jar")
exclude("META-INF/**")
relocate("kotlin", "top.e404.slimefun.stackingmachine.relocate.kotlin")
relocate("top.e404.eplugin", "top.e404.slimefun.stackingmachine.relocate.eplugin")
val outFile = this.archiveFile.get().asFile
val jarDir = rootDir.resolve("jar").also(File::mkdir)
val copyFile = jarDir.resolve(outFile.name)
doFirst {
jarDir.listFiles()?.forEach {
println("deleted ${it.absolutePath}")
it.delete()
}
}
doLast {
println("copy ${copyFile.absolutePath}")
outFile.copyTo(copyFile)
if (prepare) {
rootDir.resolve("run/plugins").run {
val pluginFile = resolve(outFile.name)
pluginFile.delete()
outFile.copyTo(pluginFile)
}
}
}
}
}