[FIX] ClassPath для Radon и Proguard.

This commit is contained in:
zaxar163 2019-03-15 17:40:48 +03:00
parent 62af331966
commit 9122a700e0
No known key found for this signature in database
GPG key ID: E3B309DD3852DE06
4 changed files with 12 additions and 2 deletions

View file

@ -21,6 +21,7 @@ public final class JARLauncherBinary extends LauncherBinary {
public final Path buildDir;
public List<LauncherBuildTask> tasks;
public List<Path> coreLibs;
public List<Path> addonLibs;
public JARLauncherBinary(LaunchServer server) throws IOException {
super(server);
@ -31,6 +32,7 @@ public JARLauncherBinary(LaunchServer server) throws IOException {
buildDir = server.dir.resolve("build");
tasks = new ArrayList<>();
coreLibs = new ArrayList<>();
addonLibs = new ArrayList<>();
if (!Files.isDirectory(buildDir)) {
Files.deleteIfExists(buildDir);
Files.createDirectory(buildDir);

View file

@ -14,7 +14,6 @@
import java.util.List;
public class ProguardConf {
private static final String charsFirst = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ";
private static final String chars = "1aAbBcC2dDeEfF3gGhHiI4jJkKl5mMnNoO6pPqQrR7sStT8uUvV9wWxX0yYzZ";
private static String generateString(SecureRandom rand, String lowString, String upString, int il) {
@ -51,6 +50,9 @@ public String[] buildConfig(Path inputJar, Path outputJar) {
srv.launcherBinary.coreLibs.stream()
.map(e -> "-libraryjars \'" + e.toAbsolutePath().toString() + "\'")
.forEach(confStrs::add);
srv.launcherBinary.addonLibs.stream()
.map(e -> "-libraryjars \'" + e.toAbsolutePath().toString() + "\'")
.forEach(confStrs::add);
confStrs.add("-classobfuscationdictionary \'" + words.toFile().getName() + "\'");
confStrs.add(readConf());
return confStrs.toArray(new String[0]);

View file

@ -30,7 +30,9 @@ public String getName() {
@Override
public Path process(Path inputFile) throws IOException {
server.launcherBinary.coreLibs.clear();
server.launcherBinary.addonLibs.clear();
IOHelper.walk(server.launcherLibraries, new ListFileVisitor(server.launcherBinary.coreLibs), true);
IOHelper.walk(server.launcherLibrariesCompile, new ListFileVisitor(server.launcherBinary.addonLibs), true);
UnpackHelper.unpack(IOHelper.getResourceURL("Launcher.jar"), result);
tryUnpack();
return result;

View file

@ -4,8 +4,10 @@
import ru.gravit.utils.helper.IOHelper;
import ru.gravit.utils.helper.UnpackHelper;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import java.util.stream.Collectors;
import me.itzsomebody.radon.Radon;
@ -35,7 +37,9 @@ public Path process(Path inputFile) throws IOException {
SessionInfo info = p.createSessionFromConfig();
info.setInput(inputFile.toFile());
info.setOutput(outputFile.toFile());
info.setLibraries(srv.launcherBinary.coreLibs.stream().map(e -> e.toFile()).collect(Collectors.toList()));
List<File> 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();
return outputFile;