[build, minecraft] Publishing as Minecraft Fabric mods
This commit is contained in:
@@ -73,7 +73,7 @@ tasks.test {
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("maven") {
|
||||
create<MavenPublication>("lib") {
|
||||
groupId = project.group.toString()
|
||||
artifactId = project.name
|
||||
version = project.version.toString()
|
||||
|
||||
@@ -8,6 +8,8 @@ plugins {
|
||||
|
||||
val expandedSourcesElements = configurations.consumable("expandedSourcesElements") {
|
||||
attributes {
|
||||
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
|
||||
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType.SOURCES))
|
||||
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))
|
||||
}
|
||||
}
|
||||
@@ -15,6 +17,8 @@ val expandedSourcesElements = configurations.consumable("expandedSourcesElements
|
||||
val delombok = tasks.getByName<Delombok>("delombok")
|
||||
|
||||
val sourcesJar by tasks.registering(Jar::class) {
|
||||
group = LifecycleBasePlugin.BUILD_GROUP
|
||||
|
||||
dependsOn(delombok)
|
||||
from(delombok.target)
|
||||
archiveClassifier.set("sources")
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
plugins {
|
||||
`maven-publish`
|
||||
alias(libs.plugins.shadow)
|
||||
id("de.siphalor.tweed5.expanded-sources-jar")
|
||||
id("de.siphalor.tweed5.minecraft.mod.component")
|
||||
}
|
||||
|
||||
tasks.shadowJar {
|
||||
relocate("org.apache.commons", "de.siphalor.tweed5.shadowed.org.apache.commons")
|
||||
}
|
||||
|
||||
val minecraftModJar = tasks.register<Jar>("minecraftModJar") {
|
||||
group = LifecycleBasePlugin.BUILD_GROUP
|
||||
|
||||
from(zipTree(tasks.shadowJar.get().archiveFile))
|
||||
|
||||
destinationDirectory.set(layout.buildDirectory.dir("minecraftModLibs"))
|
||||
}
|
||||
tasks.assemble {
|
||||
dependsOn(minecraftModJar)
|
||||
}
|
||||
|
||||
val minecraftModSourcesJar = tasks.register<Jar>("minecraftModSourcesJar") {
|
||||
group = LifecycleBasePlugin.BUILD_GROUP
|
||||
|
||||
from(zipTree(tasks.named<Jar>("sourcesJar").get().archiveFile))
|
||||
|
||||
archiveClassifier = "sources"
|
||||
destinationDirectory.set(layout.buildDirectory.dir("minecraftModLibs"))
|
||||
}
|
||||
|
||||
artifacts.add("minecraftModElements", minecraftModJar)
|
||||
artifacts.add("minecraftModSourcesElements", minecraftModSourcesJar)
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("minecraftMod") {
|
||||
groupId = "${project.group}.minecraft"
|
||||
artifactId = project.name
|
||||
version = project.version.toString()
|
||||
|
||||
from(components["minecraftMod"])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
plugins {
|
||||
java
|
||||
id("de.siphalor.tweed5.minecraft.mod.base")
|
||||
}
|
||||
|
||||
val processMinecraftModResources = tasks.register<Copy>("processMinecraftModResources") {
|
||||
from(project.layout.settingsDirectory.dir("minecraft/mod-template/resources"))
|
||||
expand(
|
||||
"id" to project.name,
|
||||
"version" to project.version,
|
||||
"name" to properties["minecraft.mod.name"],
|
||||
"description" to properties["minecraft.mod.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)
|
||||
}
|
||||
Reference in New Issue
Block a user