[*] Introduce Fabric helper and adjust a bunch of stuff
This commit is contained in:
@@ -7,7 +7,7 @@ plugins {
|
||||
group = "de.siphalor.tweed5"
|
||||
|
||||
dependencies {
|
||||
implementation(project(":helpers"))
|
||||
implementation(project(":tweed5-conventions-helpers"))
|
||||
implementation(pluginMarker(libs.plugins.lombok))
|
||||
implementation(pluginMarker(libs.plugins.shadow))
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ plugins {
|
||||
`java-gradle-plugin`
|
||||
}
|
||||
|
||||
group = "de.siphalor.tweed5"
|
||||
|
||||
gradlePlugin {
|
||||
plugins.register("minecraftModComponent") {
|
||||
id = "de.siphalor.tweed5.minecraft.mod.component"
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ dependencyResolutionManagement {
|
||||
}
|
||||
}
|
||||
|
||||
include("helpers")
|
||||
include(":tweed5-conventions-helpers")
|
||||
project(":tweed5-conventions-helpers").projectDir = file("helpers")
|
||||
|
||||
rootProject.name = "tweed5-conventions"
|
||||
|
||||
@@ -9,8 +9,8 @@ plugins {
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.toVersion(libs.versions.java.main.get())
|
||||
targetCompatibility = JavaVersion.toVersion(libs.versions.java.main.get())
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
val testAgent = configurations.dependencyScope("mockitoAgent")
|
||||
|
||||
@@ -6,14 +6,40 @@ plugins {
|
||||
id("de.siphalor.tweed5.minecraft.mod.component")
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
tasks.shadowJar {
|
||||
relocate("org.apache.commons", "de.siphalor.tweed5.shadowed.org.apache.commons")
|
||||
}
|
||||
|
||||
val processMinecraftModResources = tasks.register<Sync>("processMinecraftModResources") {
|
||||
inputs.property("id", project.name)
|
||||
inputs.property("version", project.version)
|
||||
inputs.property("name", properties["module.name"])
|
||||
inputs.property("description", properties["module.description"])
|
||||
inputs.property("repoUrl", properties["git.url"])
|
||||
|
||||
from(project.layout.settingsDirectory.dir("../tweed5-minecraft/mod-template/resources"))
|
||||
expand(mapOf(
|
||||
"id" to project.name.replace('-', '_'),
|
||||
"version" to project.version,
|
||||
"name" to properties["module.name"],
|
||||
"description" to properties["module.description"],
|
||||
"repoUrl" to properties["git.url"],
|
||||
))
|
||||
into(project.layout.buildDirectory.dir("minecraftModResources"))
|
||||
}
|
||||
|
||||
val minecraftModJar = tasks.register<Jar>("minecraftModJar") {
|
||||
group = LifecycleBasePlugin.BUILD_GROUP
|
||||
|
||||
dependsOn(processMinecraftModResources)
|
||||
|
||||
from(zipTree(tasks.shadowJar.get().archiveFile))
|
||||
from(project.layout.buildDirectory.dir("minecraftModResources"))
|
||||
|
||||
destinationDirectory.set(layout.buildDirectory.dir("minecraftModLibs"))
|
||||
}
|
||||
@@ -24,11 +50,15 @@ tasks.assemble {
|
||||
val minecraftModSourcesJar = tasks.register<Jar>("minecraftModSourcesJar") {
|
||||
group = LifecycleBasePlugin.BUILD_GROUP
|
||||
|
||||
dependsOn(processMinecraftModResources)
|
||||
|
||||
from(zipTree(tasks.named<Jar>("sourcesJar").get().archiveFile))
|
||||
from(project.layout.buildDirectory.dir("minecraftModResources"))
|
||||
|
||||
archiveClassifier = "sources"
|
||||
destinationDirectory.set(layout.buildDirectory.dir("minecraftModLibs"))
|
||||
}
|
||||
|
||||
artifacts.add("minecraftModElements", minecraftModJar)
|
||||
artifacts.add("minecraftModApiElements", minecraftModJar)
|
||||
artifacts.add("minecraftModSourcesElements", minecraftModSourcesJar)
|
||||
|
||||
@@ -4,32 +4,6 @@ plugins {
|
||||
id("de.siphalor.tweed5.minecraft.mod.base")
|
||||
}
|
||||
|
||||
val processMinecraftModResources = tasks.register<Copy>("processMinecraftModResources") {
|
||||
inputs.property("id", project.name)
|
||||
inputs.property("version", project.version)
|
||||
inputs.property("name", properties["module.name"])
|
||||
inputs.property("description", properties["module.description"])
|
||||
|
||||
from(project.layout.settingsDirectory.dir("../tweed5-minecraft/mod-template/resources"))
|
||||
expand(mapOf(
|
||||
"id" to project.name,
|
||||
"version" to project.version,
|
||||
"name" to properties["module.name"],
|
||||
"description" to properties["module.description"]
|
||||
))
|
||||
into(project.layout.buildDirectory.dir("minecraftModResources"))
|
||||
}
|
||||
|
||||
tasks.named<Jar>("minecraftModJar") {
|
||||
from(project.layout.buildDirectory.dir("minecraftModResources"))
|
||||
dependsOn(processMinecraftModResources)
|
||||
}
|
||||
|
||||
tasks.named<Jar>("minecraftModSourcesJar") {
|
||||
from(project.layout.buildDirectory.dir("minecraftModResources"))
|
||||
dependsOn(processMinecraftModResources)
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("minecraftMod") {
|
||||
|
||||
Reference in New Issue
Block a user