Launcher/LaunchServer/src/main/java/pro/gravit/launchserver/binary/JARLauncherBinary.java

49 lines
1.8 KiB
Java
Raw Normal View History

package pro.gravit.launchserver.binary;
2018-09-17 10:07:32 +03:00
2019-10-19 19:46:04 +03:00
import pro.gravit.launcher.Launcher;
import pro.gravit.launchserver.LaunchServer;
import pro.gravit.launchserver.binary.tasks.*;
2018-09-17 10:07:32 +03:00
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
2018-12-02 15:21:27 +03:00
import java.util.ArrayList;
import java.util.List;
2019-01-08 16:36:05 +03:00
import java.util.concurrent.atomic.AtomicLong;
2018-09-17 10:07:32 +03:00
public final class JARLauncherBinary extends LauncherBinary {
2019-01-15 06:35:39 +03:00
public final AtomicLong count;
public final Path runtimeDir;
public final Path guardDir;
2019-01-08 16:36:05 +03:00
public final Path buildDir;
2019-10-19 19:43:25 +03:00
public final List<Path> coreLibs;
public final List<Path> addonLibs;
2019-01-15 06:35:39 +03:00
2018-12-20 18:45:01 +03:00
public JARLauncherBinary(LaunchServer server) throws IOException {
super(server, resolve(server, ".jar"), "Launcher-%s-%d.jar");
2019-01-08 16:36:05 +03:00
count = new AtomicLong(0);
runtimeDir = server.dir.resolve(Launcher.RUNTIME_DIR);
guardDir = server.dir.resolve(Launcher.GUARD_DIR);
2019-01-08 16:36:05 +03:00
buildDir = server.dir.resolve("build");
coreLibs = new ArrayList<>();
addonLibs = new ArrayList<>();
2019-01-09 11:29:54 +03:00
if (!Files.isDirectory(buildDir)) {
2019-01-15 06:35:39 +03:00
Files.deleteIfExists(buildDir);
Files.createDirectory(buildDir);
2019-01-09 11:29:54 +03:00
}
2019-01-08 16:57:01 +03:00
}
@Override
public void init() {
2019-01-09 11:29:54 +03:00
tasks.add(new PrepareBuildTask(server));
2020-04-05 10:27:04 +03:00
if (!server.config.sign.enabled) tasks.add(new CertificateAutogenTask(server));
2019-01-08 16:41:13 +03:00
tasks.add(new MainBuildTask(server));
2019-05-31 01:40:19 +03:00
if (server.config.launcher.attachLibraryBeforeProGuard) tasks.add(new AttachJarsTask(server));
tasks.add(new ProGuardBuildTask(server));
2019-03-15 20:04:26 +03:00
tasks.add(new AdditionalFixesApplyTask(server));
2019-05-31 01:40:19 +03:00
if (!server.config.launcher.attachLibraryBeforeProGuard) tasks.add(new AttachJarsTask(server));
2019-10-19 19:46:04 +03:00
if (server.config.launcher.compress) tasks.add(new CompressBuildTask(server));
tasks.add(new SignJarTask(server.config.sign, server));
2018-12-20 18:45:01 +03:00
}
2018-09-17 10:07:32 +03:00
}