[FIX] Возможность отключить Radon.

This commit is contained in:
zaxar163 2019-03-15 20:55:34 +03:00
parent f20816b9a2
commit 8ed337d709
No known key found for this signature in database
GPG key ID: E3B309DD3852DE06
2 changed files with 16 additions and 11 deletions

View file

@ -120,6 +120,7 @@ public static final class Config {
public boolean isWarningMissArchJava; public boolean isWarningMissArchJava;
public boolean enabledProGuard; public boolean enabledProGuard;
public boolean enabledRadon;
public boolean stripLineNumbers; public boolean stripLineNumbers;
public boolean deleteTempFiles; public boolean deleteTempFiles;
public boolean enableRcon; public boolean enableRcon;
@ -641,6 +642,7 @@ private void generateConfigIfNotExists() throws IOException {
newConfig.threadCoreCount = 0; // on your own 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.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.enabledProGuard = true;
newConfig.stripLineNumbers = true; newConfig.stripLineNumbers = true;
newConfig.deleteTempFiles = true; newConfig.deleteTempFiles = true;

View file

@ -31,8 +31,9 @@ public String getName() {
@Override @Override
public Path process(Path inputFile) throws IOException { 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); 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)); ConfigurationParser p = new ConfigurationParser(IOHelper.newInput(config));
SessionInfo info = p.createSessionFromConfig(); SessionInfo info = p.createSessionFromConfig();
info.setInput(inputFile.toFile()); info.setInput(inputFile.toFile());
@ -42,6 +43,8 @@ public Path process(Path inputFile) throws IOException {
info.setLibraries(libs); info.setLibraries(libs);
Radon r = new Radon(info); Radon r = new Radon(info);
r.run(); r.run();
} else
IOHelper.copy(inputFile, outputFile);
return outputFile; return outputFile;
} }