mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-05-05 08:36:35 +03:00
Merge branch 'release/5.6.12'
This commit is contained in:
commit
7c15742478
18 changed files with 151 additions and 24 deletions
2
.github/workflows/push.yml
vendored
2
.github/workflows/push.yml
vendored
|
@ -42,6 +42,8 @@ jobs:
|
||||||
cp LauncherAuthlib/build/libs/LauncherAuthlib.jar artifacts/LauncherAuthlib.jar || true
|
cp LauncherAuthlib/build/libs/LauncherAuthlib.jar artifacts/LauncherAuthlib.jar || true
|
||||||
cp modules/*_module/build/libs/*.jar artifacts/modules || true
|
cp modules/*_module/build/libs/*.jar artifacts/modules || true
|
||||||
cp modules/*_lmodule/build/libs/*.jar artifacts/modules || true
|
cp modules/*_lmodule/build/libs/*.jar artifacts/modules || true
|
||||||
|
cp javaargs.txt artifacts/javaargs.txt || true
|
||||||
|
cp java24args.txt artifacts/java24args.txt || true
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
bundleOnly
|
bundleOnly
|
||||||
bundle
|
bundle
|
||||||
pack
|
pack
|
||||||
|
proguardPack
|
||||||
bundleOnly.extendsFrom bundle
|
bundleOnly.extendsFrom bundle
|
||||||
api.extendsFrom bundle, pack
|
api.extendsFrom bundle, pack
|
||||||
}
|
}
|
||||||
|
@ -36,11 +37,13 @@
|
||||||
jar {
|
jar {
|
||||||
dependsOn parent.childProjects.Launcher.tasks.assemble
|
dependsOn parent.childProjects.Launcher.tasks.assemble
|
||||||
from { configurations.pack.collect { it.isDirectory() ? it : zipTree(it) } }
|
from { configurations.pack.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||||
|
exclude("module-info.class")
|
||||||
from(parent.childProjects.Launcher.tasks.shadowJar)
|
from(parent.childProjects.Launcher.tasks.shadowJar)
|
||||||
from(parent.childProjects.Launcher.tasks.genRuntimeJS)
|
from(parent.childProjects.Launcher.tasks.genRuntimeJS)
|
||||||
manifest.attributes("Main-Class": mainClassName,
|
manifest.attributes("Main-Class": mainClassName,
|
||||||
"Premain-Class": mainAgentName,
|
"Premain-Class": mainAgentName,
|
||||||
"Multi-Release": "true",
|
"Multi-Release": "true",
|
||||||
|
"Automatic-Module-Name": "launchserver"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,22 +75,25 @@
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
pack project(':LauncherAPI')
|
pack(project(':LauncherAPI')) {
|
||||||
|
exclude group: "com.google.code.gson"
|
||||||
|
}
|
||||||
|
bundle group: 'com.google.code.gson', name: 'gson', version: rootProject['verGson']
|
||||||
bundle group: 'me.tongfei', name: 'progressbar', version: '0.10.1'
|
bundle group: 'me.tongfei', name: 'progressbar', version: '0.10.1'
|
||||||
bundle group: 'org.fusesource.jansi', name: 'jansi', version: rootProject['verJansi']
|
bundle group: 'org.fusesource.jansi', name: 'jansi', version: rootProject['verJansi']
|
||||||
bundle group: 'org.jline', name: 'jline', version: rootProject['verJline']
|
bundle group: 'org.jline', name: 'jline-native', version: rootProject['verJline']
|
||||||
bundle group: 'org.jline', name: 'jline-reader', version: rootProject['verJline']
|
bundle group: 'org.jline', name: 'jline-reader', version: rootProject['verJline']
|
||||||
bundle group: 'org.jline', name: 'jline-terminal', version: rootProject['verJline']
|
bundle group: 'org.jline', name: 'jline-terminal-ffm', version: rootProject['verJline']
|
||||||
bundle group: 'org.bouncycastle', name: 'bcprov-jdk18on', version: rootProject['verBcpkix']
|
bundle group: 'org.bouncycastle', name: 'bcprov-jdk18on', version: rootProject['verBcpkix']
|
||||||
bundle group: 'org.bouncycastle', name: 'bcpkix-jdk18on', version: rootProject['verBcpkix']
|
bundle group: 'org.bouncycastle', name: 'bcpkix-jdk18on', version: rootProject['verBcpkix']
|
||||||
bundle group: 'org.ow2.asm', name: 'asm-commons', version: rootProject['verAsm']
|
bundle group: 'org.ow2.asm', name: 'asm-commons', version: rootProject['verAsm']
|
||||||
bundle group: 'io.netty', name: 'netty-codec-http', version: rootProject['verNetty']
|
bundle group: 'io.netty', name: 'netty-codec-http', version: rootProject['verNetty']
|
||||||
bundle group: 'io.netty', name: 'netty-transport-classes-epoll', version: rootProject['verNetty']
|
bundle group: 'io.netty', name: 'netty-transport-classes-epoll', version: rootProject['verNetty']
|
||||||
bundle group: 'io.netty', name: 'netty-transport-native-epoll', version: rootProject['verNetty'], classifier: 'linux-x86_64'
|
bundle group: 'io.netty', name: 'netty-transport-native-epoll', version: rootProject['verNetty'], classifier: 'linux-x86_64'
|
||||||
bundle group: 'io.netty', name: 'netty-transport-native-epoll', version: rootProject['verNetty'], classifier: 'linux-aarch_64'
|
//bundle group: 'io.netty', name: 'netty-transport-native-epoll', version: rootProject['verNetty'], classifier: 'linux-aarch_64'
|
||||||
bundle group: 'io.netty', name: 'netty-transport-classes-io_uring', version: rootProject['verNetty']
|
bundle group: 'io.netty', name: 'netty-transport-classes-io_uring', version: rootProject['verNetty']
|
||||||
bundle group: 'io.netty', name: 'netty-transport-native-io_uring', version: rootProject['verNetty'], classifier: 'linux-x86_64'
|
bundle group: 'io.netty', name: 'netty-transport-native-io_uring', version: rootProject['verNetty'], classifier: 'linux-x86_64'
|
||||||
bundle group: 'io.netty', name: 'netty-transport-native-io_uring', version: rootProject['verNetty'], classifier: 'linux-aarch_64'
|
//bundle group: 'io.netty', name: 'netty-transport-native-io_uring', version: rootProject['verNetty'], classifier: 'linux-aarch_64'
|
||||||
// Netty
|
// Netty
|
||||||
bundle 'org.jboss.marshalling:jboss-marshalling:1.4.11.Final'
|
bundle 'org.jboss.marshalling:jboss-marshalling:1.4.11.Final'
|
||||||
bundle 'com.google.protobuf.nano:protobuf-javanano:3.1.0'
|
bundle 'com.google.protobuf.nano:protobuf-javanano:3.1.0'
|
||||||
|
@ -97,7 +103,7 @@ pack project(':LauncherAPI')
|
||||||
bundle group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: rootProject['verMariaDBConn']
|
bundle group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: rootProject['verMariaDBConn']
|
||||||
bundle group: 'org.postgresql', name: 'postgresql', version: rootProject['verPostgreSQLConn']
|
bundle group: 'org.postgresql', name: 'postgresql', version: rootProject['verPostgreSQLConn']
|
||||||
bundle group: 'com.h2database', name: 'h2', version: rootProject['verH2Conn']
|
bundle group: 'com.h2database', name: 'h2', version: rootProject['verH2Conn']
|
||||||
bundle group: 'com.guardsquare', name: 'proguard-base', version: rootProject['verProguard']
|
proguardPack group: 'com.guardsquare', name: 'proguard-base', version: rootProject['verProguard']
|
||||||
bundle group: 'org.apache.logging.log4j', name: 'log4j-core', version: rootProject['verLog4j']
|
bundle group: 'org.apache.logging.log4j', name: 'log4j-core', version: rootProject['verLog4j']
|
||||||
bundle group: 'org.apache.logging.log4j', name: 'log4j-slf4j2-impl', version: rootProject['verLog4j']
|
bundle group: 'org.apache.logging.log4j', name: 'log4j-slf4j2-impl', version: rootProject['verLog4j']
|
||||||
bundle group: 'io.jsonwebtoken', name: 'jjwt-api', version: rootProject['verJwt']
|
bundle group: 'io.jsonwebtoken', name: 'jjwt-api', version: rootProject['verJwt']
|
||||||
|
@ -121,6 +127,12 @@ pack project(':LauncherAPI')
|
||||||
from configurations.bundleOnly
|
from configurations.bundleOnly
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.register('dumpProguard', Copy) {
|
||||||
|
duplicatesStrategy = 'EXCLUDE'
|
||||||
|
into "$buildDir/libs/proguard"
|
||||||
|
from configurations.proguardPack
|
||||||
|
}
|
||||||
|
|
||||||
tasks.register('bundle', Zip) {
|
tasks.register('bundle', Zip) {
|
||||||
duplicatesStrategy = 'EXCLUDE'
|
duplicatesStrategy = 'EXCLUDE'
|
||||||
dependsOn parent.childProjects.Launcher.tasks.build, tasks.dumpLibs, tasks.jar
|
dependsOn parent.childProjects.Launcher.tasks.build, tasks.dumpLibs, tasks.jar
|
||||||
|
@ -137,7 +149,7 @@ pack project(':LauncherAPI')
|
||||||
from parent.childProjects.Launcher.tasks.dumpLibs
|
from parent.childProjects.Launcher.tasks.dumpLibs
|
||||||
}
|
}
|
||||||
|
|
||||||
assemble.dependsOn tasks.dumpLibs, tasks.dumpClientLibs, tasks.bundle, tasks.cleanjar
|
assemble.dependsOn tasks.dumpLibs, tasks.dumpClientLibs, tasks.bundle, tasks.cleanjar, tasks.dumpProguard
|
||||||
|
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
|
|
|
@ -82,6 +82,7 @@ public final class LaunchServer implements Runnable, AutoCloseable, Reconfigurab
|
||||||
public final Path launcherModulesDir;
|
public final Path launcherModulesDir;
|
||||||
public final Path librariesDir;
|
public final Path librariesDir;
|
||||||
public final Path controlFile;
|
public final Path controlFile;
|
||||||
|
public final Path proguardDir;
|
||||||
/**
|
/**
|
||||||
* This object contains runtime configuration
|
* This object contains runtime configuration
|
||||||
*/
|
*/
|
||||||
|
@ -138,6 +139,7 @@ public LaunchServer(LaunchServerDirectories directories, LaunchServerEnv env, La
|
||||||
launcherModulesDir = directories.launcherModules;
|
launcherModulesDir = directories.launcherModules;
|
||||||
librariesDir = directories.librariesDir;
|
librariesDir = directories.librariesDir;
|
||||||
controlFile = directories.controlFile;
|
controlFile = directories.controlFile;
|
||||||
|
proguardDir = directories.proguardDir;
|
||||||
this.shardId = shardId;
|
this.shardId = shardId;
|
||||||
if(!Files.isDirectory(launcherPack)) {
|
if(!Files.isDirectory(launcherPack)) {
|
||||||
Files.createDirectories(launcherPack);
|
Files.createDirectories(launcherPack);
|
||||||
|
@ -462,13 +464,16 @@ public interface LaunchServerConfigManager {
|
||||||
public static class LaunchServerDirectories {
|
public static class LaunchServerDirectories {
|
||||||
public static final String UPDATES_NAME = "updates",
|
public static final String UPDATES_NAME = "updates",
|
||||||
TRUSTSTORE_NAME = "truststore", LAUNCHERLIBRARIES_NAME = "launcher-libraries",
|
TRUSTSTORE_NAME = "truststore", LAUNCHERLIBRARIES_NAME = "launcher-libraries",
|
||||||
LAUNCHERLIBRARIESCOMPILE_NAME = "launcher-libraries-compile", LAUNCHERPACK_NAME = "launcher-pack", KEY_NAME = ".keys", MODULES = "modules", LAUNCHER_MODULES = "launcher-modules", LIBRARIES = "libraries", CONTROL_FILE = "control-file";
|
LAUNCHERLIBRARIESCOMPILE_NAME = "launcher-libraries-compile", LAUNCHERPACK_NAME = "launcher-pack",
|
||||||
|
KEY_NAME = ".keys", MODULES = "modules", LAUNCHER_MODULES = "launcher-modules",
|
||||||
|
LIBRARIES = "libraries", CONTROL_FILE = "control-file", PROGUARD_DIR = "proguard-libraries";
|
||||||
public Path updatesDir;
|
public Path updatesDir;
|
||||||
public Path librariesDir;
|
public Path librariesDir;
|
||||||
public Path launcherLibrariesDir;
|
public Path launcherLibrariesDir;
|
||||||
public Path launcherLibrariesCompileDir;
|
public Path launcherLibrariesCompileDir;
|
||||||
public Path launcherPackDir;
|
public Path launcherPackDir;
|
||||||
public Path keyDirectory;
|
public Path keyDirectory;
|
||||||
|
public Path proguardDir;
|
||||||
public Path dir;
|
public Path dir;
|
||||||
public Path trustStore;
|
public Path trustStore;
|
||||||
public Path tmpDir;
|
public Path tmpDir;
|
||||||
|
@ -489,6 +494,7 @@ public void collect() {
|
||||||
if (launcherModules == null) launcherModules = getPath(LAUNCHER_MODULES);
|
if (launcherModules == null) launcherModules = getPath(LAUNCHER_MODULES);
|
||||||
if (librariesDir == null) librariesDir = getPath(LIBRARIES);
|
if (librariesDir == null) librariesDir = getPath(LIBRARIES);
|
||||||
if (controlFile == null) controlFile = getPath(CONTROL_FILE);
|
if (controlFile == null) controlFile = getPath(CONTROL_FILE);
|
||||||
|
if (proguardDir == null) proguardDir = getPath(PROGUARD_DIR);
|
||||||
if (tmpDir == null)
|
if (tmpDir == null)
|
||||||
tmpDir = Paths.get(System.getProperty("java.io.tmpdir")).resolve("launchserver-%s".formatted(SecurityHelper.randomStringToken()));
|
tmpDir = Paths.get(System.getProperty("java.io.tmpdir")).resolve("launchserver-%s".formatted(SecurityHelper.randomStringToken()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
private static final List<String> classpathOnly = List.of("proguard", "jline", "progressbar", "kotlin");
|
private static final List<String> classpathOnly = List.of("proguard", "progressbar", "kotlin");
|
||||||
private static final String LOG4J_PROPERTY = "log4j2.configurationFile";
|
private static final String LOG4J_PROPERTY = "log4j2.configurationFile";
|
||||||
private static final String DEBUG_PROPERTY = "launchserver.main.debug";
|
private static final String DEBUG_PROPERTY = "launchserver.main.debug";
|
||||||
private static final String LIBRARIES_PROPERTY = "launchserver.dir.libraries";
|
private static final String LIBRARIES_PROPERTY = "launchserver.dir.libraries";
|
||||||
|
@ -74,6 +74,8 @@ public static void main(String[] args) throws Throwable {
|
||||||
classpath.add(IOHelper.getCodeSource(LaunchServerStarter.class));
|
classpath.add(IOHelper.getCodeSource(LaunchServerStarter.class));
|
||||||
options.moduleConf.modulePath.addAll(modulepath);
|
options.moduleConf.modulePath.addAll(modulepath);
|
||||||
options.moduleConf.modules.add("ALL-MODULE-PATH");
|
options.moduleConf.modules.add("ALL-MODULE-PATH");
|
||||||
|
options.moduleConf.enableNativeAccess.add("org.fusesource.jansi");
|
||||||
|
options.moduleConf.enableNativeAccess.add("io.netty.common");
|
||||||
ClassLoaderControl control = launch.init(classpath, "natives", options);
|
ClassLoaderControl control = launch.init(classpath, "natives", options);
|
||||||
control.clearLauncherPackages();
|
control.clearLauncherPackages();
|
||||||
control.addLauncherPackage("pro.gravit.utils.launch");
|
control.addLauncherPackage("pro.gravit.utils.launch");
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
package pro.gravit.launchserver.asm;
|
package pro.gravit.launchserver.asm;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.objectweb.asm.ClassReader;
|
import org.objectweb.asm.ClassReader;
|
||||||
import org.objectweb.asm.ClassVisitor;
|
import org.objectweb.asm.ClassVisitor;
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,14 +19,32 @@
|
||||||
* чего угодно. Работает через поиск class-файлов в classpath.
|
* чего угодно. Работает через поиск class-файлов в classpath.
|
||||||
*/
|
*/
|
||||||
public class ClassMetadataReader implements Closeable {
|
public class ClassMetadataReader implements Closeable {
|
||||||
|
private final Logger logger = LogManager.getLogger(ClassMetadataReader.class);
|
||||||
private final List<JarFile> cp;
|
private final List<JarFile> cp;
|
||||||
|
private final Map<String, Module> moduleClassFinder;
|
||||||
|
|
||||||
public ClassMetadataReader(List<JarFile> cp) {
|
public ClassMetadataReader(List<JarFile> cp) {
|
||||||
this.cp = cp;
|
this.cp = cp;
|
||||||
|
//var moduleLayer = ClassMetadataReader.class.getModule().getLayer() == null ? ModuleLayer.boot() : ClassMetadataReader.class.getModule().getLayer();
|
||||||
|
var moduleLayer = ModuleLayer.boot();
|
||||||
|
moduleClassFinder = collectModulePackages(moduleLayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassMetadataReader() {
|
public ClassMetadataReader() {
|
||||||
this.cp = new ArrayList<>();
|
this.cp = new ArrayList<>();
|
||||||
|
//var moduleLayer = ClassMetadataReader.class.getModule().getLayer() == null ? ModuleLayer.boot() : ClassMetadataReader.class.getModule().getLayer();
|
||||||
|
var moduleLayer = ModuleLayer.boot();
|
||||||
|
moduleClassFinder = collectModulePackages(moduleLayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, Module> collectModulePackages(ModuleLayer layer) {
|
||||||
|
var map = new HashMap<String, Module>();
|
||||||
|
for(var m : layer.modules()) {
|
||||||
|
for(var p : m.getPackages()) {
|
||||||
|
map.put(p, m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<JarFile> getCp() {
|
public List<JarFile> getCp() {
|
||||||
|
@ -58,7 +77,42 @@ public byte[] getClassData(String className) throws IOException {
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return IOHelper.read(IOHelper.getResourceURL(className + ".class"));
|
if(ClassMetadataReader.class.getModule().isNamed()) {
|
||||||
|
String pkg = getClassPackage(className).replace('/', '.');
|
||||||
|
var module = moduleClassFinder.get(pkg);
|
||||||
|
if(module != null) {
|
||||||
|
var cl = module.getClassLoader();
|
||||||
|
if(cl == null) {
|
||||||
|
cl = ClassLoader.getPlatformClassLoader();
|
||||||
|
}
|
||||||
|
var stream = cl.getResourceAsStream(className+".class");
|
||||||
|
if(stream != null) {
|
||||||
|
try(stream) {
|
||||||
|
return IOHelper.read(stream);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new FileNotFoundException("Class "+className + ".class");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new FileNotFoundException("Package "+pkg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var stream = ClassLoader.getSystemClassLoader().getResourceAsStream(className+".class");
|
||||||
|
if(stream != null) {
|
||||||
|
try(stream) {
|
||||||
|
return IOHelper.read(stream);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new FileNotFoundException(className + ".class");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getClassPackage(String type) {
|
||||||
|
int idx = type.lastIndexOf("/");
|
||||||
|
if(idx <= 0) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
return type.substring(0, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSuperClass(String type) {
|
public String getSuperClass(String type) {
|
||||||
|
@ -66,6 +120,7 @@ public String getSuperClass(String type) {
|
||||||
try {
|
try {
|
||||||
return getSuperClassASM(type);
|
return getSuperClassASM(type);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
logger.warn("getSuperClass: type {} not found ({}: {})", type, e.getClass().getName(), e.getMessage());
|
||||||
return "java/lang/Object";
|
return "java/lang/Object";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +155,7 @@ private static class CheckSuperClassVisitor extends ClassVisitor {
|
||||||
String superClassName;
|
String superClassName;
|
||||||
|
|
||||||
public CheckSuperClassVisitor() {
|
public CheckSuperClassVisitor() {
|
||||||
super(Opcodes.ASM7);
|
super(Opcodes.ASM9);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -54,7 +54,7 @@ public static void apply(Path inputFile, Path addFile, ZipOutputStream output, L
|
||||||
private static byte[] classFix(InputStream input, ClassMetadataReader reader, boolean stripNumbers) throws IOException {
|
private static byte[] classFix(InputStream input, ClassMetadataReader reader, boolean stripNumbers) throws IOException {
|
||||||
ClassReader cr = new ClassReader(input);
|
ClassReader cr = new ClassReader(input);
|
||||||
ClassNode cn = new ClassNode();
|
ClassNode cn = new ClassNode();
|
||||||
cr.accept(cn, stripNumbers ? (ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES) : ClassReader.SKIP_FRAMES);
|
cr.accept(cn, stripNumbers ? (ClassReader.SKIP_DEBUG) : 0);
|
||||||
ClassWriter cw = new SafeClassWriter(reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
ClassWriter cw = new SafeClassWriter(reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
||||||
cn.accept(cw);
|
cn.accept(cw);
|
||||||
return cw.toByteArray();
|
return cw.toByteArray();
|
||||||
|
|
|
@ -146,7 +146,7 @@ public byte[] transformClass(byte[] bytes, String classname, BuildContext contex
|
||||||
asmTransformer.transform(cn, classname, context);
|
asmTransformer.transform(cn, classname, context);
|
||||||
continue;
|
continue;
|
||||||
} else if (cn != null) {
|
} else if (cn != null) {
|
||||||
writer = new SafeClassWriter(reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
writer = new SafeClassWriter(reader, 0);
|
||||||
cn.accept(writer);
|
cn.accept(writer);
|
||||||
result = writer.toByteArray();
|
result = writer.toByteArray();
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ public byte[] transformClass(byte[] bytes, String classname, BuildContext contex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cn != null) {
|
if (cn != null) {
|
||||||
writer = new SafeClassWriter(reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
writer = new SafeClassWriter(reader, 0);
|
||||||
cn.accept(writer);
|
cn.accept(writer);
|
||||||
result = writer.toByteArray();
|
result = writer.toByteArray();
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ default byte[] transform(byte[] input, String classname, BuildContext context) {
|
||||||
ClassNode cn = new ClassNode();
|
ClassNode cn = new ClassNode();
|
||||||
reader.accept(cn, 0);
|
reader.accept(cn, 0);
|
||||||
transform(cn, classname, context);
|
transform(cn, classname, context);
|
||||||
SafeClassWriter writer = new SafeClassWriter(context.task.reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
SafeClassWriter writer = new SafeClassWriter(context.task.reader, 0);
|
||||||
cn.accept(writer);
|
cn.accept(writer);
|
||||||
return writer.toByteArray();
|
return writer.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,7 +213,7 @@ public Path process(Path inputFile) throws IOException {
|
||||||
args.add(IOHelper.resolveJavaBin(IOHelper.JVM_DIR).toAbsolutePath().toString());
|
args.add(IOHelper.resolveJavaBin(IOHelper.JVM_DIR).toAbsolutePath().toString());
|
||||||
args.addAll(component.jvmArgs);
|
args.addAll(component.jvmArgs);
|
||||||
args.add("-cp");
|
args.add("-cp");
|
||||||
try(Stream<Path> files = Files.walk(server.librariesDir, FileVisitOption.FOLLOW_LINKS)) {
|
try(Stream<Path> files = Files.walk(server.proguardDir, FileVisitOption.FOLLOW_LINKS)) {
|
||||||
args.add(files
|
args.add(files
|
||||||
.filter(e -> e.getFileName().toString().endsWith(".jar"))
|
.filter(e -> e.getFileName().toString().endsWith(".jar"))
|
||||||
.map(path -> path.toAbsolutePath().toString())
|
.map(path -> path.toAbsolutePath().toString())
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import pro.gravit.launcher.base.Launcher;
|
import pro.gravit.launcher.base.Launcher;
|
||||||
import pro.gravit.launchserver.socket.NettyConnectContext;
|
import pro.gravit.launchserver.socket.NettyConnectContext;
|
||||||
|
import pro.gravit.launchserver.socket.severlet.StatusSeverlet;
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
|
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
|
@ -34,6 +35,7 @@ public class NettyWebAPIHandler extends SimpleChannelInboundHandler<FullHttpRequ
|
||||||
public NettyWebAPIHandler(NettyConnectContext context) {
|
public NettyWebAPIHandler(NettyConnectContext context) {
|
||||||
super();
|
super();
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
addNewSeverlet("status", new StatusSeverlet());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addNewSeverlet(String path, SimpleSeverletHandler callback) {
|
public static void addNewSeverlet(String path, SimpleSeverletHandler callback) {
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package pro.gravit.launchserver.socket.severlet;
|
||||||
|
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
import io.netty.handler.codec.http.DefaultFullHttpResponse;
|
||||||
|
import io.netty.handler.codec.http.FullHttpRequest;
|
||||||
|
import io.netty.handler.codec.http.HttpResponseStatus;
|
||||||
|
import pro.gravit.launchserver.socket.NettyConnectContext;
|
||||||
|
import pro.gravit.launchserver.socket.handlers.NettyWebAPIHandler;
|
||||||
|
|
||||||
|
public class StatusSeverlet implements NettyWebAPIHandler.SimpleSeverletHandler {
|
||||||
|
@Override
|
||||||
|
public void handle(ChannelHandlerContext ctx, FullHttpRequest msg, NettyConnectContext context) {
|
||||||
|
sendHttpResponse(ctx, new DefaultFullHttpResponse(msg.protocolVersion(), HttpResponseStatus.OK));
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ public final class Version implements Comparable<Version> {
|
||||||
|
|
||||||
public static final int MAJOR = 5;
|
public static final int MAJOR = 5;
|
||||||
public static final int MINOR = 6;
|
public static final int MINOR = 6;
|
||||||
public static final int PATCH = 11;
|
public static final int PATCH = 12;
|
||||||
public static final int BUILD = 1;
|
public static final int BUILD = 1;
|
||||||
public static final Version.Type RELEASE = Type.STABLE;
|
public static final Version.Type RELEASE = Type.STABLE;
|
||||||
public final int major;
|
public final int major;
|
||||||
|
|
|
@ -14,5 +14,6 @@ public static final class ModuleConf {
|
||||||
public Map<String, String> exports = new HashMap<>();
|
public Map<String, String> exports = new HashMap<>();
|
||||||
public Map<String, String> opens = new HashMap<>();
|
public Map<String, String> opens = new HashMap<>();
|
||||||
public Map<String, String> reads = new HashMap<>();
|
public Map<String, String> reads = new HashMap<>();
|
||||||
|
public List<String> enableNativeAccess = new ArrayList<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,18 @@ public class ModuleLaunch implements Launch {
|
||||||
private ModuleLayer layer;
|
private ModuleLayer layer;
|
||||||
private MethodHandles.Lookup hackLookup;
|
private MethodHandles.Lookup hackLookup;
|
||||||
private boolean disablePackageDelegateSupport;
|
private boolean disablePackageDelegateSupport;
|
||||||
|
private static final MethodHandle ENABLE_NATIVE_ACCESS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
MethodHandle mh;
|
||||||
|
try {
|
||||||
|
mh = MethodHandles.lookup().findVirtual(ModuleLayer.Controller.class, "enableNativeAccess", MethodType.methodType(ModuleLayer.Controller.class, Module.class));
|
||||||
|
} catch (NoSuchMethodException | IllegalAccessException e) {
|
||||||
|
mh = null;
|
||||||
|
}
|
||||||
|
ENABLE_NATIVE_ACCESS = mh;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ClassLoaderControl init(List<Path> files, String nativePath, LaunchOptions options) {
|
public ClassLoaderControl init(List<Path> files, String nativePath, LaunchOptions options) {
|
||||||
this.disablePackageDelegateSupport = options.disablePackageDelegateSupport;
|
this.disablePackageDelegateSupport = options.disablePackageDelegateSupport;
|
||||||
|
@ -120,6 +132,20 @@ public ClassLoaderControl init(List<Path> files, String nativePath, LaunchOption
|
||||||
controller.addReads(source, target);
|
controller.addReads(source, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for(var e : options.moduleConf.enableNativeAccess) {
|
||||||
|
LogHelper.dev("Enable Native Access %s", e);
|
||||||
|
Module source = layer.findModule(e).orElse(null);
|
||||||
|
if(source == null) {
|
||||||
|
throw new RuntimeException(String.format("Module %s not found", e));
|
||||||
|
}
|
||||||
|
if(ENABLE_NATIVE_ACCESS != null) {
|
||||||
|
try {
|
||||||
|
ENABLE_NATIVE_ACCESS.invoke(controller, source);
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
moduleClassLoader.initializeWithLayer(layer);
|
moduleClassLoader.initializeWithLayer(layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
id 'org.openjfx.javafxplugin' version '0.1.0' apply false
|
id 'org.openjfx.javafxplugin' version '0.1.0' apply false
|
||||||
}
|
}
|
||||||
group = 'pro.gravit.launcher'
|
group = 'pro.gravit.launcher'
|
||||||
version = '5.6.11'
|
version = '5.6.12'
|
||||||
|
|
||||||
apply from: 'props.gradle'
|
apply from: 'props.gradle'
|
||||||
|
|
||||||
|
|
2
java24args.txt
Normal file
2
java24args.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
--enable-native-access=org.fusesource.jansi
|
||||||
|
--enable-native-access=io.netty.common
|
4
javaargs.txt
Normal file
4
javaargs.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
--add-opens java.base/java.lang.invoke=launchserver
|
||||||
|
--add-modules java.net.http
|
||||||
|
-Dlauncher.useSlf4j=true
|
||||||
|
-Dio.netty.noUnsafe=true
|
2
modules
2
modules
|
@ -1 +1 @@
|
||||||
Subproject commit eeea07098281c5cc98feffaae9b5a01677ca2eb7
|
Subproject commit 4a8afc798cd5bca93c84f9130d0baaac00a22813
|
|
@ -1,6 +1,6 @@
|
||||||
project.ext {
|
project.ext {
|
||||||
verAsm = '9.7.1'
|
verAsm = '9.7.1'
|
||||||
verNetty = '4.2.0.RC4'
|
verNetty = '4.2.0.Final'
|
||||||
verOshiCore = '6.8.0'
|
verOshiCore = '6.8.0'
|
||||||
verJunit = '5.11.4'
|
verJunit = '5.11.4'
|
||||||
verJansi = '2.4.1'
|
verJansi = '2.4.1'
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
verSlf4j = '2.0.17'
|
verSlf4j = '2.0.17'
|
||||||
verLog4j = '2.24.3'
|
verLog4j = '2.24.3'
|
||||||
verMySQLConn = '9.2.0'
|
verMySQLConn = '9.2.0'
|
||||||
verMariaDBConn = '3.5.1'
|
verMariaDBConn = '3.5.3'
|
||||||
verPostgreSQLConn = '42.7.5'
|
verPostgreSQLConn = '42.7.5'
|
||||||
verH2Conn = '2.3.232'
|
verH2Conn = '2.3.232'
|
||||||
verProguard = '7.7.0'
|
verProguard = '7.7.0'
|
||||||
|
|
Loading…
Reference in a new issue