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