From 8ed337d70945578c5d5126fbef70278c35669e5a Mon Sep 17 00:00:00 2001 From: zaxar163 Date: Fri, 15 Mar 2019 20:55:34 +0300 Subject: [PATCH] =?UTF-8?q?[FIX]=20=D0=92=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20=D0=BE=D1=82=D0=BA=D0=BB=D1=8E?= =?UTF-8?q?=D1=87=D0=B8=D1=82=D1=8C=20Radon.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ru/gravit/launchserver/LaunchServer.java | 2 ++ .../binary/tasks/RadonBuildTask.java | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index 5cfec95d..82dedaea 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -120,6 +120,7 @@ public static final class Config { public boolean isWarningMissArchJava; public boolean enabledProGuard; + public boolean enabledRadon; public boolean stripLineNumbers; public boolean deleteTempFiles; public boolean enableRcon; @@ -641,6 +642,7 @@ private void generateConfigIfNotExists() throws IOException { 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.enabledRadon = true; newConfig.enabledProGuard = true; newConfig.stripLineNumbers = true; newConfig.deleteTempFiles = true; diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/RadonBuildTask.java b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/RadonBuildTask.java index ddba3c90..c7ab1468 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/RadonBuildTask.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/binary/tasks/RadonBuildTask.java @@ -31,17 +31,20 @@ public String getName() { @Override public Path process(Path inputFile) throws IOException { - if (!IOHelper.isFile(config)) UnpackHelper.unpack(IOHelper.getResourceURL("ru/gravit/launchserver/defaults/radon.cfg"), config); - Path outputFile = srv.launcherBinary.nextLowerPath(this); - ConfigurationParser p = new ConfigurationParser(IOHelper.newInput(config)); - SessionInfo info = p.createSessionFromConfig(); - info.setInput(inputFile.toFile()); - info.setOutput(outputFile.toFile()); - List libs = srv.launcherBinary.coreLibs.stream().map(e -> e.toFile()).collect(Collectors.toList()); - libs.addAll(srv.launcherBinary.addonLibs.stream().map(e -> e.toFile()).collect(Collectors.toList())); - info.setLibraries(libs); - Radon r = new Radon(info); - r.run(); + Path outputFile = srv.launcherBinary.nextLowerPath(this); + if (srv.config.enabledRadon) { + if (!IOHelper.isFile(config)) UnpackHelper.unpack(IOHelper.getResourceURL("ru/gravit/launchserver/defaults/radon.cfg"), config); + ConfigurationParser p = new ConfigurationParser(IOHelper.newInput(config)); + SessionInfo info = p.createSessionFromConfig(); + info.setInput(inputFile.toFile()); + info.setOutput(outputFile.toFile()); + List libs = srv.launcherBinary.coreLibs.stream().map(e -> e.toFile()).collect(Collectors.toList()); + libs.addAll(srv.launcherBinary.addonLibs.stream().map(e -> e.toFile()).collect(Collectors.toList())); + info.setLibraries(libs); + Radon r = new Radon(info); + r.run(); + } else + IOHelper.copy(inputFile, outputFile); return outputFile; }