mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
commit
8def68fa90
13 changed files with 126 additions and 26 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,3 +1,6 @@
|
|||
[submodule "modules"]
|
||||
path = modules
|
||||
url = git@github.com:GravitLauncher/LauncherModules.git
|
||||
[submodule "Radon"]
|
||||
path = Radon
|
||||
url = git@github.com:GravitLauncher/Radon.git
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
repositories {
|
||||
maven {
|
||||
url "http://maven.geomajas.org/"
|
||||
url "https://oss.sonatype.org/content/repositories/snapshots"
|
||||
}
|
||||
maven {
|
||||
url "https://oss.sonatype.org/content/repositories/snapshots"
|
||||
url "http://maven.geomajas.org/"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
|||
targetCompatibility = '1.8'
|
||||
|
||||
configurations {
|
||||
compileOnlyA
|
||||
bundleOnly
|
||||
bundle
|
||||
hikari
|
||||
|
@ -38,8 +39,7 @@
|
|||
|
||||
dependencies {
|
||||
pack project(':libLauncher')
|
||||
bundle 'org.ow2.asm:asm-commons:7.0'
|
||||
bundle 'org.ow2.asm:asm-util:7.0'
|
||||
bundle project(':Radon')
|
||||
bundle 'mysql:mysql-connector-java:8.0.13'
|
||||
bundle 'jline:jline:2.14.6'
|
||||
bundle 'net.sf.proguard:proguard-base:6.0.3'
|
||||
|
@ -70,6 +70,9 @@ pack project(':libLauncher')
|
|||
launch4jCJ('net.sf.launch4j:launch4j:3.12:workdir-linux') {
|
||||
exclude group: '*'
|
||||
}
|
||||
|
||||
compileOnlyA 'com.google.guava:guava:26.0-jre'
|
||||
compileOnlyA 'org.apache.logging.log4j:log4j-core:2.11.2'
|
||||
}
|
||||
|
||||
task hikari(type: Copy) {
|
||||
|
@ -104,7 +107,7 @@ task launch4jA(type: Copy) {
|
|||
} else {
|
||||
fcp.exclude()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task dumpLibs(type: Copy) {
|
||||
|
@ -113,13 +116,25 @@ task dumpLibs(type: Copy) {
|
|||
from configurations.bundleOnly
|
||||
}
|
||||
|
||||
task dumpCompileOnlyLibs(type: Copy) {
|
||||
into "$buildDir/libs/launcher-libraries-compile"
|
||||
from configurations.compileOnlyA
|
||||
}
|
||||
|
||||
task bundle(type: Zip) {
|
||||
dependsOn parent.childProjects.Launcher.tasks.build, tasks.dumpLibs, tasks.jar
|
||||
dependsOn parent.childProjects.Launcher.tasks.build, tasks.dumpLibs, tasks.dumpCompileOnlyLibs, tasks.jar
|
||||
archiveName 'LaunchServer.zip'
|
||||
destinationDir file("$buildDir")
|
||||
from(tasks.dumpLibs.destinationDir) { into 'libraries' }
|
||||
from(tasks.dumpCompileOnlyLibs.destinationDir) { into 'launcher-libraries-compile' }
|
||||
from tasks.jar.archivePath
|
||||
from(parent.childProjects.Launcher.tasks.dumpLibs) { into 'launcher-libraries' }
|
||||
}
|
||||
|
||||
build.dependsOn tasks.dumpLibs, tasks.bundle
|
||||
task dumpClientLibs(type: Copy) {
|
||||
dependsOn parent.childProjects.Launcher.tasks.build
|
||||
into "$buildDir/libs/launcher-libraries"
|
||||
from parent.childProjects.Launcher.tasks.dumpLibs.destinationDir
|
||||
}
|
||||
|
||||
build.dependsOn tasks.dumpLibs, tasks.dumpCompileOnlyLibs, tasks.dumpClientLibs, tasks.bundle
|
||||
|
|
|
@ -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;
|
||||
|
@ -277,7 +278,8 @@ public static void main(String... args) throws Throwable {
|
|||
// Start LaunchServer
|
||||
long startTime = System.currentTimeMillis();
|
||||
try {
|
||||
LaunchServer launchserver = new LaunchServer(IOHelper.WORKING_DIR, args);
|
||||
@SuppressWarnings("resource")
|
||||
LaunchServer launchserver = new LaunchServer(IOHelper.WORKING_DIR, args);
|
||||
if(args.length == 0) launchserver.run();
|
||||
else { //Обработка команды
|
||||
launchserver.commandHandler.eval(args,false);
|
||||
|
@ -296,6 +298,8 @@ public static void main(String... args) throws Throwable {
|
|||
|
||||
public final Path launcherLibraries;
|
||||
|
||||
public final Path launcherLibrariesCompile;
|
||||
|
||||
public final List<String> args;
|
||||
|
||||
public final Path configFile;
|
||||
|
@ -366,10 +370,7 @@ public LaunchServer(Path dir, String[] args) throws IOException, InvalidKeySpecE
|
|||
this.dir = dir;
|
||||
taskPool = new Timer("Timered task worker thread", true);
|
||||
launcherLibraries = dir.resolve("launcher-libraries");
|
||||
if (!Files.isDirectory(launcherLibraries)) {
|
||||
Files.deleteIfExists(launcherLibraries);
|
||||
Files.createDirectory(launcherLibraries);
|
||||
}
|
||||
launcherLibrariesCompile = dir.resolve("launcher-libraries-compile");
|
||||
this.args = Arrays.asList(args);
|
||||
configFile = dir.resolve("LaunchServer.conf");
|
||||
publicKeyFile = dir.resolve("public.key");
|
||||
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
@ -42,8 +44,9 @@ public void init() {
|
|||
tasks.add(new PrepareBuildTask(server));
|
||||
tasks.add(new MainBuildTask(server));
|
||||
tasks.add(new ProGuardBuildTask(server));
|
||||
tasks.add(new AttachJarsTask(server));
|
||||
tasks.add(new AdditionalFixesApplyTask(server));
|
||||
tasks.add(new RadonBuildTask(server));
|
||||
tasks.add(new AttachJarsTask(server));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
import ru.gravit.utils.helper.IOHelper;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
import ru.gravit.utils.helper.SecurityHelper;
|
||||
import ru.gravit.utils.helper.UnpackHelper;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
|
@ -13,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) {
|
||||
|
@ -50,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]);
|
||||
|
@ -58,9 +61,7 @@ public String[] buildConfig(Path inputJar, Path outputJar) {
|
|||
private void genConfig(boolean force) throws IOException {
|
||||
if (IOHelper.exists(config) && !force) return;
|
||||
Files.deleteIfExists(config);
|
||||
try (OutputStream out = IOHelper.newOutput(config); InputStream in = IOHelper.newInput(IOHelper.getResourceURL("ru/gravit/launchserver/defaults/proguard.cfg"))) {
|
||||
IOHelper.transfer(in, out);
|
||||
}
|
||||
UnpackHelper.unpack(IOHelper.getResourceURL("ru/gravit/launchserver/defaults/proguard.cfg"), config);
|
||||
}
|
||||
|
||||
public void genWords(boolean force) throws IOException {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -25,8 +25,8 @@ public String getName() {
|
|||
|
||||
@Override
|
||||
public Path process(Path inputFile) throws IOException {
|
||||
Path outputJar = server.launcherBinary.nextLowerPath(this);
|
||||
if (server.config.enabledProGuard) {
|
||||
Path outputJar = server.launcherBinary.nextLowerPath(this);
|
||||
Configuration proguard_cfg = new Configuration();
|
||||
ConfigurationParser parser = new ConfigurationParser(server.proguardConf.buildConfig(inputFile, outputJar),
|
||||
server.proguardConf.proguard.toFile(), System.getProperties());
|
||||
|
@ -37,12 +37,9 @@ public Path process(Path inputFile) throws IOException {
|
|||
} catch (ParseException e) {
|
||||
LogHelper.error(e);
|
||||
}
|
||||
return outputJar;
|
||||
} else {
|
||||
Path outputJar = server.launcherBinary.nextPath("non-obf");
|
||||
} else
|
||||
IOHelper.copy(inputFile, outputJar);
|
||||
return outputJar;
|
||||
}
|
||||
return outputJar;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package ru.gravit.launchserver.binary.tasks;
|
||||
|
||||
import ru.gravit.launchserver.LaunchServer;
|
||||
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;
|
||||
import me.itzsomebody.radon.SessionInfo;
|
||||
import me.itzsomebody.radon.config.ConfigurationParser;
|
||||
|
||||
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);
|
||||
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<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();
|
||||
} else
|
||||
IOHelper.copy(inputFile, outputFile);
|
||||
return outputFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowDelete() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
StringEncryption:
|
||||
Enabled: true
|
||||
Mode: Normal
|
||||
StringPool: false
|
||||
InvokeDynamic: None
|
||||
NumberObfuscation: Normal
|
||||
FlowObfuscation: Normal
|
||||
HideCode: false
|
||||
Shuffler: true
|
||||
Crasher: false
|
||||
Optimizer:
|
||||
Enabled: true
|
||||
InlineGotoGoto: true
|
||||
InlineGotoReturn: true
|
||||
RemoveNopInstructions: true
|
||||
Watermarker:
|
||||
Enabled: false
|
||||
Message: "This copy belongs to GravitLauncher"
|
||||
Key: "SuperSecureKey"
|
||||
Dictionary: Spaces
|
||||
TrashClasses: 500
|
|
@ -356,8 +356,6 @@ public static Process launch(
|
|||
context.args.add(JVMHelper.jvmProperty("os.name", "Windows 10"));
|
||||
context.args.add(JVMHelper.jvmProperty("os.version", "10.0"));
|
||||
}
|
||||
context.args.add(JVMHelper.systemToJvmProperty("avn32"));
|
||||
context.args.add(JVMHelper.systemToJvmProperty("avn64"));
|
||||
}
|
||||
// Add classpath and main class
|
||||
String pathLauncher = IOHelper.getCodeSource(ClientLauncher.class).toString();
|
||||
|
|
1
Radon
Submodule
1
Radon
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit e1f7548f97132fa29b01f68bd57ffab32de7b6e7
|
|
@ -1,10 +1,11 @@
|
|||
configure(subprojects.findAll {it.name != 'modules'}) {
|
||||
configure(subprojects.findAll { it.name != 'modules' && it.name != 'Radon' }) {
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'java'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'http://oss.sonatype.org/content/groups/public' }
|
||||
maven {
|
||||
url "http://clojars.org/repo/"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
rootProject.name = 'GravitLauncher'
|
||||
|
||||
include 'Launcher'
|
||||
include 'Radon'
|
||||
include 'libLauncher'
|
||||
include 'LauncherAPI'
|
||||
include 'ServerWrapper'
|
||||
|
|
Loading…
Reference in a new issue