forked from SteamWar/SteamWar
Optimize and improve VelocityCore size
Improve steamwar.devserver.gradle to not upload anything that is up to date!
This commit is contained in:
+12
@@ -22,6 +22,10 @@ plugins {
|
||||
alias(libs.plugins.shadow)
|
||||
}
|
||||
|
||||
tasks.build {
|
||||
finalizedBy(tasks.shadowJar)
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
@@ -34,4 +38,12 @@ dependencies {
|
||||
implementation(libs.jda) {
|
||||
exclude(module = "opus-java")
|
||||
}
|
||||
|
||||
implementation(libs.sqlite)
|
||||
implementation(libs.mysql)
|
||||
|
||||
implementation(libs.msgpack)
|
||||
implementation(libs.apolloprotos)
|
||||
|
||||
implementation(libs.nbt)
|
||||
}
|
||||
+3
-3
@@ -22,8 +22,8 @@ package de.steamwar.discord;
|
||||
import com.velocitypowered.api.plugin.Plugin;
|
||||
|
||||
@Plugin(
|
||||
id = "discordvelocitycore",
|
||||
name = "DiscordVelocityCore"
|
||||
id = "depencendiesvelocitycore",
|
||||
name = "DepencendiesVelocityCore"
|
||||
)
|
||||
public class Discord {
|
||||
public class Dependencies {
|
||||
}
|
||||
@@ -51,18 +51,10 @@ dependencies {
|
||||
compileOnly(libs.viavelocity)
|
||||
|
||||
compileOnly(project(":VelocityCore:Persistent", "default"))
|
||||
compileOnly(project(":VelocityCore:DiscordDependency", "default"))
|
||||
compileOnly(project(":VelocityCore:Dependencies", "default"))
|
||||
|
||||
implementation(project(":CommonCore"))
|
||||
implementation(project(":CommandFramework"))
|
||||
|
||||
implementation(libs.sqlite)
|
||||
implementation(libs.mysql)
|
||||
|
||||
implementation(libs.msgpack)
|
||||
implementation(libs.apolloprotos)
|
||||
|
||||
implementation(libs.nbt)
|
||||
}
|
||||
|
||||
tasks.register<DevServer>("DevVelocity") {
|
||||
@@ -70,6 +62,6 @@ tasks.register<DevServer>("DevVelocity") {
|
||||
description = "Run a Dev Velocity"
|
||||
dependsOn(":VelocityCore:shadowJar")
|
||||
dependsOn(":VelocityCore:Persistent:jar")
|
||||
dependsOn(":VelocityCore:DiscordDependency:jar")
|
||||
dependsOn(":VelocityCore:Dependencies:shadowJar")
|
||||
template = "DevVelocity"
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ import java.util.logging.Logger;
|
||||
@Plugin(
|
||||
id = "velocitycore",
|
||||
name = "VelocityCore",
|
||||
dependencies = { @Dependency(id = "persistentvelocitycore"), @Dependency(id = "discordvelocitycore") }
|
||||
dependencies = { @Dependency(id = "persistentvelocitycore"), @Dependency(id = "depencendiesvelocitycore") }
|
||||
)
|
||||
public class VelocityCore implements ReloadablePlugin {
|
||||
|
||||
|
||||
@@ -46,6 +46,19 @@ class DevServer extends DefaultTask {
|
||||
|
||||
DevServer() {
|
||||
super()
|
||||
List<Task> upToDateTasks = []
|
||||
project.gradle.taskGraph.addTaskExecutionListener(new TaskExecutionListener() {
|
||||
@Override
|
||||
void beforeExecute(Task task) {
|
||||
}
|
||||
|
||||
@Override
|
||||
void afterExecute(Task task, TaskState state) {
|
||||
if (state.upToDate) {
|
||||
upToDateTasks.add(task);
|
||||
}
|
||||
}
|
||||
})
|
||||
doFirst {
|
||||
List<Project> projects = []
|
||||
projects.add(project)
|
||||
@@ -70,7 +83,7 @@ class DevServer extends DefaultTask {
|
||||
}
|
||||
doLast {
|
||||
checkHasTemplate()
|
||||
uploadDependencies()
|
||||
uploadDependencies(upToDateTasks)
|
||||
startDevServer()
|
||||
}
|
||||
finalizedBy(new Finalizer())
|
||||
@@ -107,7 +120,7 @@ class DevServer extends DefaultTask {
|
||||
}
|
||||
}
|
||||
|
||||
void uploadDependencies() {
|
||||
void uploadDependencies(List<Task> upToDateTasks) {
|
||||
def base = plugins == null ? "$template/plugins" : plugins
|
||||
println("Uploading to ~/$base")
|
||||
this.dependsOn.forEach {
|
||||
@@ -119,8 +132,12 @@ class DevServer extends DefaultTask {
|
||||
} else {
|
||||
throw new GradleException("Illegal argument for uploading dependencies")
|
||||
}
|
||||
|
||||
def archive = archiveTask.archiveFile.get().asFile
|
||||
if (upToDateTasks.contains(archiveTask)) {
|
||||
println("Skipping $archive")
|
||||
return
|
||||
}
|
||||
|
||||
println("Uploading $archive")
|
||||
new ProcessBuilder("ssh", host, "-T", "rm $base/${archive.name.replace("-all", "")}").start().waitFor()
|
||||
new ProcessBuilder("scp", archive.absolutePath, "$host:~/$base/${archive.name.replace("-all", "")}").start().waitFor()
|
||||
|
||||
+1
-1
@@ -247,7 +247,7 @@ include("TutorialSystem")
|
||||
|
||||
include(
|
||||
"VelocityCore",
|
||||
"VelocityCore:DiscordDependency",
|
||||
"VelocityCore:Dependencies",
|
||||
"VelocityCore:Persistent"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user