first commit
This commit is contained in:
132
build.gradle.kts
Normal file
132
build.gradle.kts
Normal file
@@ -0,0 +1,132 @@
|
||||
import java.io.BufferedReader
|
||||
import java.io.InputStreamReader
|
||||
|
||||
|
||||
plugins {
|
||||
id("java")
|
||||
id("java-library")
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1"
|
||||
id("maven-publish")
|
||||
}
|
||||
|
||||
group = "com.andrewkydev"
|
||||
version = "1.0-SNAPSHOT"
|
||||
|
||||
val copyTo = "../server/plugins"
|
||||
val copyFrom = "build/libs/${project.name}-${project.version}.jar"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
name = "luminiadevRepositorySnapshots"
|
||||
url = uri("https://repo.luminiadev.com/snapshots")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("com.koshakmine:Lumi:1.4.0-SNAPSHOT")
|
||||
implementation("com.zaxxer:HikariCP:5.1.0")
|
||||
implementation("com.mysql:mysql-connector-j:8.3.0")
|
||||
implementation("org.postgresql:postgresql:42.7.2")
|
||||
implementation("com.google.code.gson:gson:2.11.0")
|
||||
|
||||
}
|
||||
|
||||
|
||||
tasks.build {
|
||||
// finalizedBy(tasks.shadowJar)
|
||||
}
|
||||
|
||||
tasks.shadowJar {
|
||||
// finalizedBy(tasks.named("copyToPath"))
|
||||
}
|
||||
|
||||
|
||||
tasks {
|
||||
shadowJar {
|
||||
|
||||
setProperty("zip64", true)
|
||||
mergeServiceFiles()
|
||||
archiveClassifier.set("")
|
||||
archiveFileName.set("${project.name}-${project.version}.jar")
|
||||
|
||||
dependencies {
|
||||
exclude(
|
||||
"**/**.properties",
|
||||
"**/*.swp",
|
||||
"addons/*",
|
||||
"creativeitems*.json",
|
||||
"*.dat",
|
||||
"*.dat",
|
||||
"*.xsd",
|
||||
"structures/**",
|
||||
"RuntimeBlockStatesExtras/**",
|
||||
"recipes/**",
|
||||
"cn/nukkit/**",
|
||||
"co/aikar/timings/**",
|
||||
"it/uni mi/dsi/fastutil/**",
|
||||
"assets/org/apache/commons/math3/random/**",
|
||||
)
|
||||
}
|
||||
mergeServiceFiles()
|
||||
}
|
||||
}
|
||||
|
||||
//tasks.register("copyToPath") {
|
||||
// doLast {
|
||||
// copy {
|
||||
// from(copyFrom)
|
||||
// into(copyTo)
|
||||
// }
|
||||
// }
|
||||
// dependsOn(tasks.named("shadowJar"))
|
||||
// finalizedBy(tasks.named("reloadServer"))
|
||||
//}
|
||||
|
||||
tasks.register("reloadServer") {
|
||||
|
||||
doLast {
|
||||
val commands = listOf(
|
||||
listOf("../server/mcrcon.exe", "-H", "127.0.0.1", "-p", "5MDRlOTFk1", "-w", "1", "fr"),
|
||||
listOf("../server/mcrcon.exe", "-H", "127.0.0.1", "-p", "5MDRlOTFk1", "-w", "1", "reload again")
|
||||
)
|
||||
|
||||
fun executeCommand(command: List<String>) {
|
||||
val processBuilder = ProcessBuilder(command)
|
||||
val process = processBuilder.start()
|
||||
val reader =
|
||||
BufferedReader(InputStreamReader(process.inputStream))
|
||||
var line: String?
|
||||
|
||||
while (reader.readLine().also { line = it } != null) {
|
||||
println(line)
|
||||
}
|
||||
|
||||
process.waitFor()
|
||||
}
|
||||
|
||||
executeCommand(commands[0])
|
||||
|
||||
executeCommand(commands[1])
|
||||
executeCommand(commands[1])
|
||||
}
|
||||
dependsOn(tasks.named("copyToPath"))
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
groupId = project.group.toString()
|
||||
artifactId = project.name
|
||||
version = project.version.toString()
|
||||
|
||||
artifact(tasks.shadowJar.get()) {
|
||||
classifier = null
|
||||
}
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
mavenLocal()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user