mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-01-09 00:59:44 +03:00
[FIX] Финальные фиксы после удаления Radon.
This commit is contained in:
parent
8bb760ac01
commit
442e612ca3
4 changed files with 7 additions and 64 deletions
|
@ -64,7 +64,6 @@
|
|||
import pro.gravit.launchserver.components.Component;
|
||||
import pro.gravit.launchserver.components.RegLimiterComponent;
|
||||
import pro.gravit.launchserver.config.LaunchServerRuntimeConfig;
|
||||
import pro.gravit.launchserver.dao.UserService;
|
||||
import pro.gravit.launchserver.dao.provider.DaoProvider;
|
||||
import pro.gravit.launchserver.manangers.*;
|
||||
import pro.gravit.launchserver.manangers.hook.AuthHookManager;
|
||||
|
@ -152,7 +151,6 @@ public AuthProviderPair getAuthProviderPair() {
|
|||
|
||||
public boolean isWarningMissArchJava;
|
||||
public boolean enabledProGuard;
|
||||
public boolean enabledRadon;
|
||||
public boolean stripLineNumbers;
|
||||
public boolean deleteTempFiles;
|
||||
|
||||
|
@ -747,7 +745,6 @@ private void generateConfigIfNotExists(boolean testEnv) throws IOException {
|
|||
newConfig.launcher = new LauncherConf();
|
||||
newConfig.launcher.guardType = "no";
|
||||
|
||||
newConfig.enabledRadon = true;
|
||||
newConfig.genMappings = true;
|
||||
newConfig.enabledProGuard = true;
|
||||
newConfig.stripLineNumbers = true;
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
import pro.gravit.launchserver.binary.tasks.MainBuildTask;
|
||||
import pro.gravit.launchserver.binary.tasks.PrepareBuildTask;
|
||||
import pro.gravit.launchserver.binary.tasks.ProGuardBuildTask;
|
||||
import pro.gravit.launchserver.binary.tasks.RadonBuildTask;
|
||||
import pro.gravit.utils.helper.CommonHelper;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
|
@ -51,7 +50,6 @@ public void init() {
|
|||
if (server.config.launcher.attachLibraryBeforeProGuard) tasks.add(new AttachJarsTask(server));
|
||||
tasks.add(new ProGuardBuildTask(server));
|
||||
tasks.add(new AdditionalFixesApplyTask(server));
|
||||
tasks.add(new RadonBuildTask(server));
|
||||
if (!server.config.launcher.attachLibraryBeforeProGuard) tasks.add(new AttachJarsTask(server));
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
import pro.gravit.launchserver.asm.ClassMetadataReader;
|
||||
import pro.gravit.launchserver.asm.SafeClassWriter;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
import pro.gravit.utils.helper.LogHelper;
|
||||
|
||||
public class AdditionalFixesApplyTask implements LauncherBuildTask {
|
||||
private final LaunchServer server;
|
||||
|
@ -73,7 +74,12 @@ public static void apply(Path inputFile, Path addFile, ZipOutputStream output, L
|
|||
IOHelper.transfer(input, outputStream);
|
||||
bytes = outputStream.toByteArray();
|
||||
}
|
||||
output.write(classFix(bytes, reader, srv.config.stripLineNumbers));
|
||||
try {
|
||||
bytes = classFix(bytes, reader, srv.config.stripLineNumbers);
|
||||
} catch (Throwable t) {
|
||||
LogHelper.subWarning("Erorr on fixing class: " + t);
|
||||
}
|
||||
output.write(bytes);
|
||||
} else
|
||||
IOHelper.transfer(input, output);
|
||||
e = input.getNextEntry();
|
||||
|
@ -86,7 +92,6 @@ private static byte[] classFix(byte[] bytes, ClassMetadataReader reader, boolean
|
|||
ClassReader cr = new ClassReader(bytes);
|
||||
ClassNode cn = new ClassNode();
|
||||
cr.accept(cn, stripNumbers ? (ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES) : ClassReader.SKIP_FRAMES);
|
||||
|
||||
ClassWriter cw = new SafeClassWriter(reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
||||
cn.accept(cw);
|
||||
return cw.toByteArray();
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
package pro.gravit.launchserver.binary.tasks;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import me.itzsomebody.radon.Radon;
|
||||
import me.itzsomebody.radon.SessionInfo;
|
||||
import me.itzsomebody.radon.config.ConfigurationParser;
|
||||
import pro.gravit.launchserver.LaunchServer;
|
||||
import pro.gravit.utils.helper.IOHelper;
|
||||
import pro.gravit.utils.helper.UnpackHelper;
|
||||
|
||||
public class RadonBuildTask implements LauncherBuildTask {
|
||||
private final LaunchServer srv;
|
||||
public final Path config;
|
||||
|
||||
public RadonBuildTask(LaunchServer srv) {
|
||||
this.srv = srv;
|
||||
config = this.srv.dir.resolve("radon.yml");
|
||||
System.setProperty("radon.useJVMCP", "true");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Radon";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path process(Path inputFile) throws IOException {
|
||||
Path outputFile = srv.launcherBinary.nextLowerPath(this);
|
||||
Files.deleteIfExists(outputFile);
|
||||
if (srv.config.enabledRadon) {
|
||||
if (!IOHelper.isFile(config))
|
||||
UnpackHelper.unpack(IOHelper.getResourceURL("pro/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<File> libs = srv.launcherBinary.coreLibs.stream().map(Path::toFile).collect(Collectors.toList());
|
||||
libs.addAll(srv.launcherBinary.addonLibs.stream().map(Path::toFile).collect(Collectors.toList()));
|
||||
info.setLibraries(libs);
|
||||
Radon r = new Radon(info);
|
||||
r.run();
|
||||
} else
|
||||
IOHelper.copy(inputFile, outputFile);
|
||||
return outputFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowDelete() {
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue