[FEATURE] Откат изменений Захара, конфигурирование лаунчерных модулей

This commit is contained in:
Gravit 2020-02-25 13:38:11 +07:00
parent 308cc48d4c
commit 3f307d7b20
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
15 changed files with 58 additions and 53 deletions

View file

@ -8,7 +8,7 @@
url "https://oss.sonatype.org/content/repositories/snapshots" url "https://oss.sonatype.org/content/repositories/snapshots"
} }
maven { maven {
url "https://maven.geomajas.org/" url "http://maven.geomajas.org/"
} }
} }
@ -24,11 +24,10 @@
launch4j launch4j
launch4jCJ launch4jCJ
bundleOnly.extendsFrom bundle bundleOnly.extendsFrom bundle
compile.extendsFrom bundle, hikari, pack, launch4j compile.extendsFrom bundle, hikari, pack, launch4jCJ, launch4j
} }
jar { jar {
duplicatesStrategy = 'INCLUDE'
dependsOn parent.childProjects.Launcher.tasks.build dependsOn parent.childProjects.Launcher.tasks.build
from { configurations.pack.collect { it.isDirectory() ? it : zipTree(it) } } from { configurations.pack.collect { it.isDirectory() ? it : zipTree(it) } }
from(parent.childProjects.Launcher.tasks.shadowJar.archivePath) from(parent.childProjects.Launcher.tasks.shadowJar.archivePath)
@ -115,7 +114,7 @@ pack project(':LauncherAPI')
compileOnlyA 'com.google.guava:guava:26.0-jre' compileOnlyA 'com.google.guava:guava:26.0-jre'
compileOnlyA 'log4j:log4j:1.2.17' // Do not update (laggy dep). compileOnlyA 'log4j:log4j:1.2.17' // Do not update (laggy dep).
compileOnlyA 'org.apache.logging.log4j:log4j-core:2.11.2' compileOnlyA 'org.apache.logging.log4j:log4j-core:2.11.2'
testImplementation 'org.junit.jupiter:junit-jupiter:5.4.1' testCompile 'org.junit.jupiter:junit-jupiter:5.4.1'
} }
task hikari(type: Copy) { task hikari(type: Copy) {
@ -126,7 +125,6 @@ task hikari(type: Copy) {
task launch4jM(type: Copy) { task launch4jM(type: Copy) {
into "$buildDir/libs/libraries/launch4j" into "$buildDir/libs/libraries/launch4j"
from(configurations.launch4jCJ.collect { it.isDirectory() ? it : zipTree(it) }) from(configurations.launch4jCJ.collect { it.isDirectory() ? it : zipTree(it) })
duplicatesStrategy = 'INCLUDE'
includeEmptyDirs false includeEmptyDirs false
eachFile { FileCopyDetails fcp -> eachFile { FileCopyDetails fcp ->
if (fcp.relativePath.pathString.startsWith("launch4j-")) { if (fcp.relativePath.pathString.startsWith("launch4j-")) {
@ -165,8 +163,8 @@ task dumpCompileOnlyLibs(type: Copy) {
task bundle(type: Zip) { task bundle(type: Zip) {
dependsOn parent.childProjects.Launcher.tasks.build, tasks.dumpLibs, tasks.dumpCompileOnlyLibs, tasks.jar dependsOn parent.childProjects.Launcher.tasks.build, tasks.dumpLibs, tasks.dumpCompileOnlyLibs, tasks.jar
archiveFileName = 'LaunchServer.zip' archiveName 'LaunchServer.zip'
destinationDirectory = file("$buildDir") destinationDir file("$buildDir")
from(tasks.dumpLibs.destinationDir) { into 'libraries' } from(tasks.dumpLibs.destinationDir) { into 'libraries' }
from(tasks.dumpCompileOnlyLibs.destinationDir) { into 'launcher-libraries-compile' } from(tasks.dumpCompileOnlyLibs.destinationDir) { into 'launcher-libraries-compile' }
from tasks.jar.archivePath from tasks.jar.archivePath

View file

@ -18,7 +18,6 @@
import pro.gravit.launchserver.manangers.LaunchServerGsonManager; import pro.gravit.launchserver.manangers.LaunchServerGsonManager;
import pro.gravit.launchserver.modules.impl.LaunchServerModulesManager; import pro.gravit.launchserver.modules.impl.LaunchServerModulesManager;
import pro.gravit.launchserver.socket.WebSocketService; import pro.gravit.launchserver.socket.WebSocketService;
import pro.gravit.utils.Version;
import pro.gravit.utils.command.CommandHandler; import pro.gravit.utils.command.CommandHandler;
import pro.gravit.utils.command.JLineCommandHandler; import pro.gravit.utils.command.JLineCommandHandler;
import pro.gravit.utils.command.StdCommandHandler; import pro.gravit.utils.command.StdCommandHandler;

View file

@ -5,7 +5,6 @@
import org.objectweb.asm.Type; import org.objectweb.asm.Type;
import org.objectweb.asm.tree.*; import org.objectweb.asm.tree.*;
import pro.gravit.utils.helper.IOHelper; import pro.gravit.utils.helper.IOHelper;
import pro.gravit.utils.helper.JVMHelper;
import pro.gravit.utils.helper.JarHelper; import pro.gravit.utils.helper.JarHelper;
import java.io.IOException; import java.io.IOException;

View file

@ -1,7 +1,6 @@
package pro.gravit.launchserver.binary; package pro.gravit.launchserver.binary;
import pro.gravit.launchserver.LaunchServer; import pro.gravit.launchserver.LaunchServer;
import pro.gravit.launchserver.asm.NodeUtils;
import pro.gravit.utils.helper.*; import pro.gravit.utils.helper.*;
import java.io.IOException; import java.io.IOException;

View file

@ -45,8 +45,8 @@ public boolean allowDelete() {
public void tryUnpack() throws IOException { public void tryUnpack() throws IOException {
LogHelper.info("Unpacking launcher native guard list and runtime"); LogHelper.info("Unpacking launcher native guard list and runtime");
UnpackHelper.unpackZipNoCheck("guard.zip", server.launcherBinary.guardDir);
UnpackHelper.unpackZipNoCheck("runtime.zip", server.launcherBinary.runtimeDir); UnpackHelper.unpackZipNoCheck("runtime.zip", server.launcherBinary.runtimeDir);
IOHelper.keepDir(server.launcherBinary.guardDir);
} }
private static final class ListFileVisitor extends SimpleFileVisitor<Path> { private static final class ListFileVisitor extends SimpleFileVisitor<Path> {

View file

@ -2,7 +2,6 @@
import pro.gravit.launcher.NeedGarbageCollection; import pro.gravit.launcher.NeedGarbageCollection;
import pro.gravit.launchserver.socket.Client; import pro.gravit.launchserver.socket.Client;
import pro.gravit.launchserver.socket.response.auth.AuthResponse;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;

View file

@ -1,4 +1,6 @@
apply plugin: 'org.openjfx.javafxplugin' plugins {
id 'org.openjfx.javafxplugin' version '0.0.5'
}
apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'com.github.johnrengelman.shadow'
String mainClassName = "pro.gravit.launcher.ClientLauncherWrapper" String mainClassName = "pro.gravit.launcher.ClientLauncherWrapper"
@ -6,7 +8,7 @@
repositories { repositories {
maven { maven {
url "https://repo.spring.io/plugins-release/" url "http://repo.spring.io/plugins-release/"
} }
} }
javafx { javafx {
@ -19,7 +21,7 @@
configurations { configurations {
bundle bundle
pack pack
api.extendsFrom bundle, pack compile.extendsFrom bundle, pack
} }
jar { jar {
@ -57,16 +59,17 @@ pack project(':LauncherAPI')
pack 'org.ow2.asm:asm-tree:7.1' pack 'org.ow2.asm:asm-tree:7.1'
} }
task genRuntimeJS(type: Zip) {
archiveName = "runtime.zip"
destinationDir = file("${buildDir}/tmp")
from "runtime/"
}
task dumpLibs(type: Copy) { task dumpLibs(type: Copy) {
into "$buildDir/libs/libraries" into "$buildDir/libs/libraries"
from configurations.bundle from configurations.bundle
} }
task genRuntimeJS(type: Zip) {
archiveFileName = "runtime.zip"
destinationDirectory = file("${buildDir}/tmp")
from "runtime/"
}
assemble.dependsOn tasks.genRuntimeJS, tasks.dumpLibs, tasks.shadowJar assemble.dependsOn tasks.genRuntimeJS, tasks.dumpLibs, tasks.shadowJar

View file

@ -2,9 +2,9 @@
targetCompatibility = '1.8' targetCompatibility = '1.8'
dependencies { dependencies {
api project(':LauncherCore') compile project(':LauncherCore')
implementation 'io.netty:netty-codec-http:4.1.43.Final' compileOnly 'io.netty:netty-codec-http:4.1.43.Final'
testImplementation 'org.junit.jupiter:junit-jupiter:5.4.1' testCompile 'org.junit.jupiter:junit-jupiter:5.4.1'
} }
test { test {

View file

@ -2,7 +2,7 @@
targetCompatibility = '1.8' targetCompatibility = '1.8'
dependencies { dependencies {
api project(':LauncherAPI') compile project(':LauncherAPI')
implementation 'com.google.guava:guava:26.0-jre' compileOnly 'com.google.guava:guava:26.0-jre'
api files('../compat/authlib/authlib-clean.jar') compile files('../compat/authlib/authlib-clean.jar')
} }

View file

@ -1,15 +1,15 @@
apply plugin: 'java' apply plugin: 'java-library'
sourceCompatibility = '1.8' sourceCompatibility = '1.8'
targetCompatibility = '1.8' targetCompatibility = '1.8'
dependencies { dependencies {
api 'org.fusesource.jansi:jansi:1.18' compileOnly 'org.fusesource.jansi:jansi:1.18'
api 'org.jline:jline:3.11.0' compileOnly 'org.jline:jline:3.11.0'
api 'org.jline:jline-reader:3.11.0' compileOnly 'org.jline:jline-reader:3.11.0'
api 'org.jline:jline-terminal:3.11.0' compileOnly 'org.jline:jline-terminal:3.11.0'
api 'org.bouncycastle:bcprov-jdk15:1.46' compileOnly 'org.bouncycastle:bcprov-jdk15:1.46'
api 'com.google.code.gson:gson:2.8.5' compile 'com.google.code.gson:gson:2.8.5'
testImplementation 'org.junit.jupiter:junit-jupiter:5.4.1' testCompile 'org.junit.jupiter:junit-jupiter:5.4.1'
} }
test { test {

View file

@ -733,11 +733,4 @@ public static void write(Path file, byte[] bytes) throws IOException {
private IOHelper() { private IOHelper() {
} }
public static void keepDir(Path dir) throws IOException {
if (Files.isDirectory(dir))
return;
Files.deleteIfExists(dir);
Files.createDirectory(dir);
}
} }

View file

@ -1,5 +1,6 @@
package pro.gravit.utils.helper; package pro.gravit.utils.helper;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Path; import java.nio.file.Path;
@ -100,6 +101,21 @@ public static InputStream getClassBytesStream(Class<?> clazz, ClassLoader classL
{ {
return classLoader.getResourceAsStream(getClassFile(clazz)); return classLoader.getResourceAsStream(getClassFile(clazz));
} }
public static byte[] getClassFromJar(String name, Path file) throws IOException
{
String filename = getClassFile(name);
try(ZipInputStream inputStream = IOHelper.newZipInput(file))
{
ZipEntry entry = inputStream.getNextEntry();
while(entry != null)
{
if(entry.getName().equals(filename))
{
return IOHelper.read(inputStream);
}
entry = inputStream.getNextEntry();
}
}
throw new FileNotFoundException(filename);
}
} }

View file

@ -5,12 +5,12 @@
configurations { configurations {
pack pack
api.extendsFrom pack compile.extendsFrom pack
} }
repositories { repositories {
maven { maven {
url "https://repo.spring.io/plugins-release/" url "http://repo.spring.io/plugins-release/"
} }
} }

View file

@ -1,8 +1,7 @@
plugins { plugins {
id 'com.github.johnrengelman.shadow' version '5.2.0' apply false id 'com.github.johnrengelman.shadow' version '5.0.0' apply false
id 'maven-publish' id 'maven-publish'
id 'signing' id 'signing'
id 'org.openjfx.javafxplugin' version '0.0.8' apply false
} }
group = 'pro.gravit.launcher' group = 'pro.gravit.launcher'
version = '5.1.1-SNAPSHOT' version = '5.1.1-SNAPSHOT'
@ -10,15 +9,15 @@
configure(subprojects.findAll { it.name != 'modules' }) { configure(subprojects.findAll { it.name != 'modules' }) {
apply plugin: 'idea' apply plugin: 'idea'
apply plugin: 'eclipse' apply plugin: 'eclipse'
apply plugin: 'java-library' apply plugin: 'java'
group = 'pro.gravit' group = 'pro.gravit'
repositories { repositories {
mavenCentral() mavenCentral()
maven { url 'https://oss.sonatype.org/content/groups/public' } maven { url 'http://oss.sonatype.org/content/groups/public' }
maven { maven {
url "https://clojars.org/repo/" url "http://clojars.org/repo/"
} }
} }
@ -27,8 +26,8 @@
aptCompileOnly aptCompileOnly
aptOnly aptOnly
aptOnly.extendsFrom apt, aptCompileOnly aptOnly.extendsFrom apt, aptCompileOnly
api.extendsFrom apt compile.extendsFrom apt
implementation.extendsFrom aptCompileOnly compileOnly.extendsFrom aptCompileOnly
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {

@ -1 +1 @@
Subproject commit a330c4d3004f7318cb7ccb494acdc157a55f0ce4 Subproject commit 22d2aaf0eec34ec55fc6ad17c87a165d8a82c6db