diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index 3742ecd3..fc50a453 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -135,6 +135,7 @@ public static final class Config { public boolean isDownloadJava; public boolean isWarningMissArchJava; + public boolean enabledProGuard; public String startScript; @@ -570,6 +571,7 @@ private void generateConfigIfNotExists() throws IOException { newConfig.whitelistRejectString = "Вас нет в белом списке"; newConfig.threadCoreCount = 0; // on your own + newConfig.enabledProGuard = true; newConfig.threadCount = JVMHelper.OPERATING_SYSTEM_MXBEAN.getAvailableProcessors() >= 4 ? JVMHelper.OPERATING_SYSTEM_MXBEAN.getAvailableProcessors() / 2 : JVMHelper.OPERATING_SYSTEM_MXBEAN.getAvailableProcessors(); // Set server address 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 80b2576c..93adb743 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JARLauncherBinary.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/JARLauncherBinary.java @@ -53,7 +53,7 @@ public JARLauncherBinary(LaunchServer server) throws IOException { tasks = new ArrayList<>(); tasks.add(new UnpackBuildTask()); tasks.add(new MainBuildTask()); - tasks.add(new ProGuardBuildTask()); + if(server.config.enabledProGuard) tasks.add(new ProGuardBuildTask()); syncBinaryFile = server.dir.resolve(server.config.binaryName + ".jar"); /*runtimeDir = server.dir.resolve(Launcher.RUNTIME_DIR); guardDir = server.dir.resolve(Launcher.GUARD_DIR); @@ -73,17 +73,23 @@ public void build() throws IOException { LogHelper.info("Building launcher binary file"); Path thisPath = null; boolean isNeedDelete = false; + long time_start = System.currentTimeMillis(); + long time_this = time_start; for(LauncherBuildTask task : tasks) { LogHelper.subInfo("Task %s",task.getName()); Path oldPath = thisPath; thisPath = task.process(oldPath); + long time_task_end = System.currentTimeMillis(); + long time_task = time_task_end - time_this; + time_this = time_task_end; if(isNeedDelete) Files.delete(oldPath); isNeedDelete = task.allowDelete(); - LogHelper.subInfo("Task %s processed",task.getName()); + LogHelper.subInfo("Task %s processed from %d millis",task.getName(), time_task); } + long time_end = System.currentTimeMillis(); IOHelper.move(thisPath, syncBinaryFile); - LogHelper.info("Build successful"); + LogHelper.info("Build successful from %d millis",time_end - time_start); // ProGuard diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/LauncherBuildTask.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/LauncherBuildTask.java index d8d5a9ad..59d337ce 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/LauncherBuildTask.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/LauncherBuildTask.java @@ -5,7 +5,6 @@ public interface LauncherBuildTask { String getName(); - int priority(); Path process(Path inputFile) throws IOException; boolean allowDelete(); } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java index 5636b6df..4389c636 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/MainBuildTask.java @@ -109,17 +109,12 @@ private static ZipEntry newGuardEntry(String fileName) { public MainBuildTask() { runtimeDir = server.dir.resolve(Launcher.RUNTIME_DIR); guardDir = server.dir.resolve(Launcher.GUARD_DIR); - binaryFile = server.dir.resolve(server.config.binaryName + "-main_task.jar"); + binaryFile = server.dir.resolve(server.config.binaryName + "-main.jar"); } @Override public String getName() { - return "main"; - } - - @Override - public int priority() { - return 0; + return "MainBuild"; } @Override diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/ProGuardBuildTask.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/ProGuardBuildTask.java index c3f9dd7c..73ebd9c3 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/ProGuardBuildTask.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/ProGuardBuildTask.java @@ -13,12 +13,7 @@ public class ProGuardBuildTask implements LauncherBuildTask { public static LaunchServer server = LaunchServer.server; @Override public String getName() { - return "proguard"; - } - - @Override - public int priority() { - return 1; + return "ProGuard"; } @Override diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/UnpackBuildTask.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/UnpackBuildTask.java index 8b845e05..95242ede 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/UnpackBuildTask.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/UnpackBuildTask.java @@ -12,12 +12,7 @@ public class UnpackBuildTask implements LauncherBuildTask { public static LaunchServer server = LaunchServer.server; @Override public String getName() { - return "unpack clean"; - } - - @Override - public int priority() { - return -1; + return "UnpackFromResources"; } @Override