[FEATURE] Параметры, относящиеся к сборке лаунчера перенесены в раздел launcher

This commit is contained in:
Gravit 2019-08-09 23:04:26 +07:00
parent 9f5c2666b0
commit ca19734a88
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
6 changed files with 17 additions and 19 deletions

View file

@ -147,15 +147,8 @@ public AuthProviderPair getAuthProviderPair() {
public GuardLicenseConf guardLicense;
public String whitelistRejectString;
public boolean genMappings;
public LauncherConf launcher;
public boolean isWarningMissArchJava;
public boolean enabledProGuard;
public boolean stripLineNumbers;
public boolean deleteTempFiles;
public String startScript;
public void setProjectName(String projectName) {
@ -276,6 +269,11 @@ public class LauncherConf {
public String guardType;
public boolean attachLibraryBeforeProGuard;
public boolean compress;
public boolean warningMissArchJava;
public boolean enabledProGuard;
public boolean stripLineNumbers;
public boolean deleteTempFiles;
public boolean proguardGenMappings;
}
public class NettyConfig {
@ -802,12 +800,12 @@ private void generateConfigIfNotExists(boolean testEnv) throws IOException {
newConfig.launcher = new LauncherConf();
newConfig.launcher.guardType = "no";
newConfig.launcher.compress = true;
newConfig.genMappings = true;
newConfig.enabledProGuard = true;
newConfig.stripLineNumbers = true;
newConfig.deleteTempFiles = true;
newConfig.isWarningMissArchJava = true;
newConfig.launcher.warningMissArchJava = true;
newConfig.launcher.attachLibraryBeforeProGuard = false;
newConfig.launcher.deleteTempFiles = true;
newConfig.launcher.enabledProGuard = true;
newConfig.launcher.stripLineNumbers = true;
newConfig.launcher.proguardGenMappings = true;
newConfig.components = new HashMap<>();
AuthLimiterComponent authLimiterComponent = new AuthLimiterComponent();

View file

@ -64,12 +64,12 @@ 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 && server.config.deleteTempFiles) Files.deleteIfExists(oldPath);
if (isNeedDelete && server.config.launcher.deleteTempFiles) Files.deleteIfExists(oldPath);
isNeedDelete = task.allowDelete();
LogHelper.subInfo("Task %s processed from %d millis", task.getName(), time_task);
}
long time_end = System.currentTimeMillis();
if (isNeedDelete && server.config.deleteTempFiles) IOHelper.move(thisPath, syncBinaryFile);
if (isNeedDelete && server.config.launcher.deleteTempFiles) IOHelper.move(thisPath, syncBinaryFile);
else IOHelper.copy(thisPath, syncBinaryFile);
LogHelper.info("Build successful from %d millis", time_end - time_start);
}

View file

@ -44,7 +44,7 @@ public ProguardConf(LaunchServer srv) {
public String[] buildConfig(Path inputJar, Path outputJar) {
List<String> confStrs = new ArrayList<>();
prepare(false);
if (srv.config.genMappings) confStrs.add("-printmapping \'" + mappings.toFile().getName() + "\'");
if (srv.config.launcher.proguardGenMappings) confStrs.add("-printmapping \'" + mappings.toFile().getName() + "\'");
confStrs.add("-obfuscationdictionary \'" + words.toFile().getName() + "\'");
confStrs.add("-injar \'" + inputJar.toAbsolutePath() + "\'");
confStrs.add("-outjar \'" + outputJar.toAbsolutePath() + "\'");

View file

@ -75,7 +75,7 @@ public static void apply(Path inputFile, Path addFile, ZipOutputStream output, L
bytes = outputStream.toByteArray();
}
try {
bytes = classFix(bytes, reader, srv.config.stripLineNumbers);
bytes = classFix(bytes, reader, srv.config.launcher.stripLineNumbers);
} catch (Throwable t) {
LogHelper.subWarning("Error on fixing class: " + t);
}

View file

@ -135,7 +135,7 @@ public Path process(Path inputJar) throws IOException {
jaConfigurator.setSecretKey(SecurityHelper.randomStringAESKey());
jaConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512));
jaConfigurator.setGuardType(server.config.launcher.guardType);
jaConfigurator.setWarningMissArchJava(server.config.isWarningMissArchJava);
jaConfigurator.setWarningMissArchJava(server.config.launcher.warningMissArchJava);
jaConfigurator.setEnv(server.config.env);
if (server.runtime.oemUnlockKey == null) server.runtime.oemUnlockKey = SecurityHelper.randomStringToken();
jaConfigurator.setOemUnlockKey(server.runtime.oemUnlockKey);

View file

@ -26,7 +26,7 @@ public String getName() {
@Override
public Path process(Path inputFile) throws IOException {
Path outputJar = server.launcherBinary.nextLowerPath(this);
if (server.config.enabledProGuard) {
if (server.config.launcher.enabledProGuard) {
Configuration proguard_cfg = new Configuration();
ConfigurationParser parser = new ConfigurationParser(server.proguardConf.buildConfig(inputFile, outputJar),
server.proguardConf.proguard.toFile(), System.getProperties());