Skip to content

Commit

Permalink
fix: remove META-INF/services files added by kotlin-reflect
Browse files Browse the repository at this point in the history
  • Loading branch information
Itsusinn committed Jan 15, 2023
1 parent 7a7ce9d commit 7f68af2
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 33 deletions.
2 changes: 2 additions & 0 deletions fabric-1_16/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ pkg {
excludePath("META-INF/proguard/*")
excludePath("META-INF/maven/*")
excludePath("META-INF/com.android.tools/*")
excludePath("META-INF/services/kotlin.reflect*")
excludePath("META-INF/services/java.security*")
excludePath("org/slf4j/*")
excludePath("org/jetbrains/annotations/*")
excludePath("org/intellij/lang/annotations/*")
Expand Down
1 change: 1 addition & 0 deletions fabric-1_17/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pkg {
excludePath("META-INF/proguard/*")
excludePath("META-INF/maven/*")
excludePath("META-INF/com.android.tools/*")
excludePath("META-INF/services/kotlin.reflect*")
excludePath("org/slf4j/*")
excludePath("org/jetbrains/annotations/*")
excludePath("org/intellij/lang/annotations/*")
Expand Down
1 change: 1 addition & 0 deletions fabric-1_18/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pkg {
excludePath("META-INF/proguard/*")
excludePath("META-INF/maven/*")
excludePath("META-INF/com.android.tools/*")
excludePath("META-INF/services/kotlin.reflect*")
excludePath("org/slf4j/*")
excludePath("org/jetbrains/annotations/*")
excludePath("org/intellij/lang/annotations/*")
Expand Down
1 change: 1 addition & 0 deletions fabric-1_19/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pkg {
excludePath("META-INF/proguard/*")
excludePath("META-INF/maven/*")
excludePath("META-INF/com.android.tools/*")
excludePath("META-INF/services/kotlin.reflect*")
excludePath("org/slf4j/*")
excludePath("org/jetbrains/annotations/*")
excludePath("org/intellij/lang/annotations/*")
Expand Down
30 changes: 14 additions & 16 deletions forge-1_16/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
id("io.itsusinn.pkg")
}
architectury {
minecraft = "1.18.2"
minecraft = "1.16.5"
platformSetupLoomIde()
forge()
}
Expand All @@ -22,22 +22,24 @@ repositories {
}
pkg {
excludePath("META-INF/*.kotlin_module")
excludePathStartWith("META-INF/versions")
excludePathStartWith("META-INF/proguard")
excludePathStartWith("META-INF/maven")
excludePathStartWith("org/slf4j")
excludePathStartWith("kotlinx/coroutines/flow")
excludePath("META-INF/versions/*")
excludePath("META-INF/proguard/*")
excludePath("META-INF/maven/*")
excludePath("META-INF/com.android.tools/*")
excludePath("org/slf4j/*")
excludePath("org/jetbrains/annotations/*")
excludePath("org/intellij/lang/annotations/*")
excludePath("kotlin/*")
excludePath("kotlinx/*")
listOf("asn1", "jcajce", "jce", "pqc", "x509", "math", "i18n", "iana", "internal").forEach {
excludePathStartWith("org/bouncycastle/$it")
excludePath("org/bouncycastle/$it/*")
}
val task = tasks.remapJar.get()
task.dependsOn("pkg")
shadowJar {
task.inputFile.set(this.archiveFile)
}
relocateKotlinStdlib()
relocateKotlinxLib()
kotlinRelocate("org.yaml.snakeyaml", "$group.relocate.org.yaml.snakeyaml")
kotlinRelocate("org.yaml.snakeyaml", "relocate.org.yaml.snakeyaml")
}

loom {
Expand All @@ -46,16 +48,13 @@ loom {

dependencies {
val loom = project.extensions.getByName<LoomGradleExtensionAPI>("loom")
minecraft("com.mojang:minecraft:1.18.2")
minecraft("com.mojang:minecraft:1.16.5")
mappings(loom.officialMojangMappings())

forge("net.minecraftforge:forge:1.18.2-40.0.12")
forge("net.minecraftforge:forge:1.16.5-36.2.34")
compileOnly("org.jetbrains.kotlin:kotlin-stdlib")

pkgIn(project(":common"))
pkgIn("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0")
pkgIn("io.nats:jnats:2.15.3")
pkgIn("org.mesagisto:mesagisto-client:1.5.2")
}

java {
Expand All @@ -68,7 +67,6 @@ tasks {
jvmTarget = "1.8"
freeCompilerArgs = listOf("-Xinline-classes", "-Xopt-in=kotlin.RequiresOptIn")
}
sourceCompatibility = "1.8"
}
processResources {
inputs.property("version", project.version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package org.meowcat.mesagisto.forge

import net.minecraft.server.MinecraftServer
import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.event.server.ServerStartingEvent
import net.minecraftforge.event.server.ServerStoppingEvent
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.server.ServerLifecycleHooks
import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.Logger
import org.meowcat.mesagisto.forge.impl.ChatImpl
Expand All @@ -13,22 +13,23 @@ val logger: Logger = LogManager.getLogger("mesagisto")

@net.minecraftforge.fml.common.Mod("mesagisto")
class ModAdapter {
private lateinit var server: MinecraftServer
private val server: MinecraftServer by lazy { ServerLifecycleHooks.getCurrentServer() }
init {
MinecraftForge.EVENT_BUS.addListener(ChatImpl::deliverChatEvent)
MinecraftForge.EVENT_BUS.addListener(this::onServerStart)
MinecraftForge.EVENT_BUS.addListener(this::onServerStop)
}
private fun onServerStart(
event: ServerStartingEvent
event: WorldEvent.Load
) {
server = event.server
ChatImpl.server = event.server
server
ChatImpl.server
ModEntry.onEnable()
}

private fun onServerStop(
event: ServerStoppingEvent
event: WorldEvent.Unload
) {
ModEntry.onDisable()
// ModEntry.onDisable()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ import net.minecraft.network.chat.ChatType
import net.minecraft.network.chat.TextComponent
import net.minecraft.server.MinecraftServer
import net.minecraftforge.event.ServerChatEvent
import net.minecraftforge.fml.server.ServerLifecycleHooks
import org.mesagisto.mcmod.api.ChatHandler
import org.mesagisto.mcmod.api.IChat
import java.util.*

class IChatImpl : IChat by ChatImpl

object ChatImpl : IChat {
lateinit var server: MinecraftServer
val server: MinecraftServer by lazy { ServerLifecycleHooks.getCurrentServer() }
private val handlers: MutableList<ChatHandler> = arrayListOf()

fun deliverChatEvent(event: ServerChatEvent) {
handlers.forEach {
it.hande(event.player.name.string, event.message)
it.handle(event.player.name.string, event.message)
}
}
override fun broadcastMessage(message: String) {
Expand Down
1 change: 1 addition & 0 deletions forge-1_18/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pkg {
excludePath("META-INF/proguard/*")
excludePath("META-INF/maven/*")
excludePath("META-INF/com.android.tools/*")
excludePath("META-INF/services/kotlin.reflect*")
excludePath("org/slf4j/*")
excludePath("org/jetbrains/annotations/*")
excludePath("org/intellij/lang/annotations/*")
Expand Down
7 changes: 0 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
org.gradle.jvmargs=-Xmx2G

loader_version=0.12.2
fabric_api_version=0.29.3+1.16

mod_version = 1.1.2
maven_group = org.meowcat
archives_base_name = fabric-message-source

0 comments on commit 7f68af2

Please sign in to comment.