Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,6 @@ abstract class PaperweightCoreExtension @Inject constructor(objects: ObjectFacto
fun updatingMinecraft(action: Action<UpdatingMinecraftExtension>) {
action.execute(updatingMinecraft)
}

val validateAts: Property<Boolean> = objects.property<Boolean>().convention(false)
Comment thread
Toffikk marked this conversation as resolved.
Outdated
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class CoreTasks(
atFile.set(mergePaperATs.flatMap { it.outputFile })
ats.jstClasspath.from(project.configurations.named(MACHE_MINECRAFT_LIBRARIES_CONFIG))
ats.jst.from(project.configurations.named(JST_CONFIG))
validateAts.set(project.coreExt.validateAts)
}

val extractMacheSources by tasks.registering(ExtractMinecraftSources::class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import io.papermc.paperweight.core.tasks.patching.ApplyFilePatches
import io.papermc.paperweight.core.tasks.patching.ApplyFilePatchesFuzzy
import io.papermc.paperweight.core.tasks.patching.FixupFilePatches
import io.papermc.paperweight.core.tasks.patching.RebuildFilePatches
import io.papermc.paperweight.core.util.coreExt
import io.papermc.paperweight.tasks.*
import io.papermc.paperweight.util.*
import io.papermc.paperweight.util.constants.*
Expand Down Expand Up @@ -171,6 +172,7 @@ class MinecraftPatchingTasks(
atFile.set(mergeCollectedAts.flatMap { it.outputFile })
ats.jst.from(project.configurations.named(JST_CONFIG))
ats.jstClasspath.from(project.configurations.named(MACHE_MINECRAFT_LIBRARIES_CONFIG))
validateAts.set(project.coreExt.validateAts)
}

applySourcePatches.configure {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ abstract class SetupForkMinecraftSources : JavaLauncherTask() {
@get:Optional
abstract val atFile: RegularFileProperty

@get:Input
abstract val validateAts: Property<Boolean>

@get:Optional
@get:InputDirectory
abstract val libraryImports: DirectoryProperty
Expand Down Expand Up @@ -86,6 +89,7 @@ abstract class SetupForkMinecraftSources : JavaLauncherTask() {
outputDir.path,
atFile.path,
atWorkingDir.path,
validate = validateAts.get(),
)
commitAndTag(git, "ATs", "${identifier.get()} ATs")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ abstract class SetupMinecraftSources : JavaLauncherZippedTask() {
@get:Input
abstract val oldPaperCommit: Property<String>

@get:Optional
@get:Input
abstract val validateAts: Property<Boolean>

@get:Nested
val ats: ApplySourceATs = objects.newInstance()

Expand Down Expand Up @@ -182,6 +186,7 @@ abstract class SetupMinecraftSources : JavaLauncherZippedTask() {
outputPath,
atFile.path,
atWorkingDir.path,
validate = validateAts.get(),
Comment thread
Toffikk marked this conversation as resolved.
Outdated
)
if (!oldPaperCommit.isPresent) {
commitAndTag(git, "ATs", "paper ATs")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ abstract class RebuildFilePatches : JavaLauncherTask() {
at,
temporaryDir.toPath().resolve("jst_work"),
singleFile = true,
validate = false,
Comment thread
Toffikk marked this conversation as resolved.
Outdated
)
println("NEW: " + decomp.readText())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ abstract class ApplySourceATs {
atFile: Path,
workDir: Path,
singleFile: Boolean = false,
validate: Boolean,
) {
workDir.deleteRecursive()
workDir.createDirectories()
Expand All @@ -61,7 +62,7 @@ abstract class ApplySourceATs {
workDir,
workDir.resolve("log.txt"),
jvmArgs = listOf("-Xmx${memory.get()}"),
args = jstArgs(input, output, atFile, singleFile).toTypedArray()
args = jstArgs(input, output, atFile, singleFile, validate).toTypedArray()
)
}

Expand All @@ -70,16 +71,18 @@ abstract class ApplySourceATs {
outputDir: Path,
atFile: Path,
singleFile: Boolean = false,
validate: Boolean,
): List<String> {
val format = if (singleFile) "FILE" else "FOLDER"
val validation = if (validate) "ERROR" else "LOG"
return listOf(
"--in-format=$format",
"--out-format=$format",
"--enable-accesstransformers",
"--access-transformer=$atFile",
"--access-transformer-inherit-method=true",
"--hidden-prefix=.git",
// "--access-transformer-validation=ERROR",
"--access-transformer-validation=$validation",
*jstClasspath.files.map { "--classpath=${it.absolutePath}" }.toTypedArray(),
inputDir.absolutePathString(),
outputDir.absolutePathString(),
Expand Down
Loading