Skip to content

Commit

Permalink
Update transformers to 5.2.77
Browse files Browse the repository at this point in the history
  • Loading branch information
shedaniel committed Nov 14, 2023
1 parent 0a37a6b commit c3b40e0
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ loom_version_010Legacy=0.10.0.171
loom_version_010=0.10.0.188
loom_version_011=0.11.0.217
loom_version_11=1.1.313
transformer_version=5.2.75
transformer_version=5.2.77
base_version=3.4
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import java.util.jar.JarOutputStream
import java.util.jar.Manifest

open class ArchitectPluginExtension(val project: Project) {
var transformerVersion = "5.2.75"
var transformerVersion = "5.2.77"
var injectablesVersion = "1.0.10"
var minecraft = ""
private var compileOnly = false
Expand Down Expand Up @@ -87,7 +87,7 @@ open class ArchitectPluginExtension(val project: Project) {
}
}
}

fun compileOnly() {
if (compileOnly) {
throw IllegalStateException("compileOnly() can only be called once for project ${project.path}!")
Expand All @@ -98,16 +98,21 @@ open class ArchitectPluginExtension(val project: Project) {
}

fun properties(platform: String): Map<String, String> {
return mutableMapOf(
val map = mutableMapOf(
BuiltinProperties.MIXIN_MAPPINGS to loom.allMixinMappings.joinToString(File.pathSeparator),
BuiltinProperties.INJECT_INJECTABLES to injectInjectables.toString(),
BuiltinProperties.UNIQUE_IDENTIFIER to project.projectUniqueIdentifier(),
BuiltinProperties.COMPILE_CLASSPATH to getCompileClasspath().joinToString(File.pathSeparator),
BuiltinProperties.MAPPINGS_WITH_SRG to loom.tinyMappingsWithSrg.toString(),
BuiltinProperties.PLATFORM_NAME to platform,
BuiltinProperties.REFMAP_NAME to loom.refmapName,
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() {
Expand Down Expand Up @@ -145,7 +150,7 @@ open class ArchitectPluginExtension(val project: Project) {

fun transform(name: String, action: Action<Transform>) {
transforms.getOrPut(name) {
Transform(project, "development" + name.capitalize()).also { transform ->
Transform(project, "development" + (if (name == "neoforge") "NeoForge" else name.capitalize())).also { transform ->
if (!compileOnly) {
project.configurations.maybeCreate(transform.devConfigName)
}
Expand Down Expand Up @@ -233,6 +238,11 @@ open class ArchitectPluginExtension(val project: Project) {
loader(ModLoader.FORGE, action)
}

@JvmOverloads
fun neoForge(action: Action<Transform> = Action {}) {
loader(ModLoader.NEOFORGE, action)
}

@JvmOverloads
fun loader(id: String, action: Action<Transform> = Action {}) {
loader(ModLoader.valueOf(id), action)
Expand Down
36 changes: 34 additions & 2 deletions src/main/kotlin/dev/architectury/plugin/ModLoader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import dev.architectury.plugin.loom.LoomInterface
import dev.architectury.plugin.transformers.AddRefmapName
import dev.architectury.transformer.transformers.*

class ModLoader(
open class ModLoader(
val id: String,
val transformDevelopment: Transform.() -> Unit,
val transformProduction: TransformingTask.(loom: LoomInterface) -> Unit,
Expand All @@ -13,7 +13,7 @@ class ModLoader(
LOADERS[id] = this
}

val titledId = id.capitalize()
open val titledId = id.capitalize()

companion object {
fun valueOf(id: String): ModLoader =
Expand Down Expand Up @@ -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(
id = "quilt",
transformDevelopment = {
Expand Down

0 comments on commit c3b40e0

Please sign in to comment.