From 8dd4551e02717ecd19f1080abfe5445c828243e9 Mon Sep 17 00:00:00 2001 From: TexBlock <3140846162@qq.com> Date: Sun, 8 Sep 2024 00:18:49 +0800 Subject: [PATCH] improve --- base/fabric/build.gradle | 6 +-- base/neo/build.gradle | 6 +-- .../gradle/plugin/KesssokuExtension.java | 37 +++++++++++-------- command/common/build.gradle | 11 ++---- command/fabric/build.gradle | 10 +++-- command/neo/build.gradle | 12 +++--- config/common/build.gradle | 6 ++- config/fabric/build.gradle | 15 +++++--- config/neo/build.gradle | 14 ++++--- entity-events/common/build.gradle | 6 ++- entity-events/fabric/build.gradle | 12 ++++-- entity-events/neo/build.gradle | 12 +++--- entrypoint/common/build.gradle | 5 ++- entrypoint/fabric/build.gradle | 13 +++++-- entrypoint/neo/build.gradle | 10 +++-- event-base/common/build.gradle | 4 +- event-base/fabric/build.gradle | 10 +++-- event-base/neo/build.gradle | 10 +++-- keybind/common/build.gradle | 4 +- keybind/fabric/build.gradle | 10 +++-- keybind/neo/build.gradle | 12 +++--- lifecycle-events/common/build.gradle | 8 ++-- lifecycle-events/fabric/build.gradle | 10 +++-- lifecycle-events/neo/build.gradle | 12 +++--- platform/common/build.gradle | 6 +-- platform/fabric/build.gradle | 10 +++-- platform/neo/build.gradle | 10 +++-- registry/common/build.gradle | 4 +- registry/fabric/build.gradle | 10 +++-- registry/neo/build.gradle | 11 +++--- wrapper/fabric/build.gradle | 6 ++- wrapper/neo/build.gradle | 4 +- 32 files changed, 187 insertions(+), 129 deletions(-) diff --git a/base/fabric/build.gradle b/base/fabric/build.gradle index fbff4c8..ea593d9 100644 --- a/base/fabric/build.gradle +++ b/base/fabric/build.gradle @@ -5,7 +5,7 @@ apply from: rootProject.file("gradle/scripts/klib-fabric.gradle") group = "band.kessoku.lib.base" base.archivesName = rootProject.name + "-base" -dependencies { - common(project(path: ':base-common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':base-common', configuration: 'transformProductionFabric') +kessoku { + common("base", ModPlatform.FABRIC) + shadowBundle("base", ModPlatform.FABRIC) } diff --git a/base/neo/build.gradle b/base/neo/build.gradle index 9546891..1d37188 100644 --- a/base/neo/build.gradle +++ b/base/neo/build.gradle @@ -5,7 +5,7 @@ apply from: rootProject.file("gradle/scripts/klib-neo.gradle") group = "band.kessoku.lib.base" base.archivesName = rootProject.name + "-base" -dependencies { - common(project(path: ':base-common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':base-common', configuration: 'transformProductionNeoForge') +kessoku { + common("base", ModPlatform.NEOFORGE) + shadowBundle("base", ModPlatform.NEOFORGE) } diff --git a/buildSrc/src/main/java/band/kessoku/gradle/plugin/KesssokuExtension.java b/buildSrc/src/main/java/band/kessoku/gradle/plugin/KesssokuExtension.java index 1807dc8..0769145 100644 --- a/buildSrc/src/main/java/band/kessoku/gradle/plugin/KesssokuExtension.java +++ b/buildSrc/src/main/java/band/kessoku/gradle/plugin/KesssokuExtension.java @@ -1,7 +1,10 @@ package band.kessoku.gradle.plugin; import net.fabricmc.loom.api.LoomGradleExtensionAPI; +import net.fabricmc.loom.api.NeoForgeExtensionAPI; +import net.fabricmc.loom.configuration.FabricApiExtension; import net.fabricmc.loom.util.ModPlatform; +import org.gradle.api.Action; import org.gradle.api.Project; import org.gradle.api.artifacts.Dependency; import org.gradle.api.artifacts.ModuleDependency; @@ -16,19 +19,30 @@ public abstract class KesssokuExtension { @Inject protected abstract Project getProject(); - public void testModuleImpls(List names, String plat) { - names.forEach(name -> testModuleImpl(name, plat)); + public void library(String lib) { + Project project = this.getProject(); + DependencyHandler dependencies = project.getDependencies(); + + Dependency dependency = dependencies.project(Map.of( + "path", lib, + "configuration", "namedElements" + )); + dependencies.add("implementation", dependency); + } + + public void testModules(List names, String plat) { + names.forEach(name -> testModule(name, plat)); } - public void moduleImpls(List names, String plat) { - names.forEach(name -> moduleImpl(name, plat)); + public void modules(List names, String plat) { + names.forEach(name -> module(name, plat)); } public void moduleIncludes(List names, String plat) { names.forEach(name -> moduleInclude(name, plat)); } - public void testModuleImpl(String name, String plat) { + public void testModule(String name, String plat) { Project project = this.getProject(); DependencyHandler dependencies = project.getDependencies(); @@ -37,16 +51,9 @@ public void testModuleImpl(String name, String plat) { "configuration", "namedElements" )); dependencies.add("testImplementation", dependency); - -// LoomGradleExtensionAPI loom = project.getExtensions().getByType(LoomGradleExtensionAPI.class); -// loom.mods(mods -> mods.register("kessoku-" + name + "-" + plat, settings -> { -// Project depProject = project.project(":" + name + "-" + plat); -// SourceSetContainer sourceSets = depProject.getExtensions().getByType(SourceSetContainer.class); -// settings.sourceSet(sourceSets.getByName("main"), depProject); -// })); } - public void moduleImpl(String name, String plat) { + public void module(String name, String plat) { Project project = this.getProject(); DependencyHandler dependencies = project.getDependencies(); @@ -82,7 +89,7 @@ public void moduleInclude(String name, String plat) { })); } - public void commonImpl(String name, ModPlatform platform) { + public void common(String name, ModPlatform platform) { Project project = this.getProject(); DependencyHandler dependencies = project.getDependencies(); @@ -95,7 +102,7 @@ public void commonImpl(String name, ModPlatform platform) { dependencies.add("development" + platform.displayName(), dependency); } - public void shade(String name, ModPlatform platform) { + public void shadowBundle(String name, ModPlatform platform) { Project project = this.getProject(); DependencyHandler dependencies = project.getDependencies(); diff --git a/command/common/build.gradle b/command/common/build.gradle index f0d2cc9..f10e31d 100644 --- a/command/common/build.gradle +++ b/command/common/build.gradle @@ -1,15 +1,10 @@ -import com.google.common.collect.Lists - apply from: rootProject.file("gradle/scripts/klib-common.gradle") group = "band.kessoku.lib.command" base.archivesName = rootProject.name + "-command" +kessoku { + modules(["base", "event-base"], "common") - -dependencies { - kessoku.moduleImpls(["base", "event-base"], "common") - - testImplementation(project(":base-common")) - testImplementation(project(":event-base-common")) + testModules(["base", "event-base"], "common") } \ No newline at end of file diff --git a/command/fabric/build.gradle b/command/fabric/build.gradle index 50ead0c..46fe7b8 100644 --- a/command/fabric/build.gradle +++ b/command/fabric/build.gradle @@ -1,11 +1,13 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-fabric.gradle") group = "band.kessoku.lib.command" base.archivesName = rootProject.name + "-command" -dependencies { - kessoku.moduleImpls(["base", "event-base"], "common") +kessoku { + modules(["base", "event-base"], "common") - common(project(path: ':command-common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':command-common', configuration: 'transformProductionFabric') + common("command", ModPlatform.FABRIC) + shadowBundle("command", ModPlatform.FABRIC) } diff --git a/command/neo/build.gradle b/command/neo/build.gradle index 674b0ef..9b8cb21 100644 --- a/command/neo/build.gradle +++ b/command/neo/build.gradle @@ -1,12 +1,14 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-neo.gradle") group = "band.kessoku.lib.command" base.archivesName = rootProject.name + "-command" -dependencies { - kessoku.moduleImpls(["base", "event-base"], "common") - kessoku.moduleImpl("event-base", "neo") +kessoku { + modules(["base", "event-base"], "common") + module("event-base", "neo") - common(project(path: ':command-common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':command-common', configuration: 'transformProductionNeoForge') + common("command", ModPlatform.NEOFORGE) + shadowBundle("command", ModPlatform.NEOFORGE) } diff --git a/config/common/build.gradle b/config/common/build.gradle index 3174a3d..69d57f6 100644 --- a/config/common/build.gradle +++ b/config/common/build.gradle @@ -3,9 +3,11 @@ apply from: rootProject.file("gradle/scripts/klib-common.gradle") group = "band.kessoku.lib.config" base.archivesName = rootProject.name + "-config" -dependencies { - kessoku.moduleImpls(["base", "platform"], "common") +kessoku { + modules(["base", "platform"], "common") +} +dependencies { implementation(libs.bundles.night.config) implementation(libs.aj4j) } \ No newline at end of file diff --git a/config/fabric/build.gradle b/config/fabric/build.gradle index b401d5a..5e57b3a 100644 --- a/config/fabric/build.gradle +++ b/config/fabric/build.gradle @@ -1,16 +1,19 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-fabric.gradle") -apply plugin: "com.gradleup.shadow" group = "band.kessoku.lib.config" base.archivesName = rootProject.name + "-config" -dependencies { - shadowBundle(libs.aj4j) +kessoku { + modules(["base", "platform"], "common") - kessoku.moduleImpls(["base", "platform"], "common") + common("config", ModPlatform.FABRIC) + shadowBundle("config", ModPlatform.FABRIC) +} - common(project(path: ':config-common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':config-common', configuration: 'transformProductionFabric') +dependencies { + shadowBundle(libs.aj4j) } shadowJar { diff --git a/config/neo/build.gradle b/config/neo/build.gradle index ecf33a0..83d29d1 100644 --- a/config/neo/build.gradle +++ b/config/neo/build.gradle @@ -1,15 +1,19 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-neo.gradle") group = "band.kessoku.lib.config" base.archivesName = rootProject.name + "-config" -dependencies { - shadowBundle(libs.aj4j) +kessoku { + modules(["base", "platform"], "common") - kessoku.moduleImpls(["base", "platform"], "common") + common("config", ModPlatform.NEOFORGE) + shadowBundle("config", ModPlatform.NEOFORGE) +} - common(project(path: ':config-common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':config-common', configuration: 'transformProductionNeoForge') +dependencies { + shadowBundle(libs.aj4j) } shadowJar { diff --git a/entity-events/common/build.gradle b/entity-events/common/build.gradle index 67d75bf..44e97fa 100644 --- a/entity-events/common/build.gradle +++ b/entity-events/common/build.gradle @@ -3,6 +3,10 @@ apply from: rootProject.file("gradle/scripts/klib-common.gradle") group = "band.kessoku.lib.events.entity" base.archivesName = rootProject.name + "-entity-events" +kessoku { + modules(["base", "event-base"], "common") +} + dependencies { - kessoku.moduleImpls(["base", "event-base"], "common") + } diff --git a/entity-events/fabric/build.gradle b/entity-events/fabric/build.gradle index 4e4d95a..67aef1b 100644 --- a/entity-events/fabric/build.gradle +++ b/entity-events/fabric/build.gradle @@ -1,11 +1,17 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-fabric.gradle") group = "band.kessoku.lib.events.entity" base.archivesName = rootProject.name + "-entity-events" +kessoku { + modules(["base", "event-base"], "common") + + common("entity-events", ModPlatform.FABRIC) + shadowBundle("entity-events", ModPlatform.FABRIC) +} + dependencies { - kessoku.moduleImpls(["base", "event-base"], "common") - common(project(path: ':entity-events-common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':entity-events-common', configuration: 'transformProductionFabric') } \ No newline at end of file diff --git a/entity-events/neo/build.gradle b/entity-events/neo/build.gradle index 18a5c65..4a764e0 100644 --- a/entity-events/neo/build.gradle +++ b/entity-events/neo/build.gradle @@ -1,3 +1,5 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-neo.gradle") group = "band.kessoku.lib.events.entity" @@ -7,12 +9,12 @@ loom { //accessWidenerPath = file("src/main/resources/kessoku-entity-events.accesswidener") } -dependencies { - kessoku.moduleImpls(["base", "event-base"], "common") - kessoku.moduleImpl("event-base", "neo") +kessoku { + modules(["base", "event-base"], "common") + module("event-base", "neo") - common(project(path: ':entity-events-common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':entity-events-common', configuration: 'transformProductionNeoForge') + common("entity-events", ModPlatform.NEOFORGE) + shadowBundle("entity-events", ModPlatform.NEOFORGE) } remapJar { diff --git a/entrypoint/common/build.gradle b/entrypoint/common/build.gradle index e8a6a50..5fb240c 100644 --- a/entrypoint/common/build.gradle +++ b/entrypoint/common/build.gradle @@ -3,7 +3,10 @@ apply from: rootProject.file("gradle/scripts/klib-common.gradle") group = "band.kessoku.lib.entrypoint" base.archivesName = rootProject.name + "-entrypoint" +kessoku { + module("base", "common") +} + dependencies { - kessoku.moduleImpl("base", "common") implementation libs.aj4j } diff --git a/entrypoint/fabric/build.gradle b/entrypoint/fabric/build.gradle index 4dc8606..15bfb59 100644 --- a/entrypoint/fabric/build.gradle +++ b/entrypoint/fabric/build.gradle @@ -1,12 +1,17 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-fabric.gradle") group = "band.kessoku.lib.entrypoint" base.archivesName = rootProject.name + "-entrypoint" +kessoku { + module("base", "common") + + common("entrypoint", ModPlatform.FABRIC) + shadowBundle("entrypoint", ModPlatform.FABRIC) +} + dependencies { - kessoku.moduleImpl("base", "common") implementation libs.aj4j - - common(project(path: ':entrypoint-common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':entrypoint-common', configuration: 'transformProductionFabric') } diff --git a/entrypoint/neo/build.gradle b/entrypoint/neo/build.gradle index 2501c1c..1a60333 100644 --- a/entrypoint/neo/build.gradle +++ b/entrypoint/neo/build.gradle @@ -1,11 +1,13 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-neo.gradle") group = "band.kessoku.lib.entrypoint" base.archivesName = rootProject.name + "-entrypoint" -dependencies { - kessoku.moduleImpl("base", "common") +kessoku { + module("base", "common") - common(project(path: ':entrypoint-common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':entrypoint-common', configuration: 'transformProductionNeoForge') + common("entrypoint", ModPlatform.NEOFORGE) + shadowBundle("entrypoint", ModPlatform.NEOFORGE) } diff --git a/event-base/common/build.gradle b/event-base/common/build.gradle index df9d1a1..5b70f62 100644 --- a/event-base/common/build.gradle +++ b/event-base/common/build.gradle @@ -3,6 +3,6 @@ apply from: rootProject.file("gradle/scripts/klib-common.gradle") group = "band.kessoku.lib.event" base.archivesName = rootProject.name + "-event-base" -dependencies { - kessoku.moduleImpl("base", "common") +kessoku { + module("base", "common") } \ No newline at end of file diff --git a/event-base/fabric/build.gradle b/event-base/fabric/build.gradle index 7bab20e..9038232 100644 --- a/event-base/fabric/build.gradle +++ b/event-base/fabric/build.gradle @@ -1,11 +1,13 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-fabric.gradle") group = "band.kessoku.lib.event" base.archivesName = rootProject.name + "-event-base" -dependencies { - kessoku.moduleImpl("base", "common") +kessoku { + module("base", "common") - common(project(path: ':event-base-common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':event-base-common', configuration: 'transformProductionFabric') + common("event-base", ModPlatform.FABRIC) + shadowBundle("event-base", ModPlatform.FABRIC) } diff --git a/event-base/neo/build.gradle b/event-base/neo/build.gradle index 73af993..747c5de 100644 --- a/event-base/neo/build.gradle +++ b/event-base/neo/build.gradle @@ -1,11 +1,13 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-neo.gradle") group = "band.kessoku.lib.event" base.archivesName = rootProject.name + "-event-base" -dependencies { - kessoku.moduleImpl("base", "common") +kessoku { + module("base", "common") - common(project(path: ':event-base-common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':event-base-common', configuration: 'transformProductionNeoForge') + common("event-base", ModPlatform.NEOFORGE) + shadowBundle("event-base", ModPlatform.NEOFORGE) } diff --git a/keybind/common/build.gradle b/keybind/common/build.gradle index d9ae80a..b06b6a4 100644 --- a/keybind/common/build.gradle +++ b/keybind/common/build.gradle @@ -3,6 +3,6 @@ apply from: rootProject.file("gradle/scripts/klib-common.gradle") group = "band.kessoku.lib.keybind" base.archivesName = rootProject.name + "-keybind" -dependencies { - kessoku.moduleImpl("base", "common") +kessoku { + module("base", "common") } diff --git a/keybind/fabric/build.gradle b/keybind/fabric/build.gradle index ba28dd9..d0826ed 100644 --- a/keybind/fabric/build.gradle +++ b/keybind/fabric/build.gradle @@ -1,11 +1,13 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-fabric.gradle") group = "band.kessoku.lib.keybind" base.archivesName = rootProject.name + "-keybind" -dependencies { - kessoku.moduleImpl("base", "common") +kessoku { + module("base", "common") - common(project(path: ':keybind-common', configuration: 'namedElements')) { transitive false } - shadowBundle(project(path: ':keybind-common', configuration: 'transformProductionFabric')) + common("keybind", ModPlatform.FABRIC) + shadowBundle("keybind", ModPlatform.FABRIC) } diff --git a/keybind/neo/build.gradle b/keybind/neo/build.gradle index e6503ce..35a3f79 100644 --- a/keybind/neo/build.gradle +++ b/keybind/neo/build.gradle @@ -1,12 +1,14 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-neo.gradle") group = "band.kessoku.lib.keybind" base.archivesName = rootProject.name + "-keybind" -dependencies { - kessoku.moduleImpl("base", "common") - kessoku.moduleImpl("event-base", "neo") +kessoku { + module("base", "common") + module("event-base", "neo") - common(project(path: ':keybind-common', configuration: 'namedElements')) { transitive false } - shadowBundle(project(path: ':keybind-common', configuration: 'transformProductionNeoForge')) + common("keybind", ModPlatform.NEOFORGE) + shadowBundle("keybind", ModPlatform.NEOFORGE) } diff --git a/lifecycle-events/common/build.gradle b/lifecycle-events/common/build.gradle index 254113f..ab52a22 100644 --- a/lifecycle-events/common/build.gradle +++ b/lifecycle-events/common/build.gradle @@ -3,8 +3,8 @@ apply from: rootProject.file("gradle/scripts/klib-common.gradle") group = "band.kessoku.lib.events.lifecycle" base.archivesName = rootProject.name + "-lifecycle-events" -dependencies { - kessoku.moduleImpls(["base", "event-base"], "common") +kessoku { + modules(["base", "event-base"], "common") - testImplementation(project(":event-base-common")) -} \ No newline at end of file + testModule("event-base", "common") +} diff --git a/lifecycle-events/fabric/build.gradle b/lifecycle-events/fabric/build.gradle index 10e6ce5..b9a3b79 100644 --- a/lifecycle-events/fabric/build.gradle +++ b/lifecycle-events/fabric/build.gradle @@ -1,11 +1,13 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-fabric.gradle") group = "band.kessoku.lib.events.lifecycle" base.archivesName = rootProject.name + "-lifecycle-events" -dependencies { - kessoku.moduleImpls(["base", "event-base"], "common") +kessoku { + modules(["base", "event-base"], "common") - common(project(path: ':lifecycle-events-common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':lifecycle-events-common', configuration: 'transformProductionFabric') + common("lifecycle-events", ModPlatform.FABRIC) + shadowBundle("lifecycle-events", ModPlatform.FABRIC) } diff --git a/lifecycle-events/neo/build.gradle b/lifecycle-events/neo/build.gradle index dfcb2b9..dae86a1 100644 --- a/lifecycle-events/neo/build.gradle +++ b/lifecycle-events/neo/build.gradle @@ -1,3 +1,5 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-neo.gradle") group = "band.kessoku.lib.events.lifecycle" @@ -7,12 +9,12 @@ loom { accessWidenerPath = file("src/main/resources/kessoku-lifecycle-events.accesswidener") } -dependencies { - kessoku.moduleImpls(["base", "event-base"], "common") - kessoku.moduleImpl("event-base", "neo") +kessoku { + modules(["base", "event-base"], "common") + module("event-base", "neo") - common(project(path: ':lifecycle-events-common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':lifecycle-events-common', configuration: 'transformProductionNeoForge') + common("lifecycle-events", ModPlatform.NEOFORGE) + shadowBundle("lifecycle-events", ModPlatform.NEOFORGE) } remapJar { diff --git a/platform/common/build.gradle b/platform/common/build.gradle index 1ff7f8c..186e6f2 100644 --- a/platform/common/build.gradle +++ b/platform/common/build.gradle @@ -3,6 +3,6 @@ apply from: rootProject.file("gradle/scripts/klib-common.gradle") group = "band.kessoku.lib.platform" base.archivesName = rootProject.name + "-platform" -dependencies { - kessoku.moduleImpl("base", "common") -} \ No newline at end of file +kessoku { + module("base", "common") +} diff --git a/platform/fabric/build.gradle b/platform/fabric/build.gradle index fec57bc..45298d9 100644 --- a/platform/fabric/build.gradle +++ b/platform/fabric/build.gradle @@ -1,11 +1,13 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-fabric.gradle") group = "band.kessoku.lib.platform" base.archivesName = rootProject.name + "-platform" -dependencies { - kessoku.moduleImpl("base", "common") +kessoku { + module("base", "common") - common(project(path: ':platform-common', configuration: 'namedElements')) { transitive false } - shadowBundle(project(path: ':platform-common', configuration: 'transformProductionFabric')) + common("platform", ModPlatform.FABRIC) + shadowBundle("platform", ModPlatform.FABRIC) } diff --git a/platform/neo/build.gradle b/platform/neo/build.gradle index b78fb08..6bb585a 100644 --- a/platform/neo/build.gradle +++ b/platform/neo/build.gradle @@ -1,11 +1,13 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-neo.gradle") group = "band.kessoku.lib.platform" base.archivesName = rootProject.name + "-platform" -dependencies { - kessoku.moduleImpl("base", "common") +kessoku { + module("base", "common") - common(project(path: ':platform-common', configuration: 'namedElements')) { transitive false } - shadowBundle(project(path: ':platform-common', configuration: 'transformProductionNeoForge')) + common("platform", ModPlatform.NEOFORGE) + shadowBundle("platform", ModPlatform.NEOFORGE) } diff --git a/registry/common/build.gradle b/registry/common/build.gradle index 673a4c9..6193e55 100644 --- a/registry/common/build.gradle +++ b/registry/common/build.gradle @@ -7,6 +7,6 @@ loom { accessWidenerPath = file("src/main/resources/kessoku-registry.accesswidener") } -dependencies { - kessoku.moduleImpl("base", "common") +kessoku { + module("base", "common") } diff --git a/registry/fabric/build.gradle b/registry/fabric/build.gradle index 153d5ed..9f234bb 100644 --- a/registry/fabric/build.gradle +++ b/registry/fabric/build.gradle @@ -1,3 +1,5 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-fabric.gradle") group = "band.kessoku.lib.registry" @@ -7,9 +9,9 @@ loom { accessWidenerPath = project(":registry-common").loom.accessWidenerPath } -dependencies { - kessoku.moduleImpl("base", "common") +kessoku { + module("base", "common") - common(project(path: ':registry-common', configuration: 'namedElements')) { transitive false } - shadowBundle(project(path: ':registry-common', configuration: 'transformProductionFabric')) + common("registry", ModPlatform.FABRIC) + shadowBundle("registry", ModPlatform.FABRIC) } diff --git a/registry/neo/build.gradle b/registry/neo/build.gradle index 589a242..43ef30f 100644 --- a/registry/neo/build.gradle +++ b/registry/neo/build.gradle @@ -1,3 +1,5 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-neo.gradle") group = "band.kessoku.lib.registry" @@ -7,12 +9,11 @@ loom { accessWidenerPath = project(":registry-common").loom.accessWidenerPath } -dependencies { - kessoku.moduleImpl("base", "common") - kessoku.moduleImpl("event-base", "neo") +kessoku { + module("base", "common") - common(project(path: ':registry-common', configuration: 'namedElements')) { transitive false } - shadowBundle(project(path: ':registry-common', configuration: 'transformProductionNeoForge')) + common("registry", ModPlatform.NEOFORGE) + shadowBundle("registry", ModPlatform.NEOFORGE) } remapJar { diff --git a/wrapper/fabric/build.gradle b/wrapper/fabric/build.gradle index ac5f11e..fba7110 100644 --- a/wrapper/fabric/build.gradle +++ b/wrapper/fabric/build.gradle @@ -1,3 +1,5 @@ +import net.fabricmc.loom.util.ModPlatform + apply from: rootProject.file("gradle/scripts/klib-fabric.gradle") group = "band.kessoku.lib" @@ -5,6 +7,6 @@ base.archivesName = rootProject.name var modules = ["base", "event-base", "lifecycle-events", "platform", "registry"] -dependencies { - kessoku.moduleIncludes(modules, "fabric") +kessoku { + moduleIncludes(modules, ModPlatform.FABRIC.id()) } diff --git a/wrapper/neo/build.gradle b/wrapper/neo/build.gradle index 98e90ec..698f785 100644 --- a/wrapper/neo/build.gradle +++ b/wrapper/neo/build.gradle @@ -5,6 +5,6 @@ base.archivesName = rootProject.name var modules = ["base", "event-base", "lifecycle-events", "platform", "registry"] -dependencies { - kessoku.moduleIncludes(modules, "neo") +kessoku { + moduleIncludes(modules, "neo") }