Skip to content

Commit

Permalink
update restamp to make cb patch remap work again
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniDigger committed Jan 14, 2024
1 parent 5ceb230 commit a1590bf
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ ehthumbs_vista.db
!gradle-wrapper.ja

/test/
/testpaper/
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ cadix-lorenz-asm = { module = "org.cadixdev:lorenz-asm", version.ref = "lorenz"
cadix-lorenz-proguard = { module = "org.cadixdev:lorenz-io-proguard", version.ref = "lorenz" }
cadix-atlas = "org.cadixdev:atlas:0.2.1"
cadix-at = "org.cadixdev:at:0.1.0-rc1"
# cadix-mercury = "org.cadixdev:mercury:0.1.1-paperweight-local-SNAPSHOT" todo local mods for patch remapping
cadix-mercury = "org.cadixdev:mercury:0.1.1-paperweight-SNAPSHOT"
cadix-mercury = "org.cadixdev:mercury:0.1.1-paperweight-local-SNAPSHOT" # todo local mods for patch remapping
#cadix-mercury = "org.cadixdev:mercury:0.1.1-paperweight-SNAPSHOT"
cadix-bombe-jar = "org.cadixdev:bombe-jar:0.4.4"

hypo-model = { module = "dev.denwav.hypo:hypo-model", version.ref = "hypo" }
Expand All @@ -46,7 +46,7 @@ serialize-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json",

codebook = "io.papermc.codebook:codebook:1.0.8"

restamp = "io.papermc.restamp:restamp:1.0.0"
restamp = "io.papermc.restamp:restamp:1.1.0"

# test
mockk = "io.mockk:mockk:1.13.8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ open class SoftSpoonTasks(
// craftBukkit.set(allTasks.patchCraftBukkit.flatMap { it.outputDir })
craftBukkit.set(project.layout.cache.resolve("paperweight/taskCache/patchCraftBukkit.repo"))
outputPatchDir.set(project.layout.projectDirectory.dir("patches/remapped-cb"))
// mappingsFile.set(allTasks.patchMappings.flatMap { it.outputMappings })
// mappingsFile.set(generatePatchRemapMappings.flatMap { it.patchRemapMappings })
mappingsFile.set(layout.cache.resolve(SPIGOT_MOJANG_PARCHMENT_MAPPINGS))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ abstract class SetupVanilla : BaseTask() {
val configuration = RestampContextConfiguration.builder()
.accessTransformers(ats.convertToPath(), AccessTransformFormats.FML)
.sourceRoot(outputPath)
.sourceFilesFromAccessTransformers()
.sourceFilesFromAccessTransformers(false)
.classpath(classPath)
.executionContext(InMemoryExecutionContext { it.printStackTrace() })
.failWithNotApplicableAccessTransformers()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ abstract class RemapCBPatches : BaseTask() {
val mappings = MappingFormats.TINY.read(mappingsFile.convertToPath(), SPIGOT_NAMESPACE, NEW_DEOBF_NAMESPACE)

val configFiles = project.project(":paper-server").configurations["runtimeClasspath"].resolve().map { it.toPath() }
val classpath = configFiles + listOf(
val classpath = (configFiles + listOf(
project.project(":paper-api").projectDir.toPath().resolve("src/main/java"),
project.file(".gradle/caches/paperweight/taskCache/spigotRemapJar.jar").toPath(),
Path.of("C:\\Users\\Martin\\.m2\\repository\\org\\jetbrains\\annotations\\24.0.1\\annotations-24.0.1.jar")
)
)).filter { it.exists() }

val merc = Mercury()
merc.classPath.addAll(classpath)
Expand All @@ -75,13 +75,14 @@ abstract class RemapCBPatches : BaseTask() {
MercuryRemapper.create(mappings)
)
)
merc.sourceCompatibility = "17"
merc.isGracefulClasspathChecks = true
merc.rewrite(craftBukkit.convertToPath().resolve("src/main/java"), workDir)

val inputDir = workDir
val baseDir = Path.of("D:\\IdeaProjects\\Paper\\.gradle\\caches\\paperweight\\mache\\dum")
val baseDir = base.convertToPath()

val patchesCreated = baseDir.walk()
val patchesCreated = baseDir.walk().filter { it.isRegularFile() && it.name.endsWith(".java") }
.sumOf {
diffFile(inputDir, baseDir, it.relativeTo(baseDir).toString().replace("\\", "/"), patches)
}
Expand Down

0 comments on commit a1590bf

Please sign in to comment.