build: Replace custom runVelocity task with run-velocity plugin, use run-waterfall in bungee example, update run-paper
also attach example build tasks to `assemble` instead of `build`
This commit is contained in:
parent
c36cf6b937
commit
3fc62ce358
6 changed files with 24 additions and 60 deletions
|
|
@ -1,9 +1,9 @@
|
||||||
import xyz.jpenilla.runpaper.task.RunServerTask
|
import xyz.jpenilla.runpaper.task.RunServer
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("cloud.example-conventions")
|
id("cloud.example-conventions")
|
||||||
id("com.github.johnrengelman.shadow")
|
id("com.github.johnrengelman.shadow")
|
||||||
id("xyz.jpenilla.run-paper") version "1.0.6"
|
id("xyz.jpenilla.run-paper")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
@ -28,7 +28,7 @@ tasks {
|
||||||
relocate("me.lucko", "cloud.commandframework.example.lucko")
|
relocate("me.lucko", "cloud.commandframework.example.lucko")
|
||||||
relocate("io.leangen.geantyref", "cloud.commandframework.example.geantyref")
|
relocate("io.leangen.geantyref", "cloud.commandframework.example.geantyref")
|
||||||
}
|
}
|
||||||
build {
|
assemble {
|
||||||
dependsOn(shadowJar)
|
dependsOn(shadowJar)
|
||||||
}
|
}
|
||||||
runServer {
|
runServer {
|
||||||
|
|
@ -39,11 +39,12 @@ tasks {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup a run task for each supported version
|
// Set up a run task for each supported version
|
||||||
mapOf(
|
mapOf(
|
||||||
setOf("1.8.8", "1.9.4", "1.10.2", "1.11.2") to 11,
|
8 to setOf("1.8.8"),
|
||||||
setOf("1.12.2", "1.13.2", "1.14.4", "1.15.2", "1.16.5", "1.17.1", "1.18.2", "1.19.2") to 17,
|
11 to setOf("1.9.4", "1.10.2", "1.11.2"),
|
||||||
).forEach { (minecraftVersions, javaVersion) ->
|
17 to setOf("1.12.2", "1.13.2", "1.14.4", "1.15.2", "1.16.5", "1.17.1", "1.18.2", "1.19.2"),
|
||||||
|
).forEach { (javaVersion, minecraftVersions) ->
|
||||||
for (version in minecraftVersions) {
|
for (version in minecraftVersions) {
|
||||||
createVersionedRun(version, javaVersion)
|
createVersionedRun(version, javaVersion)
|
||||||
}
|
}
|
||||||
|
|
@ -53,7 +54,7 @@ tasks {
|
||||||
fun TaskContainerScope.createVersionedRun(
|
fun TaskContainerScope.createVersionedRun(
|
||||||
version: String,
|
version: String,
|
||||||
javaVersion: Int
|
javaVersion: Int
|
||||||
) = register<RunServerTask>("runServer${version.replace(".", "_")}") {
|
) = register<RunServer>("runServer${version.replace(".", "_")}") {
|
||||||
group = "cloud"
|
group = "cloud"
|
||||||
pluginJars.from(shadowJar.flatMap { it.archiveFile })
|
pluginJars.from(shadowJar.flatMap { it.archiveFile })
|
||||||
minecraftVersion(version)
|
minecraftVersion(version)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("cloud.example-conventions")
|
id("cloud.example-conventions")
|
||||||
id ("com.github.johnrengelman.shadow")
|
id("com.github.johnrengelman.shadow")
|
||||||
|
id("xyz.jpenilla.run-waterfall")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
|
@ -9,9 +10,12 @@ tasks {
|
||||||
exclude(dependency("net.md-5:bungeecord-api:1.8-SNAPSHOT"))
|
exclude(dependency("net.md-5:bungeecord-api:1.8-SNAPSHOT"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
build {
|
assemble {
|
||||||
dependsOn(shadowJar)
|
dependsOn(shadowJar)
|
||||||
}
|
}
|
||||||
|
runWaterfall {
|
||||||
|
waterfallVersion("1.19")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ application {
|
||||||
mainClassName = "cloud.commandframework.examples.javacord.ExampleBot"
|
mainClassName = "cloud.commandframework.examples.javacord.ExampleBot"
|
||||||
}
|
}
|
||||||
|
|
||||||
build.dependsOn(shadowJar)
|
assemble.dependsOn(shadowJar)
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
build {
|
assemble {
|
||||||
dependsOn(shadowJar)
|
dependsOn(shadowJar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,67 +1,24 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("com.github.johnrengelman.shadow")
|
id("com.github.johnrengelman.shadow")
|
||||||
id("cloud.example-conventions")
|
id("cloud.example-conventions")
|
||||||
|
id("xyz.jpenilla.run-velocity")
|
||||||
}
|
}
|
||||||
|
|
||||||
indra {
|
indra {
|
||||||
javaVersions().target(11) // Velocity 3 requires Java 11
|
javaVersions().target(11) // Velocity 3 requires Java 11
|
||||||
}
|
}
|
||||||
|
|
||||||
val velocityRunClasspath by configurations.creating {
|
|
||||||
attributes {
|
|
||||||
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage::class, Usage.JAVA_RUNTIME))
|
|
||||||
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category::class, Category.LIBRARY))
|
|
||||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements::class, LibraryElements.JAR))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
ivy("https://versions.velocitypowered.com/download/") {
|
|
||||||
patternLayout { artifact("[revision].[ext]") }
|
|
||||||
metadataSources { artifact() }
|
|
||||||
content { includeModule("com.velocitypowered", "velocity-proxy") }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
shadowJar {
|
shadowJar {
|
||||||
dependencies {
|
dependencies {
|
||||||
exclude(dependency("com.velocitypowered:velocity-api"))
|
exclude(dependency("com.velocitypowered:velocity-api"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
build {
|
assemble {
|
||||||
dependsOn(shadowJar)
|
dependsOn(shadowJar)
|
||||||
}
|
}
|
||||||
|
runVelocity {
|
||||||
val pluginJar = shadowJar.map { it.outputs }
|
velocityVersion(libs.versions.velocityApi.get())
|
||||||
val velocityRunFiles = velocityRunClasspath.asFileTree
|
|
||||||
register("runVelocity", JavaExec::class) {
|
|
||||||
group = "cloud"
|
|
||||||
description = "Spin up a Velocity server environment"
|
|
||||||
standardInput = System.`in`
|
|
||||||
if (JavaVersion.current() < JavaVersion.VERSION_11) {
|
|
||||||
javaLauncher.set(project.javaToolchains.launcherFor { languageVersion.set(JavaLanguageVersion.of(11)) })
|
|
||||||
}
|
|
||||||
|
|
||||||
inputs.files(pluginJar)
|
|
||||||
|
|
||||||
classpath(velocityRunFiles)
|
|
||||||
workingDir = layout.projectDirectory.dir("run").asFile
|
|
||||||
|
|
||||||
doFirst {
|
|
||||||
// Prepare
|
|
||||||
val modsDir = workingDir.resolve("plugins")
|
|
||||||
if (!modsDir.isDirectory) {
|
|
||||||
modsDir.mkdirs()
|
|
||||||
}
|
|
||||||
|
|
||||||
project.copy {
|
|
||||||
into(modsDir.absolutePath)
|
|
||||||
from(pluginJar) {
|
|
||||||
rename { "${rootProject.name}-${project.name}.jar" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,5 +28,4 @@ dependencies {
|
||||||
api(project(":cloud-annotations"))
|
api(project(":cloud-annotations"))
|
||||||
annotationProcessor(libs.velocityApi)
|
annotationProcessor(libs.velocityApi)
|
||||||
compileOnly(libs.velocityApi)
|
compileOnly(libs.velocityApi)
|
||||||
velocityRunClasspath("com.velocitypowered", "velocity-proxy", libs.versions.velocityApi.get())
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@ plugins:
|
||||||
com.github.johnrengelman.shadow: 7.1.2
|
com.github.johnrengelman.shadow: 7.1.2
|
||||||
com.github.ben-manes.versions: 0.42.0
|
com.github.ben-manes.versions: 0.42.0
|
||||||
com.diffplug.spotless: &spotless 6.6.1
|
com.diffplug.spotless: &spotless 6.6.1
|
||||||
|
xyz.jpenilla.run-paper: &run-task 2.0.0
|
||||||
|
xyz.jpenilla.run-velocity: *run-task
|
||||||
|
xyz.jpenilla.run-waterfall: *run-task
|
||||||
|
|
||||||
versions:
|
versions:
|
||||||
checkstyle: 9.0
|
checkstyle: 9.0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue