Skip to content

Commit

Permalink
Include mappings/mappings.tiny file
Browse files Browse the repository at this point in the history
  • Loading branch information
Su5eD committed Jul 28, 2024
1 parent e5683fb commit 8a83642
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import net.fabricmc.loom.util.Constants
import net.fabricmc.loom.util.download.Download
import net.fabricmc.loom.util.download.DownloadBuilder
import net.fabricmc.loom.util.srg.Tsrg2Writer
import net.fabricmc.lorenztiny.TinyMappingsWriter
import net.fabricmc.mappingio.MappingReader
import net.fabricmc.mappingio.MappingWriter
import net.fabricmc.mappingio.adapter.*
import net.fabricmc.mappingio.format.MappingFormat
import net.fabricmc.mappingio.tree.MemoryMappingTree
import java.nio.file.FileSystems
import java.nio.file.StandardOpenOption
Expand Down Expand Up @@ -169,10 +172,23 @@ val createMappings by tasks.registering(GenerateMergedMappingsTask::class) {
inputMojangMappings.set { downloadMojmaps.get().extra["outputFile"] as File }
}

val createTinyMappings by tasks.registering {
dependsOn(createMappings)
val output = layout.buildDirectory.dir(name).get().file("output.tiny")
outputs.file(output)

doFirst {
val mappings = MemoryMappingTree()
MappingReader.read(createMappings.get().outputFile.get().asFile.toPath(), mappings)
mappings.accept(MappingWriter.create(output.asFile.toPath(), MappingFormat.TINY_FILE))
}
}

tasks {
setOf(jar, shadowJar).forEach { provider ->
provider.configure {
from(createMappings.flatMap { it.outputFile }) { rename { "mappings.tsrg" } }
from(createTinyMappings.map { it.outputs.files.singleFile }) { rename { "mappings/mappings.tiny" } }
manifest.attributes(
"FMLModType" to "LIBRARY",
"Automatic-Module-Name" to "net.fabricmc.loader",
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ loom.platform=neoforge

versionMc=1.21
versionForge=21.0.55-beta
versionLoaderUpstream=0.15.10
versionLoaderUpstream=0.16.0
versionYarn=1.21-rc1+build.1

0 comments on commit 8a83642

Please sign in to comment.