Use reflections8 instead of reflections
This commit is contained in:
		
							parent
							
								
									592bb31eee
								
							
						
					
					
						commit
						cb20a6e744
					
				| @ -45,7 +45,7 @@ subprojects { | |||||||
|             keep("class $group.snowygui.fabric.**") |             keep("class $group.snowygui.fabric.**") | ||||||
|             keep("class $group.snowygui.forge.**") |             keep("class $group.snowygui.forge.**") | ||||||
|             keepnames("class $group.snowygui.Snowy") |             keepnames("class $group.snowygui.Snowy") | ||||||
|             keepnames("class $group.snowygui.gui.feature.*") |             keep("class $group.snowygui.gui.feature.**") | ||||||
|             keepclassmembers("class $group.snowygui.** { public protected <methods>; }") |             keepclassmembers("class $group.snowygui.** { public protected <methods>; }") | ||||||
|             keepattributes("*Annotation*, Signature, InnerClasses, EnclosingMethod, MethodParameters, Synthetic, Exceptions") |             keepattributes("*Annotation*, Signature, InnerClasses, EnclosingMethod, MethodParameters, Synthetic, Exceptions") | ||||||
|             obfuscationdictionary("$dictionariesDir/dictionary.txt") |             obfuscationdictionary("$dictionariesDir/dictionary.txt") | ||||||
| @ -56,7 +56,14 @@ subprojects { | |||||||
|             adaptclassstrings() |             adaptclassstrings() | ||||||
|             "$group.**".also { dontwarn(it); dontnote(it) } |             "$group.**".also { dontwarn(it); dontnote(it) } | ||||||
|             val homeDir = System.getProperty("java.home") as String |             val homeDir = System.getProperty("java.home") as String | ||||||
|             libraryjars(configurations.compileClasspath.get().filter { it.name.startsWith("kotlin") }) |             libraryjars(configurations.compileClasspath.get().filter { file -> | ||||||
|  |                 listOf( | ||||||
|  |                     "kotlin", | ||||||
|  |                     "gson" | ||||||
|  |                 ).any { | ||||||
|  |                     file.name.startsWith(it) | ||||||
|  |                 } | ||||||
|  |             }) | ||||||
|             if (JavaVersion.current().isJava9Compatible) { |             if (JavaVersion.current().isJava9Compatible) { | ||||||
|                 libraryjars("$homeDir/jmods/java.base.jmod") |                 libraryjars("$homeDir/jmods/java.base.jmod") | ||||||
|             } else libraryjars("$homeDir/lib/rt.jar") |             } else libraryjars("$homeDir/lib/rt.jar") | ||||||
| @ -81,8 +88,8 @@ subprojects { | |||||||
|             "$kotlinX:kotlinx-datetime:0.2.0", |             "$kotlinX:kotlinx-datetime:0.2.0", | ||||||
|             "com.typesafe:config:1.4.1", |             "com.typesafe:config:1.4.1", | ||||||
|             "io.github.config4k:config4k:0.4.2", |             "io.github.config4k:config4k:0.4.2", | ||||||
|             "org.reflections:reflections:0.9.12" |             "net.oneandone.reflections8:reflections8:0.11.7", "org.javassist:javassist:3.28.0-GA" | ||||||
|         ).forEach { implementation(it); shadowC(it) { isTransitive = false } } |         ).forEach { implementation(it); shadowC(it) { isTransitive = false; } } | ||||||
|         "minecraft"("com.mojang:minecraft:${rootProject.property("minecraft")}") |         "minecraft"("com.mojang:minecraft:${rootProject.property("minecraft")}") | ||||||
|         "mappings"(mappingsDep) |         "mappings"(mappingsDep) | ||||||
|     } |     } | ||||||
| @ -121,7 +128,8 @@ allprojects { | |||||||
|         withType(ShadowJar::class) { |         withType(ShadowJar::class) { | ||||||
|             relocate("kotlinx-datetime", "${rootProject.group}.kotlinx-datetime") |             relocate("kotlinx-datetime", "${rootProject.group}.kotlinx-datetime") | ||||||
|             relocate("org.jetbrains", "${rootProject.group}.jetbrainslibs") |             relocate("org.jetbrains", "${rootProject.group}.jetbrainslibs") | ||||||
|             relocate("org.reflections", "${rootProject.group}.reflectionlib") |             relocate("javassist", "${rootProject.group}.javassist") | ||||||
|  |             relocate("org.reflections8", "${rootProject.group}.reflectionlib") | ||||||
|             relocate("com.typesafe.config", "${rootProject.group}.typesafe.config") |             relocate("com.typesafe.config", "${rootProject.group}.typesafe.config") | ||||||
|             relocate("io.github.config4k", "${rootProject.group}.config4k") |             relocate("io.github.config4k", "${rootProject.group}.config4k") | ||||||
|             relocate("net.arikia.dev.drpc", "${rootProject.group}.drpc") |             relocate("net.arikia.dev.drpc", "${rootProject.group}.drpc") | ||||||
|  | |||||||
| @ -6,15 +6,28 @@ import fr.username404.snowygui.misc.AddKeyMaps | |||||||
| import io.github.config4k.getValue | import io.github.config4k.getValue | ||||||
| import org.apache.logging.log4j.LogManager | import org.apache.logging.log4j.LogManager | ||||||
| import org.apache.logging.log4j.Logger | import org.apache.logging.log4j.Logger | ||||||
| import org.reflections.Reflections | import org.reflections8.Reflections | ||||||
|  | import org.reflections8.scanners.SubTypesScanner | ||||||
|  | import org.reflections8.scanners.TypeAnnotationsScanner | ||||||
|  | import org.reflections8.util.ClasspathHelper | ||||||
|  | import org.reflections8.util.ConfigurationBuilder | ||||||
| 
 | 
 | ||||||
| abstract class Snowy { | abstract class Snowy { | ||||||
|     private val displayInitMessage: Boolean by obtained |     private val displayInitMessage: Boolean by obtained | ||||||
|     companion object { |     companion object { | ||||||
|         val reflections = Reflections("fr.username404.snowygui") |         val reflections = Reflections(ConfigurationBuilder() | ||||||
|  |             .setUrls(ClasspathHelper.forClassLoader()) | ||||||
|  |             .setScanners(SubTypesScanner(false), TypeAnnotationsScanner()) | ||||||
|  |             .useParallelExecutor() | ||||||
|  |         ) | ||||||
|         fun onEvent(e: String, lambda: argsLambda) = useKey(e).add(lambda) |         fun onEvent(e: String, lambda: argsLambda) = useKey(e).add(lambda) | ||||||
|         @JvmField |         @JvmField | ||||||
|         val logs: Logger = LogManager.getLogger() |         val logs: Logger = LogManager.getLogger() | ||||||
|  |         init { | ||||||
|  |             reflections.allTypes.forEach { | ||||||
|  |                 if (it.contains("fr.username404")) logs.info(it) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|     private fun eventsInit() { |     private fun eventsInit() { | ||||||
|         onEvent("EndTick") { |         onEvent("EndTick") { | ||||||
|  | |||||||
| @ -20,5 +20,5 @@ annotation class ButtonInfo( | |||||||
| }; enum class Category(val translationKey: String, val categoryColor: Colors) { | }; enum class Category(val translationKey: String, val categoryColor: Colors) { | ||||||
|     MISC("snowy.clickbox.misc", Colors.BLUE), |     MISC("snowy.clickbox.misc", Colors.BLUE), | ||||||
|     RISKY("snowy.clickbox.risky", Colors.RED); |     RISKY("snowy.clickbox.risky", Colors.RED); | ||||||
|     init { ClickGui.components.add(ClickBox(y = 0.0, name = TranslatableComponent(translationKey), color = categoryColor)) } |     init { ClickGui.components.add(ClickBox(y = 4.0, name = TranslatableComponent(translationKey), color = categoryColor)) } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user