mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
Gradle build change.
This commit is contained in:
parent
de22bd3d33
commit
59063daed3
12 changed files with 72 additions and 58 deletions
|
@ -23,7 +23,7 @@
|
|||
}
|
||||
|
||||
jar {
|
||||
dependsOn parent.childProjects.Launcher.tasks.build, parent.childProjects.Launcher.tasks.genRuntimeJS, parent.childProjects.Launcher.tasks.jar
|
||||
dependsOn parent.childProjects.Launcher.tasks.build
|
||||
from { configurations.pack.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
from(parent.childProjects.Launcher.tasks.jar.archivePath, parent.childProjects.Launcher.tasks.genRuntimeJS.archivePath)
|
||||
manifest.attributes("Main-Class": mainClassName,
|
||||
|
@ -60,8 +60,6 @@ pack project(':libLauncher') // pack
|
|||
compileOnly('net.sf.launch4j:launch4j:3.12') { // need user
|
||||
exclude group: '*'
|
||||
}
|
||||
|
||||
//compile 'org.mozilla:rhino:1.7.10' will be module
|
||||
}
|
||||
|
||||
task hikari(type: Copy) {
|
||||
|
@ -75,4 +73,10 @@ task dumpLibs(type: Copy) {
|
|||
from configurations.bundleOnly
|
||||
}
|
||||
|
||||
build.dependsOn tasks.dumpLibs
|
||||
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.dumpClientLibs
|
||||
|
|
|
@ -330,7 +330,10 @@ public static void main(String... args) throws Throwable {
|
|||
public LaunchServer(Path dir, String[] args) throws IOException, InvalidKeySpecException {
|
||||
this.dir = dir;
|
||||
launcherLibraries = dir.resolve("launcher-libraries");
|
||||
if (!Files.isDirectory(launcherLibraries)) Files.createDirectory(launcherLibraries);
|
||||
if (!Files.isDirectory(launcherLibraries)) {
|
||||
Files.deleteIfExists(launcherLibraries);
|
||||
Files.createDirectory(launcherLibraries);
|
||||
}
|
||||
this.args = Arrays.asList(args);
|
||||
configFile = dir.resolve("LaunchServer.conf");
|
||||
publicKeyFile = dir.resolve("public.key");
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
import java.util.Collections;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
public class StarterAgent {
|
||||
public final class StarterAgent {
|
||||
|
||||
public static final class StarterVisitor extends SimpleFileVisitor<Path> {
|
||||
private static final class StarterVisitor extends SimpleFileVisitor<Path> {
|
||||
private final Instrumentation inst;
|
||||
|
||||
private StarterVisitor(Instrumentation inst) {
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
package ru.gravit.launchserver.binary;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
@ -17,27 +14,12 @@
|
|||
import ru.gravit.launchserver.binary.tasks.MainBuildTask;
|
||||
import ru.gravit.launchserver.binary.tasks.ProGuardBuildTask;
|
||||
import ru.gravit.launchserver.binary.tasks.AdditionalFixesApplyTask;
|
||||
import ru.gravit.launchserver.binary.tasks.UnpackBuildTask;
|
||||
import ru.gravit.launchserver.binary.tasks.PrepareBuildTask;
|
||||
import ru.gravit.utils.helper.CommonHelper;
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
|
||||
public final class JARLauncherBinary extends LauncherBinary {
|
||||
private static final class ListFileVisitor extends SimpleFileVisitor<Path> {
|
||||
private final List<Path> lst;
|
||||
|
||||
private ListFileVisitor(List<Path> lst) {
|
||||
this.lst = lst;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||
if (file.toFile().getName().endsWith(".jar"))
|
||||
lst.add(file);
|
||||
return super.visitFile(file, attrs);
|
||||
}
|
||||
}
|
||||
|
||||
public final AtomicLong count;
|
||||
public final Path runtimeDir;
|
||||
public final Path guardDir;
|
||||
|
@ -54,12 +36,15 @@ public JARLauncherBinary(LaunchServer server) throws IOException {
|
|||
buildDir = server.dir.resolve("build");
|
||||
tasks = new ArrayList<>();
|
||||
coreLibs = new ArrayList<>();
|
||||
if (!Files.isDirectory(buildDir)) {
|
||||
Files.deleteIfExists(buildDir);
|
||||
Files.createDirectory(buildDir);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
tasks.add(new UnpackBuildTask(server));
|
||||
tasks.add(new PrepareBuildTask(server));
|
||||
tasks.add(new MainBuildTask(server));
|
||||
tasks.add(new ProGuardBuildTask(server));
|
||||
tasks.add(new AttachJarsTask(server));
|
||||
|
@ -69,9 +54,7 @@ public void init() {
|
|||
@Override
|
||||
public void build() throws IOException {
|
||||
LogHelper.info("Building launcher binary file");
|
||||
count.set(0);
|
||||
coreLibs.clear();
|
||||
IOHelper.walk(server.launcherLibraries, new ListFileVisitor(coreLibs), true);
|
||||
count.set(0); // set jar number
|
||||
Path thisPath = null;
|
||||
boolean isNeedDelete = false;
|
||||
long time_start = System.currentTimeMillis();
|
||||
|
|
|
@ -6,13 +6,18 @@
|
|||
import ru.gravit.utils.helper.UnpackHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.List;
|
||||
|
||||
public class UnpackBuildTask implements LauncherBuildTask {
|
||||
public class PrepareBuildTask implements LauncherBuildTask {
|
||||
private final LaunchServer server;
|
||||
private final Path result;
|
||||
|
||||
public UnpackBuildTask(LaunchServer server) {
|
||||
public PrepareBuildTask(LaunchServer server) {
|
||||
this.server = server;
|
||||
result = server.launcherBinary.buildDir.resolve(server.config.binaryName + "-clean.jar");
|
||||
}
|
||||
|
@ -24,6 +29,8 @@ public String getName() {
|
|||
|
||||
@Override
|
||||
public Path process(Path inputFile) throws IOException {
|
||||
server.launcherBinary.coreLibs.clear();
|
||||
IOHelper.walk(server.launcherLibraries, new ListFileVisitor(server.launcherBinary.coreLibs), true);
|
||||
UnpackHelper.unpack(IOHelper.getResourceURL("Launcher.jar"), result);
|
||||
tryUnpack();
|
||||
return result;
|
||||
|
@ -39,4 +46,19 @@ public void tryUnpack() throws IOException {
|
|||
UnpackHelper.unpackZipNoCheck("guard.zip", server.launcherBinary.guardDir);
|
||||
UnpackHelper.unpackZipNoCheck("runtime.zip", server.launcherBinary.runtimeDir);
|
||||
}
|
||||
|
||||
private static final class ListFileVisitor extends SimpleFileVisitor<Path> {
|
||||
private final List<Path> lst;
|
||||
|
||||
private ListFileVisitor(List<Path> lst) {
|
||||
this.lst = lst;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||
if (!Files.isDirectory(file) && file.toFile().getName().endsWith(".jar"))
|
||||
lst.add(file);
|
||||
return super.visitFile(file, attrs);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
String mainClassName = "ru.gravit.launcher.ClientLauncherWrapper"
|
||||
String mainAgentName = "ru.gravit.launcher.LauncherAgent"
|
||||
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
url "http://repo.spring.io/plugins-release/"
|
||||
|
@ -12,7 +11,6 @@
|
|||
targetCompatibility = '1.8'
|
||||
|
||||
jar {
|
||||
from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
manifest.attributes("Main-Class": mainClassName,
|
||||
"Premain-Class": mainAgentName,
|
||||
"Can-Redefine-Classes": "true",
|
||||
|
@ -31,4 +29,10 @@ task genRuntimeJS(type: Zip) {
|
|||
from "runtime/"
|
||||
}
|
||||
|
||||
build.dependsOn tasks.genRuntimeJS
|
||||
task dumpLibs(type: Copy) {
|
||||
into "$buildDir/libs/libraries"
|
||||
from configurations.runtime
|
||||
}
|
||||
|
||||
|
||||
build.dependsOn tasks.genRuntimeJS, tasks.dumpLibs
|
||||
|
|
|
@ -22,5 +22,4 @@
|
|||
|
||||
dependencies {
|
||||
compile project(':LauncherAPI')
|
||||
compile 'org.javassist:javassist:3.23.1-GA'
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.gravit.launcher.server;
|
||||
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import ru.gravit.launcher.ClientPermissions;
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
allprojects {
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'idea'
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'java'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
@ -8,10 +12,6 @@
|
|||
url "http://clojars.org/repo/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'java'
|
||||
|
||||
configurations {
|
||||
apt
|
||||
|
|
2
modules
2
modules
|
@ -1 +1 @@
|
|||
Subproject commit f87bdf0e1eeed4ca097e4ab90b99b0639aa4b52a
|
||||
Subproject commit 5e37ef4d9a6d001e70b4ea5c3cd837e30b692d51
|
Loading…
Reference in a new issue