diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/BuildContext.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/BuildContext.java index 3bf50c71..b00633f7 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/BuildContext.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/BuildContext.java @@ -46,11 +46,14 @@ public class BuildContext { public final HashSet fileList; public final HashSet clientModules; public final HashSet legacyClientModules; + private Path runtimeDir; + private boolean deleteRuntimeDir; - public BuildContext(ZipOutputStream output, List readerClassPath, MainBuildTask task) { + public BuildContext(ZipOutputStream output, List readerClassPath, MainBuildTask task, Path runtimeDir) { this.output = output; this.readerClassPath = readerClassPath; this.task = task; + this.runtimeDir = runtimeDir; fileList = new HashSet<>(1024); clientModules = new HashSet<>(); legacyClientModules = new HashSet<>(); @@ -103,6 +106,14 @@ public void pushJarFile(Path jarfile, Predicate filter, Predicate filter, Predicate needTransform) throws IOException { try (ZipInputStream input = new ZipInputStream(IOHelper.newInput(jarfile))) { ZipEntry e = input.getNextEntry(); @@ -129,6 +140,16 @@ public void pushJarFile(URL jarfile, Predicate filter, Predicate { diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/MainBuildTask.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/MainBuildTask.java index 0be26b3a..9475456f 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/MainBuildTask.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/MainBuildTask.java @@ -53,7 +53,7 @@ public String getName() { public Path process(Path inputJar) throws IOException { Path outputJar = server.launcherBinary.nextPath(this); try (ZipOutputStream output = new ZipOutputStream(IOHelper.newOutput(outputJar))) { - BuildContext context = new BuildContext(output, reader.getCp(), this); + BuildContext context = new BuildContext(output, reader.getCp(), this, server.launcherBinary.runtimeDir); initProps(); preBuildHook.hook(context); properties.put("launcher.legacymodules", context.legacyClientModules.stream().map(e -> Type.getObjectType(e.replace('.', '/'))).collect(Collectors.toList())); @@ -69,9 +69,12 @@ public Path process(Path inputJar) throws IOException { Map runtime = new HashMap<>(256); // Write launcher guard dir if (server.config.launcher.encryptRuntime) { - context.pushEncryptedDir(server.launcherBinary.runtimeDir, Launcher.RUNTIME_DIR, server.runtime.runtimeEncryptKey, runtime, false); + context.pushEncryptedDir(context.getRuntimeDir(), Launcher.RUNTIME_DIR, server.runtime.runtimeEncryptKey, runtime, false); } else { - context.pushDir(server.launcherBinary.runtimeDir, Launcher.RUNTIME_DIR, runtime, false); + context.pushDir(context.getRuntimeDir(), Launcher.RUNTIME_DIR, runtime, false); + } + if(context.isDeleteRuntimeDir()) { + IOHelper.deleteDir(context.getRuntimeDir(), true); } LauncherConfig launcherConfig = new LauncherConfig(server.config.netty.address, server.keyAgreementManager.ecdsaPublicKey, server.keyAgreementManager.rsaPublicKey, runtime, server.config.projectName); diff --git a/Launcher/build.gradle b/Launcher/build.gradle index 11bf8b2b..9c7b81ba 100644 --- a/Launcher/build.gradle +++ b/Launcher/build.gradle @@ -1,4 +1,3 @@ -apply plugin: 'org.openjfx.javafxplugin' apply plugin: 'com.github.johnrengelman.shadow' String mainClassName = "pro.gravit.launcher.start.ClientLauncherWrapper" @@ -9,10 +8,6 @@ url "https://repo.spring.io/plugins-release/" } } -javafx { - version = "12" - modules = ['javafx.controls', 'javafx.fxml'] -} sourceCompatibility = '17' targetCompatibility = '17' diff --git a/build.gradle b/build.gradle index a586a61d..d8bf3d63 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ id 'com.github.johnrengelman.shadow' version '7.1.2' apply false id 'maven-publish' id 'signing' - id 'org.openjfx.javafxplugin' version '0.0.10' apply false + id 'org.openjfx.javafxplugin' version '0.1.0' apply false } group = 'pro.gravit.launcher' version = '5.6.0-SNAPSHOT'