mirror of
https://github.com/architectury/architectury-plugin.git
synced 2026-03-28 04:07:01 -05:00
Add runtime specific artifacts that doesn't include the refmaps
This commit is contained in:
@@ -44,6 +44,11 @@ class ArchitectPlugin : Plugin<Project> {
|
|||||||
project.tasks.register("transformArchitectJar", TransformTask::class.java) {
|
project.tasks.register("transformArchitectJar", TransformTask::class.java) {
|
||||||
it.group = "Architectury"
|
it.group = "Architectury"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
project.tasks.register("transformArchitectJarRuntime", TransformTask::class.java) {
|
||||||
|
it.group = "Architectury"
|
||||||
|
it.addRefmap = false
|
||||||
|
}
|
||||||
|
|
||||||
project.repositories.apply {
|
project.repositories.apply {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ open class ArchitectPluginExtension(val project: Project) {
|
|||||||
project.configurations.create("transformForgeFakeMod")
|
project.configurations.create("transformForgeFakeMod")
|
||||||
}
|
}
|
||||||
project.configurations.create("transformed")
|
project.configurations.create("transformed")
|
||||||
|
project.configurations.create("transformedRuntime")
|
||||||
|
|
||||||
val buildTask = project.tasks.getByName("build")
|
val buildTask = project.tasks.getByName("build")
|
||||||
val jarTask = project.tasks.getByName("jar") {
|
val jarTask = project.tasks.getByName("jar") {
|
||||||
@@ -41,6 +42,17 @@ open class ArchitectPluginExtension(val project: Project) {
|
|||||||
it.archiveClassifier.set("transformed")
|
it.archiveClassifier.set("transformed")
|
||||||
it.input.set(jarTask.archiveFile.get())
|
it.input.set(jarTask.archiveFile.get())
|
||||||
|
|
||||||
|
project.artifacts.add("archives", it)
|
||||||
|
it.dependsOn(jarTask)
|
||||||
|
buildTask.dependsOn(it)
|
||||||
|
it.outputs.upToDateWhen { false }
|
||||||
|
} as TransformTask
|
||||||
|
val transformArchitectRuntimeJarTask = project.tasks.getByName("transformArchitectJarRuntime") {
|
||||||
|
it as TransformTask
|
||||||
|
|
||||||
|
it.archiveClassifier.set("transformedRuntime")
|
||||||
|
it.input.set(jarTask.archiveFile.get())
|
||||||
|
|
||||||
project.artifacts.add("archives", it)
|
project.artifacts.add("archives", it)
|
||||||
it.dependsOn(jarTask)
|
it.dependsOn(jarTask)
|
||||||
buildTask.dependsOn(it)
|
buildTask.dependsOn(it)
|
||||||
@@ -70,9 +82,9 @@ open class ArchitectPluginExtension(val project: Project) {
|
|||||||
val transformForgeFakeModTask = project.tasks.getByName("transformForgeFakeMod") {
|
val transformForgeFakeModTask = project.tasks.getByName("transformForgeFakeMod") {
|
||||||
it as RemapMCPTask
|
it as RemapMCPTask
|
||||||
|
|
||||||
it.input.set(transformArchitectJarTask.archiveFile.get())
|
it.input.set(transformArchitectRuntimeJarTask.archiveFile.get())
|
||||||
it.archiveClassifier.set("transformedForgeFakeMod")
|
it.archiveClassifier.set("transformedForgeFakeMod")
|
||||||
it.dependsOn(transformArchitectJarTask)
|
it.dependsOn(transformArchitectRuntimeJarTask)
|
||||||
buildTask.dependsOn(it)
|
buildTask.dependsOn(it)
|
||||||
it.outputs.upToDateWhen { false }
|
it.outputs.upToDateWhen { false }
|
||||||
} as RemapMCPTask
|
} as RemapMCPTask
|
||||||
@@ -105,6 +117,13 @@ open class ArchitectPluginExtension(val project: Project) {
|
|||||||
"builtBy" to transformArchitectJarTask
|
"builtBy" to transformArchitectJarTask
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
it.add(
|
||||||
|
"transformedRuntime", mapOf(
|
||||||
|
"file" to transformArchitectRuntimeJarTask.archiveFile.get().asFile,
|
||||||
|
"type" to "jar",
|
||||||
|
"builtBy" to transformArchitectRuntimeJarTask
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,6 @@ import org.objectweb.asm.Opcodes
|
|||||||
import org.objectweb.asm.tree.AnnotationNode
|
import org.objectweb.asm.tree.AnnotationNode
|
||||||
import org.objectweb.asm.tree.ClassNode
|
import org.objectweb.asm.tree.ClassNode
|
||||||
import org.objectweb.asm.tree.MethodInsnNode
|
import org.objectweb.asm.tree.MethodInsnNode
|
||||||
import org.zeroturnaround.zip.ByteSource
|
|
||||||
import org.zeroturnaround.zip.ZipUtil
|
import org.zeroturnaround.zip.ZipUtil
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import java.nio.file.Path
|
|||||||
|
|
||||||
open class TransformTask : Jar() {
|
open class TransformTask : Jar() {
|
||||||
val input: RegularFileProperty = GradleSupport.getFileProperty(project)
|
val input: RegularFileProperty = GradleSupport.getFileProperty(project)
|
||||||
|
var addRefmap = true
|
||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
fun doTask() {
|
fun doTask() {
|
||||||
@@ -22,9 +23,16 @@ open class TransformTask : Jar() {
|
|||||||
project.logger.lifecycle(":transforming " + input.fileName + " => " + output.fileName)
|
project.logger.lifecycle(":transforming " + input.fileName + " => " + output.fileName)
|
||||||
Transform.transform(input, output, transformExpectPlatform())
|
Transform.transform(input, output, transformExpectPlatform())
|
||||||
|
|
||||||
val loomExtension = project.extensions.getByType(LoomGradleExtension::class.java)
|
if (addRefmap) {
|
||||||
if (MixinRefmapHelper.addRefmapName(loomExtension.getRefmapName(), loomExtension.mixinJsonVersion, output)) {
|
val loomExtension = project.extensions.getByType(LoomGradleExtension::class.java)
|
||||||
project.logger.debug("Transformed mixin reference maps in output JAR!")
|
if (MixinRefmapHelper.addRefmapName(
|
||||||
|
loomExtension.getRefmapName(),
|
||||||
|
loomExtension.mixinJsonVersion,
|
||||||
|
output
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
project.logger.debug("Transformed mixin reference maps in output JAR!")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user