2019-06-02 05:03:08 +03:00
|
|
|
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;
|
2019-01-05 18:28:25 +03:00
|
|
|
import java.nio.file.Files;
|
2018-12-06 05:29:34 +03:00
|
|
|
import java.nio.file.Path;
|
2018-12-02 15:21:27 +03:00
|
|
|
import java.util.ArrayList;
|
2019-01-08 18:29:24 +03:00
|
|
|
import java.util.List;
|
2019-01-08 16:36:05 +03:00
|
|
|
import java.util.concurrent.atomic.AtomicLong;
|
2019-01-07 08:01:15 +03:00
|
|
|
|
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;
|
2019-01-07 08:01:15 +03:00
|
|
|
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 {
|
2019-10-27 19:51:48 +03:00
|
|
|
super(server, resolve(server, ".jar"), "Launcher-%s-%d.jar");
|
2019-01-08 16:36:05 +03:00
|
|
|
count = new AtomicLong(0);
|
2019-01-07 08:01:15 +03:00
|
|
|
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");
|
2019-01-08 18:29:24 +03:00
|
|
|
coreLibs = new ArrayList<>();
|
2019-03-15 17:40:48 +03:00
|
|
|
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));
|
2019-10-27 18:33:52 +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));
|
2019-01-08 18:29:24 +03:00
|
|
|
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));
|
2019-10-27 17:47:55 +03:00
|
|
|
tasks.add(new SignJarTask(server.config.sign, server));
|
2018-12-20 18:45:01 +03:00
|
|
|
}
|
2018-09-17 10:07:32 +03:00
|
|
|
}
|