diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index 6963cb9c..d87400c6 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -140,7 +140,8 @@ public static final class Config { public boolean isWarningMissArchJava; public boolean enabledProGuard; public boolean stripLineNumbers; - + public boolean deleteTempFiles; + public String startScript; @@ -576,9 +577,11 @@ private void generateConfigIfNotExists() throws IOException { newConfig.whitelistRejectString = "Вас нет в белом списке"; newConfig.threadCoreCount = 0; // on your own + newConfig.threadCount = JVMHelper.OPERATING_SYSTEM_MXBEAN.getAvailableProcessors() >= 4 ? JVMHelper.OPERATING_SYSTEM_MXBEAN.getAvailableProcessors() / 2 : JVMHelper.OPERATING_SYSTEM_MXBEAN.getAvailableProcessors(); + newConfig.enabledProGuard = true; newConfig.stripLineNumbers = false; - newConfig.threadCount = JVMHelper.OPERATING_SYSTEM_MXBEAN.getAvailableProcessors() >= 4 ? JVMHelper.OPERATING_SYSTEM_MXBEAN.getAvailableProcessors() / 2 : JVMHelper.OPERATING_SYSTEM_MXBEAN.getAvailableProcessors(); + newConfig.deleteTempFiles = false; // Set server address LogHelper.println("LaunchServer address: "); newConfig.setAddress(commandHandler.readLine()); diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JARLauncherBinary.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JARLauncherBinary.java index 24f3fae7..d2439615 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JARLauncherBinary.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JARLauncherBinary.java @@ -54,12 +54,13 @@ public void build() throws IOException { long time_task_end = System.currentTimeMillis(); long time_task = time_task_end - time_this; time_this = time_task_end; - if (isNeedDelete) Files.delete(oldPath); + if (isNeedDelete && server.config.deleteTempFiles) Files.delete(oldPath); isNeedDelete = task.allowDelete(); LogHelper.subInfo("Task %s processed from %d millis",task.getName(), time_task); } long time_end = System.currentTimeMillis(); - IOHelper.move(thisPath, syncBinaryFile); + if (isNeedDelete && server.config.deleteTempFiles) IOHelper.move(thisPath, syncBinaryFile); + else IOHelper.copy(thisPath, syncBinaryFile); LogHelper.info("Build successful from %d millis",time_end - time_start); } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/api/AttachJarsTask.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/api/AttachJarsTask.java index 7cce6d99..ab653eb4 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/api/AttachJarsTask.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/api/AttachJarsTask.java @@ -51,7 +51,7 @@ private void attach(ZipOutputStream output) throws IOException { ZipEntry e = input.getNextEntry(); while (e != null) { String filename = e.getName(); - if (exclusions.stream().noneMatch(exc -> filename.startsWith(exc))) { + if (exclusions.stream().noneMatch(filename::startsWith)) { output.putNextEntry(IOHelper.newZipEntry(e)); IOHelper.transfer(input, output); }