diff --git a/modern/build.gradle.kts b/modern/build.gradle.kts index dcb795a84..3d6c8fa4c 100644 --- a/modern/build.gradle.kts +++ b/modern/build.gradle.kts @@ -1,34 +1,34 @@ import xyz.wagyourtail.unimined.api.minecraft.task.RemapJarTask plugins { - java - idea - `maven-publish` - alias(libs.plugins.unimined) - alias(libs.plugins.kotlin.jvm) + java + idea + `maven-publish` + alias(libs.plugins.unimined) + alias(libs.plugins.kotlin.jvm) // alias(libs.plugins.kotlin.lombok) - alias(libs.plugins.dokka) - alias(libs.plugins.shadow) + alias(libs.plugins.dokka) + alias(libs.plugins.shadow) } unimined.minecraft { - version(libs.versions.mc.modern.get()) - mappings { - intermediary() - yarn(libs.versions.yarn.build.get()) - } - - fabric { - loader(libs.versions.fabric.loader.get()) - } - runs { - config("client") { - jvmArgs.add("-Dmoulconfig.testmod=true") - jvmArgs.add("-Dmoulconfig.warn.crash=false") - env.putAll(parseEnvFile(file(".env"))) - } - } + version(libs.versions.mc.modern.get()) + mappings { + intermediary() + yarn(libs.versions.yarn.build.get()) + } + + fabric { + loader(libs.versions.fabric.loader.get()) + } + runs { + config("client") { + jvmArgs.add("-Dmoulconfig.testmod=true") + jvmArgs.add("-Dmoulconfig.warn.crash=false") + env.putAll(parseEnvFile(file(".env"))) + } + } } @@ -36,53 +36,65 @@ java.toolchain.languageVersion.set(JavaLanguageVersion.of(17)) val shadowInclude by configurations.creating dependencies { - implementation(project(":common")) - "modImplementation"(fabricApi.fabricModule("fabric-command-api-v2", libs.versions.fabric.api.get())) - "modImplementation"(fabricApi.fabricModule("fabric-resource-loader-v0", libs.versions.fabric.api.get())) - shadowInclude(project(":common", configuration = "singleFile")) - implementation(libs.libninepatch) - shadowInclude(libs.libninepatch) + implementation(project(":common")) + "modImplementation"(fabricApi.fabricModule("fabric-command-api-v2", libs.versions.fabric.api.get())) + "modImplementation"(fabricApi.fabricModule("fabric-resource-loader-v0", libs.versions.fabric.api.get())) + shadowInclude(project(":common", configuration = "singleFile")) + implementation(libs.libninepatch) + shadowInclude(libs.libninepatch) } tasks.shadowJar { - configurations = listOf(shadowInclude) - archiveClassifier.set("dev") + configurations = listOf(shadowInclude) + archiveClassifier.set("dev") } val remapJar by tasks.named("remapJar", RemapJarTask::class) { - archiveClassifier.set("") - dependsOn(tasks.shadowJar) - inputFile.set(tasks.shadowJar.flatMap { it.archiveFile }) + archiveClassifier.set("") + dependsOn(tasks.shadowJar) + inputFile.set(tasks.shadowJar.flatMap { it.archiveFile }) } tasks.processResources { - from(project(":common").tasks.processResources) + from(project(":common").tasks.processResources) } tasks.jar { - archiveClassifier.set("small") - dependsOn(tasks.processResources) + archiveClassifier.set("small") + dependsOn(tasks.processResources) } val sourcesJar by tasks.creating(Jar::class) { - from(sourceSets.main.get().allSource) - from(project(":common").sourceSets.getByName("main").allSource) - archiveClassifier.set("sources") + from(sourceSets.main.get().allSource) + from(project(":common").sourceSets.getByName("main").allSource) + archiveClassifier.set("sources") } + + +tasks.withType(Jar::class){ + this.filesMatching(listOf("fabric.mod.json")) { + filter { + if (it.contains("FabricMain")) "" + else it + } + } + exclude("io/github/notenoughupdates/moulconfig/test/**") +} + publishing { - publications { - create("maven") { - artifact(remapJar) { - classifier = "" - } - artifact(tasks.shadowJar) { - classifier = "named" - } - artifact(tasks["sourcesJar"]) { - classifier = "sources" - } - } - } + publications { + create("maven") { + artifact(remapJar) { + classifier = "" + } + artifact(tasks.shadowJar) { + classifier = "named" + } + artifact(tasks["sourcesJar"]) { + classifier = "sources" + } + } + } } diff --git a/modern/src/main/kotlin/io/github/notenoughupdates/moulconfig/test/FabricMain.kt b/modern/src/main/kotlin/io/github/notenoughupdates/moulconfig/test/FabricMain.kt index cc3db67a4..07029e21d 100644 --- a/modern/src/main/kotlin/io/github/notenoughupdates/moulconfig/test/FabricMain.kt +++ b/modern/src/main/kotlin/io/github/notenoughupdates/moulconfig/test/FabricMain.kt @@ -21,6 +21,7 @@ import java.util.* class FabricMain : ModInitializer { override fun onInitialize() { + if (System.getProperty("moulconfig.testmod") != "true") return val config = ManagedConfig.create(File("config/moulconfig/test.json"), TestConfig::class.java) ClientCommandRegistrationCallback.EVENT.register { a, b -> a.register(literal("moulconfig").executes { @@ -99,4 +100,4 @@ class FabricMain : ModInitializer { var data: ObservableList = ObservableList(ArrayList(Arrays.asList(Element("Test 1"), Element("Test 2"), Element("Test 3")))) } -} \ No newline at end of file +} diff --git a/modern/src/main/resources/fabric.mod.json b/modern/src/main/resources/fabric.mod.json index 22db82212..769983951 100644 --- a/modern/src/main/resources/fabric.mod.json +++ b/modern/src/main/resources/fabric.mod.json @@ -2,9 +2,17 @@ "id": "moulconfig", "schemaVersion": 1, "version": "1.0.0", + "name": "Moulconfig", "entrypoints": { "main": [ "io.github.notenoughupdates.moulconfig.test.FabricMain" ] + }, + "custom": { + "modmenu": { + "badges": [ + "library" + ] + } } } \ No newline at end of file