[*] Introduce Fabric helper and adjust a bunch of stuff

This commit is contained in:
2025-10-26 22:33:02 +01:00
parent eb728df704
commit 93117eb5c5
23 changed files with 516 additions and 38 deletions

View File

@@ -3,6 +3,8 @@ plugins {
`java-gradle-plugin`
}
group = "de.siphalor.tweed5"
gradlePlugin {
plugins.register("minecraftModComponent") {
id = "de.siphalor.tweed5.minecraft.mod.component"

View File

@@ -43,6 +43,20 @@ abstract class MinecraftModComponentPlugin : Plugin<Project> {
}
}
val modApiElementsConfiguration = project.configurations.consumable("minecraftModApiElements") {
attributes {
attribute(MinecraftModded.MINECRAFT_MODDED_ATTRIBUTE, objectFactory.named(MinecraftModded.MODDED))
attribute(Category.CATEGORY_ATTRIBUTE, objectFactory.named(Category.LIBRARY))
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objectFactory.named(LibraryElements.JAR))
attribute(Bundling.BUNDLING_ATTRIBUTE, objectFactory.named(Bundling.SHADOWED))
attribute(Usage.USAGE_ATTRIBUTE, objectFactory.named(Usage.JAVA_API))
project.afterEvaluate {
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, targetJvmVersion.get().toInt())
}
}
}
val apiConfiguration = project.configurations.named("api")
val modSourcesElementsConfiguration = project.configurations.consumable("minecraftModSourcesElements") {
extendsFrom(apiConfiguration.get())
@@ -57,6 +71,9 @@ abstract class MinecraftModComponentPlugin : Plugin<Project> {
modComponent.addVariantsFromConfiguration(modElementsConfiguration.get()) {
mapToMavenScope("runtime")
}
modComponent.addVariantsFromConfiguration(modApiElementsConfiguration.get()) {
mapToMavenScope("compile")
}
modComponent.addVariantsFromConfiguration(modSourcesElementsConfiguration.get()) {
mapToOptional()
}