Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 @@ -66,4 +66,6 @@ abstract class PaperweightCoreExtension @Inject constructor(objects: ObjectFacto
fun updatingMinecraft(action: Action<UpdatingMinecraftExtension>) {
action.execute(updatingMinecraft)
}

val validateATs: Property<Boolean> = objects.property<Boolean>().convention(true)
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,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(),
)
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 = true,
)
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ abstract class PaperweightPatcherExtension @Inject constructor(private val objec

val gitFilePatches: Property<Boolean> = objects.property<Boolean>().convention(false)
val filterPatches: Property<Boolean> = objects.property<Boolean>().convention(true)
val validateATs: Property<Boolean> = objects.property<Boolean>().convention(true)

val upstreams: NamedDomainObjectContainer<UpstreamConfig> = objects.domainObjectContainer(UpstreamConfig::class) {
objects.newInstance(it, true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies {
}

paperweight {
validateATs = false
if (fake) {
// use fake mojang data for testing
minecraftVersion = 'fake'
Expand Down
Loading