Update transformers to 5.2.77

This commit is contained in:
shedaniel
2023-11-15 01:25:19 +08:00
parent 0a37a6b6ed
commit c3b40e0a6c
3 changed files with 51 additions and 9 deletions

View File

@@ -5,5 +5,5 @@ loom_version_010Legacy=0.10.0.171
loom_version_010=0.10.0.188 loom_version_010=0.10.0.188
loom_version_011=0.11.0.217 loom_version_011=0.11.0.217
loom_version_11=1.1.313 loom_version_11=1.1.313
transformer_version=5.2.75 transformer_version=5.2.77
base_version=3.4 base_version=3.4

View File

@@ -30,7 +30,7 @@ import java.util.jar.JarOutputStream
import java.util.jar.Manifest import java.util.jar.Manifest
open class ArchitectPluginExtension(val project: Project) { open class ArchitectPluginExtension(val project: Project) {
var transformerVersion = "5.2.75" var transformerVersion = "5.2.77"
var injectablesVersion = "1.0.10" var injectablesVersion = "1.0.10"
var minecraft = "" var minecraft = ""
private var compileOnly = false private var compileOnly = false
@@ -87,7 +87,7 @@ open class ArchitectPluginExtension(val project: Project) {
} }
} }
} }
fun compileOnly() { fun compileOnly() {
if (compileOnly) { if (compileOnly) {
throw IllegalStateException("compileOnly() can only be called once for project ${project.path}!") throw IllegalStateException("compileOnly() can only be called once for project ${project.path}!")
@@ -98,16 +98,21 @@ open class ArchitectPluginExtension(val project: Project) {
} }
fun properties(platform: String): Map<String, String> { fun properties(platform: String): Map<String, String> {
return mutableMapOf( val map = mutableMapOf(
BuiltinProperties.MIXIN_MAPPINGS to loom.allMixinMappings.joinToString(File.pathSeparator), BuiltinProperties.MIXIN_MAPPINGS to loom.allMixinMappings.joinToString(File.pathSeparator),
BuiltinProperties.INJECT_INJECTABLES to injectInjectables.toString(), BuiltinProperties.INJECT_INJECTABLES to injectInjectables.toString(),
BuiltinProperties.UNIQUE_IDENTIFIER to project.projectUniqueIdentifier(), BuiltinProperties.UNIQUE_IDENTIFIER to project.projectUniqueIdentifier(),
BuiltinProperties.COMPILE_CLASSPATH to getCompileClasspath().joinToString(File.pathSeparator), BuiltinProperties.COMPILE_CLASSPATH to getCompileClasspath().joinToString(File.pathSeparator),
BuiltinProperties.MAPPINGS_WITH_SRG to loom.tinyMappingsWithSrg.toString(),
BuiltinProperties.PLATFORM_NAME to platform, BuiltinProperties.PLATFORM_NAME to platform,
BuiltinProperties.REFMAP_NAME to loom.refmapName,
BuiltinProperties.MCMETA_VERSION to "4" BuiltinProperties.MCMETA_VERSION to "4"
) )
if (platform != "neoforge") {
map[BuiltinProperties.REFMAP_NAME] = loom.refmapName
map[BuiltinProperties.MAPPINGS_WITH_SRG] = loom.tinyMappingsWithSrg.toString()
}
return map
} }
fun prepareTransformer() { fun prepareTransformer() {
@@ -145,7 +150,7 @@ open class ArchitectPluginExtension(val project: Project) {
fun transform(name: String, action: Action<Transform>) { fun transform(name: String, action: Action<Transform>) {
transforms.getOrPut(name) { transforms.getOrPut(name) {
Transform(project, "development" + name.capitalize()).also { transform -> Transform(project, "development" + (if (name == "neoforge") "NeoForge" else name.capitalize())).also { transform ->
if (!compileOnly) { if (!compileOnly) {
project.configurations.maybeCreate(transform.devConfigName) project.configurations.maybeCreate(transform.devConfigName)
} }
@@ -233,6 +238,11 @@ open class ArchitectPluginExtension(val project: Project) {
loader(ModLoader.FORGE, action) loader(ModLoader.FORGE, action)
} }
@JvmOverloads
fun neoForge(action: Action<Transform> = Action {}) {
loader(ModLoader.NEOFORGE, action)
}
@JvmOverloads @JvmOverloads
fun loader(id: String, action: Action<Transform> = Action {}) { fun loader(id: String, action: Action<Transform> = Action {}) {
loader(ModLoader.valueOf(id), action) loader(ModLoader.valueOf(id), action)

View File

@@ -4,7 +4,7 @@ import dev.architectury.plugin.loom.LoomInterface
import dev.architectury.plugin.transformers.AddRefmapName import dev.architectury.plugin.transformers.AddRefmapName
import dev.architectury.transformer.transformers.* import dev.architectury.transformer.transformers.*
class ModLoader( open class ModLoader(
val id: String, val id: String,
val transformDevelopment: Transform.() -> Unit, val transformDevelopment: Transform.() -> Unit,
val transformProduction: TransformingTask.(loom: LoomInterface) -> Unit, val transformProduction: TransformingTask.(loom: LoomInterface) -> Unit,
@@ -13,7 +13,7 @@ class ModLoader(
LOADERS[id] = this LOADERS[id] = this
} }
val titledId = id.capitalize() open val titledId = id.capitalize()
companion object { companion object {
fun valueOf(id: String): ModLoader = fun valueOf(id: String): ModLoader =
@@ -81,6 +81,38 @@ class ModLoader(
} }
) )
val NEOFORGE = object : ModLoader(
id = "neoforge",
transformDevelopment = {
add(TransformExpectPlatform::class.java) { file ->
this[BuiltinProperties.UNIQUE_IDENTIFIER] = projectGeneratedPackage(project, file)
}
add(RemapInjectables::class.java) { file ->
this[BuiltinProperties.UNIQUE_IDENTIFIER] = projectGeneratedPackage(project, file)
}
this += TransformPlatformOnly::class.java
this += TransformNeoForgeAnnotations::class.java
this += TransformNeoForgeEnvironment::class.java
this += GenerateFakeNeoForgeMod::class.java
},
transformProduction = { loom ->
add(TransformExpectPlatform()) { file ->
this[BuiltinProperties.UNIQUE_IDENTIFIER] = projectGeneratedPackage(project, file)
}
add(RemapInjectables()) { file ->
this[BuiltinProperties.UNIQUE_IDENTIFIER] = projectGeneratedPackage(project, file)
}
this += TransformPlatformOnly()
this += TransformNeoForgeAnnotations()
this += TransformNeoForgeEnvironment()
}
) {
override val titledId: String
get() = "NeoForge"
}
val QUILT = ModLoader( val QUILT = ModLoader(
id = "quilt", id = "quilt",
transformDevelopment = { transformDevelopment = {