mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FIX] Hikari and launch4j resolving.
This commit is contained in:
parent
665ed6a4f7
commit
84543b85f3
2 changed files with 23 additions and 39 deletions
|
@ -22,9 +22,8 @@
|
||||||
hikari
|
hikari
|
||||||
pack
|
pack
|
||||||
launch4j
|
launch4j
|
||||||
launch4jCJ
|
|
||||||
bundleOnly.extendsFrom bundle
|
bundleOnly.extendsFrom bundle
|
||||||
api.extendsFrom bundle, hikari, pack, launch4jCJ, launch4j
|
api.extendsFrom bundle, hikari, pack, launch4j
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
@ -86,7 +85,6 @@ pack project(':LauncherAPI')
|
||||||
bundle group: 'net.sf.proguard', name: 'proguard-base', version: rootProject['verProguard']
|
bundle group: 'net.sf.proguard', name: 'proguard-base', version: rootProject['verProguard']
|
||||||
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: rootProject['verJunit']
|
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: rootProject['verJunit']
|
||||||
|
|
||||||
//TODO rewrite
|
|
||||||
hikari 'io.micrometer:micrometer-core:1.0.6'
|
hikari 'io.micrometer:micrometer-core:1.0.6'
|
||||||
hikari('com.zaxxer:HikariCP:3.4.1') {
|
hikari('com.zaxxer:HikariCP:3.4.1') {
|
||||||
exclude group: 'javassist'
|
exclude group: 'javassist'
|
||||||
|
@ -102,14 +100,13 @@ pack project(':LauncherAPI')
|
||||||
exclude group: 'org.slf4j'
|
exclude group: 'org.slf4j'
|
||||||
}
|
}
|
||||||
|
|
||||||
launch4jCJ('net.sf.launch4j:launch4j:3.12:workdir-win32') {
|
launch4j('net.sf.launch4j:launch4j:3.12:workdir-win32') {
|
||||||
exclude group: '*'
|
exclude group: '*'
|
||||||
}
|
}
|
||||||
|
|
||||||
launch4jCJ('net.sf.launch4j:launch4j:3.12:workdir-linux') {
|
launch4j('net.sf.launch4j:launch4j:3.12:workdir-linux') {
|
||||||
exclude group: '*'
|
exclude group: '*'
|
||||||
}
|
}
|
||||||
// Rewrite end.
|
|
||||||
|
|
||||||
compileOnly group: 'com.google.guava', name: 'guava', version: rootProject['verGuavaC']
|
compileOnly group: 'com.google.guava', name: 'guava', version: rootProject['verGuavaC']
|
||||||
// Do not update (laggy deps).
|
// Do not update (laggy deps).
|
||||||
|
@ -117,23 +114,24 @@ pack project(':LauncherAPI')
|
||||||
compileOnlyA 'org.apache.logging.log4j:log4j-core:2.11.2'
|
compileOnlyA 'org.apache.logging.log4j:log4j-core:2.11.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO rewrite
|
|
||||||
task hikari(type: Copy) {
|
task hikari(type: Copy) {
|
||||||
duplicatesStrategy = 'EXCLUDE'
|
duplicatesStrategy = 'EXCLUDE'
|
||||||
into "$buildDir/libs/libraries/hikaricp"
|
into "$buildDir/libs/libraries/hikaricp"
|
||||||
from configurations.hikari
|
from configurations.hikari
|
||||||
}
|
}
|
||||||
|
|
||||||
task launch4jM(type: Copy) {
|
task launch4j(type: Copy) {
|
||||||
duplicatesStrategy = 'EXCLUDE'
|
duplicatesStrategy = 'EXCLUDE'
|
||||||
into "$buildDir/libs/libraries/launch4j"
|
into "$buildDir/libs/libraries/launch4j"
|
||||||
from(configurations.launch4jCJ.collect { it.isDirectory() ? it : zipTree(it) })
|
from(configurations.launch4j.collect { it.isDirectory() ? it : (it.getName().contains("workdir") ? zipTree(it) : it) })
|
||||||
includeEmptyDirs false
|
includeEmptyDirs false
|
||||||
eachFile { FileCopyDetails fcp ->
|
eachFile { FileCopyDetails fcp ->
|
||||||
if (fcp.relativePath.pathString.startsWith("launch4j-")) {
|
if (fcp.relativePath.pathString.startsWith("launch4j-")) {
|
||||||
def segments = fcp.relativePath.segments
|
if (fcp.relativePath.pathString.contains("workdir")) {
|
||||||
def pathSegments = segments[1..-1] as String[]
|
def segments = fcp.relativePath.segments
|
||||||
fcp.relativePath = new RelativePath(!fcp.file.isDirectory(), pathSegments)
|
def pathSegments = segments[1..-1] as String[]
|
||||||
|
fcp.relativePath = new RelativePath(!fcp.file.isDirectory(), pathSegments)
|
||||||
|
}
|
||||||
fcp.mode = 0755
|
fcp.mode = 0755
|
||||||
} else {
|
} else {
|
||||||
fcp.exclude()
|
fcp.exclude()
|
||||||
|
@ -141,23 +139,9 @@ task launch4jM(type: Copy) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task launch4jA(type: Copy) {
|
|
||||||
duplicatesStrategy = 'EXCLUDE'
|
|
||||||
into "$buildDir/libs/libraries/launch4j"
|
|
||||||
from(configurations.launch4j)
|
|
||||||
includeEmptyDirs false
|
|
||||||
eachFile { FileCopyDetails fcp ->
|
|
||||||
if (fcp.name.startsWith("launch4j")) {
|
|
||||||
fcp.name = "launch4j.jar"
|
|
||||||
}
|
|
||||||
fcp.mode = 0755
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Rewrite end.
|
|
||||||
|
|
||||||
task dumpLibs(type: Copy) {
|
task dumpLibs(type: Copy) {
|
||||||
duplicatesStrategy = 'EXCLUDE'
|
duplicatesStrategy = 'EXCLUDE'
|
||||||
dependsOn tasks.hikari, tasks.launch4jM, tasks.launch4jA //TODO rewrite this
|
dependsOn tasks.hikari, tasks.launch4j
|
||||||
into "$buildDir/libs/libraries"
|
into "$buildDir/libs/libraries"
|
||||||
from configurations.bundleOnly
|
from configurations.bundleOnly
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
import pro.gravit.launchserver.asm.InjectClassAcceptor;
|
import pro.gravit.launchserver.asm.InjectClassAcceptor;
|
||||||
import pro.gravit.utils.helper.JarHelper;
|
import pro.gravit.utils.helper.JarHelper;
|
||||||
|
|
||||||
|
import java.lang.invoke.MethodHandles;
|
||||||
|
import java.lang.invoke.MethodType;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -38,11 +40,11 @@ public static class TestClass
|
||||||
public Map<String, String> map;
|
public Map<String, String> map;
|
||||||
}
|
}
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void prepare() throws Exception {
|
public static void prepare() throws Throwable {
|
||||||
classLoader = new ASMClassLoader(ASMTransformersTest.class.getClassLoader());
|
classLoader = new ASMClassLoader(ASMTransformersTest.class.getClassLoader());
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
void testASM() throws Exception
|
void testASM() throws Throwable
|
||||||
{
|
{
|
||||||
ClassReader reader = new ClassReader(JarHelper.getClassBytes(TestClass.class));
|
ClassReader reader = new ClassReader(JarHelper.getClassBytes(TestClass.class));
|
||||||
ClassNode node = new ClassNode();
|
ClassNode node = new ClassNode();
|
||||||
|
@ -65,15 +67,13 @@ void testASM() throws Exception
|
||||||
byte[] bytes = writer.toByteArray();
|
byte[] bytes = writer.toByteArray();
|
||||||
classLoader.rawDefineClass("ASMTestClass", bytes, 0, bytes.length);
|
classLoader.rawDefineClass("ASMTestClass", bytes, 0, bytes.length);
|
||||||
Class<?> clazz = classLoader.loadClass("ASMTestClass");
|
Class<?> clazz = classLoader.loadClass("ASMTestClass");
|
||||||
Object instance = clazz.newInstance();
|
Object instance = MethodHandles.publicLookup().findConstructor(clazz, MethodType.methodType(void.class)).invoke();
|
||||||
Field field = clazz.getField("test");
|
Assertions.assertEquals(1234, (int)
|
||||||
Object result = field.get(instance);
|
MethodHandles.publicLookup().findGetter(clazz, "test", int.class).invoke(instance));
|
||||||
Assertions.assertEquals(1234, (int) (Integer) result);
|
Assertions.assertEquals(strings, (List<String>)
|
||||||
field = clazz.getField("s");
|
MethodHandles.publicLookup().findGetter(clazz, "s", List.class).invoke(instance));
|
||||||
result = field.get(instance);
|
|
||||||
Assertions.assertEquals(strings, result);
|
Assertions.assertEquals(byteMap, (Map<String, Object>)
|
||||||
field = clazz.getField("map");
|
MethodHandles.publicLookup().findGetter(clazz, "map", Map.class).invoke(instance));
|
||||||
result = field.get(instance);
|
|
||||||
Assertions.assertEquals(byteMap, result);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue