diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6595c3569..66582e3c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,7 @@ on: push: branches: [ "ver/*", "dev/*", "feat/**/*" ] paths: - - "**.patch" + - "*.patch" - "gradle.properties" workflow_dispatch: diff --git a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/AlwaysUpToDate.kt b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/AlwaysUpToDate.kt index 3e719356c..ac16f4f37 100644 --- a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/AlwaysUpToDate.kt +++ b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/AlwaysUpToDate.kt @@ -4,11 +4,12 @@ import io.papermc.paperweight.util.Git import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.provider.Property -import org.plazmamc.alwaysuptodate.utils.* -import org.plazmamc.alwaysuptodate.tasks.CheckUpstreamCommit -import org.plazmamc.alwaysuptodate.tasks.SimpleUpstreamUpdateTask -import org.plazmamc.alwaysuptodate.tasks.CreateCompareComment -import org.plazmamc.alwaysuptodate.tasks.PurpurUpdateTask +import org.gradle.api.tasks.TaskProvider +import org.plazmamc.alwaysuptodate.tasks.* +import org.plazmamc.alwaysuptodate.utils.CheckGitTask +import org.plazmamc.alwaysuptodate.utils.configureTask +import org.plazmamc.alwaysuptodate.utils.flatten +import org.plazmamc.alwaysuptodate.utils.registerTask class AlwaysUpToDate : Plugin { @@ -23,8 +24,8 @@ class AlwaysUpToDate : Plugin { fun generateTasks( upstream: String, provider: AlwaysUpToDateExtension.() -> Pair, Property>, Property> - ) { - registerTask("check$upstream", "Check if the $upstream commit is up to date") { + ): Triple, TaskProvider, TaskProvider> { + val i = registerTask("check$upstream", "Check if the $upstream commit is up to date") { dependsOn(git) val (repo, ref, commitProperty) = extension.provider().flatten() this.repo.set(repo) @@ -32,7 +33,7 @@ class AlwaysUpToDate : Plugin { this.commitPropertyName.set(commitProperty) } - registerTask("compare$upstream", "Create a comment comparing the $upstream commit") { + val j = registerTask("compare$upstream", "Create a comment comparing the $upstream commit") { dependsOn(git) val (repo, ref, commitProperty) = extension.provider().flatten() this.repo.set(repo) @@ -41,7 +42,10 @@ class AlwaysUpToDate : Plugin { this.clear.set(false) } - registerTask("cleanCompare$upstream", "Create a comment comparing the $upstream commit") { + val k = registerTask( + "cleanCompare$upstream", + "Create a comment comparing the $upstream commit" + ) { dependsOn(git) val (repo, ref, commitProperty) = extension.provider().flatten() this.repo.set(repo) @@ -49,21 +53,22 @@ class AlwaysUpToDate : Plugin { this.commitPropertyName.set(commitProperty) this.clear.set(true) } + + return (i to j to k).flatten() } - generateTasks("Paper") { paperRepo to paperRef to paperCommitName } - generateTasks("Purpur") { purpurRepo to purpurRef to purpurCommitName } + val (checkPaper, comparePaper, cleanComparePaper) = generateTasks("Paper") { paperRepo to paperRef to paperCommitName } + val (checkPurpur, comparePurpur, cleanComparePurpur) = generateTasks("Purpur") { purpurRepo to purpurRef to purpurCommitName } registerTask("updateUpstream", "Update the upstream commit") { dependsOn(git) repo.convention(extension.paperRepo) ref.convention(extension.paperRef) - commitPropertyName.convention(extension.paperCommitName) workDir.set(layout.projectDirectory) regex.convention("paperCommit = ") } - registerTask("updateImplementation", "Update the implementation commit") { + registerTask("updateImplementation", "Update the implementation") { dependsOn(git) workDir.set(layout.projectDirectory) } diff --git a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/CheckUpstreamCommit.kt b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/CheckUpstreamCommit.kt index fcf593174..5a231d470 100644 --- a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/CheckUpstreamCommit.kt +++ b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/CheckUpstreamCommit.kt @@ -3,10 +3,12 @@ package org.plazmamc.alwaysuptodate.tasks import org.gradle.api.Project import org.gradle.api.provider.Property import org.gradle.api.tasks.Input -import org.gradle.api.tasks.TaskAction import org.plazmamc.alwaysuptodate.AlwaysUpToDateException import org.plazmamc.alwaysuptodate.AlwaysUpToDateExtension -import org.plazmamc.alwaysuptodate.utils.* +import org.plazmamc.alwaysuptodate.utils.extension +import org.plazmamc.alwaysuptodate.utils.flatten +import org.plazmamc.alwaysuptodate.utils.git +import org.plazmamc.alwaysuptodate.utils.property abstract class CheckUpstreamCommit : Task() { @@ -19,8 +21,13 @@ abstract class CheckUpstreamCommit : Task() { @get:Input abstract val commitPropertyName: Property - @TaskAction - fun check() = with(project) { println(checkCommitFor { repo to ref to commitPropertyName }) } + override fun init(): Unit = with(project) { + outputs.upToDateWhen { checkCommitFor { repo to ref to commitPropertyName } } + + doLast { + println(checkCommitFor { repo to ref to commitPropertyName }) + } + } } diff --git a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/CreateCompareComment.kt b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/CreateCompareComment.kt index 666d238c3..844ae40e5 100644 --- a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/CreateCompareComment.kt +++ b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/CreateCompareComment.kt @@ -36,9 +36,11 @@ abstract class CreateCompareComment : Task() { builder.append("\n\n[${rawRepo.split("/").last()} Changes]\n") gson.fromJson( - URI.create("https://api.github.com/repos/$rawRepo/compare/${property { commitPropertyName }}...${ref.get()}") - .toURL().readText())["commits"].asJsonArray.forEach { obj -> - obj.asJsonObject.let { builder.append("$rawRepo@${it["sha"].asString.subSequence(0, 7)}: ${it["commit"].asJsonObject["message"].asString.split("\n")[0]}\n") } + URI.create("https://api.github.com/repos/$rawRepo/compare/${property { commitPropertyName }}...${ref.get()}").toURL().readText() + )["commits"].asJsonArray.forEach { obj -> + obj.asJsonObject.let { + builder.append("$rawRepo@${it["sha"].asString.subSequence(0, 7)}: ${it["commit"].asJsonObject["message"].asString.split("\n")[0]}\n") + } } file("compare.txt").writeText(builder.toString()) } diff --git a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/GenerateMergedAPIPatch.kt b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/GenerateMergedAPIPatch.kt index d474d7b58..40c0170ed 100644 --- a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/GenerateMergedAPIPatch.kt +++ b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/GenerateMergedAPIPatch.kt @@ -9,7 +9,6 @@ import org.gradle.api.tasks.InputDirectory import org.gradle.api.tasks.Internal import org.gradle.api.tasks.TaskAction import org.plazmamc.alwaysuptodate.utils.addCommit -import java.io.File abstract class GenerateMergedAPIPatch : Task() { diff --git a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/PurpurUpdateTask.kt b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/PurpurUpdateTask.kt index 59c0ad67e..e566611a7 100644 --- a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/PurpurUpdateTask.kt +++ b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/PurpurUpdateTask.kt @@ -1,7 +1,10 @@ package org.plazmamc.alwaysuptodate.tasks import io.papermc.paperweight.patcher.tasks.CheckoutRepo -import io.papermc.paperweight.util.* +import io.papermc.paperweight.util.Git +import io.papermc.paperweight.util.cache +import io.papermc.paperweight.util.path +import io.papermc.paperweight.util.set import org.gradle.api.file.Directory import org.gradle.api.file.DirectoryProperty import org.gradle.api.provider.Provider @@ -12,8 +15,10 @@ import org.gradle.api.tasks.TaskProvider import org.plazmamc.alwaysuptodate.utils.* import java.io.File import java.nio.file.Path -import java.util.Calendar -import kotlin.io.path.* +import java.util.* +import kotlin.io.path.ExperimentalPathApi +import kotlin.io.path.name +import kotlin.io.path.walk @Deprecated("It will soon be changed to be available for other upstreams.") abstract class PurpurUpdateTask : Task() { @@ -35,7 +40,7 @@ abstract class PurpurUpdateTask : Task() { You should have received a copy of the GNU General Public License along with this program. If not, see . """.trimIndent() - private val pufferfishAuthor = "--author=Kevin Raneri " + private val pufferfishAuthor = "Kevin Raneri " private val purpurHeader = """ PurpurMC Copyright (C) ${Calendar.getInstance().get(Calendar.YEAR)} PurpurMC @@ -58,7 +63,7 @@ abstract class PurpurUpdateTask : Task() { OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """.trimIndent() - private val purpurAuthor = "--author=granny " + private val purpurAuthor = "granny " @get:Internal abstract val workDir: DirectoryProperty @@ -70,28 +75,29 @@ abstract class PurpurUpdateTask : Task() { abstract val pufferfishDir: DirectoryProperty override fun init(): Unit = with(project) { - outputs.upToDateWhen { checkCommitFor { purpurRepo to purpurRef to purpurCommitName } } - val wd = layout.cache.resolve("alwaysUpToDate/update/purpur").also { it.toFile().deleteRecursively() } workDir.set(wd) - val compare = configureTask("createPurpurCompareComment", "Create Purpur Compare Comment") { - clear.convention(true) - repo.convention(extension.purpurRepo) - ref.convention(extension.purpurRef) - commitPropertyName.convention(extension.purpurCommitName) - } + val compare = + configureTask("createPurpurCompareComment", "Create Purpur Compare Comment") { + clear.convention(true) + repo.convention(extension.purpurRepo) + ref.convention(extension.purpurRef) + commitPropertyName.convention(extension.purpurCommitName) + } val paper = dependsOn("updatePaper", "Update Paper") { + outputs.upToDateWhen { checkCommitFor { repo to ref to paperCommitName } } dependsOn(compare) repo.convention(extension.paperRepo) ref.convention(extension.paperRef) regex.convention("paperCommit = ") - commitPropertyName.convention(extension.paperCommitName) workDir.set(layout.projectDirectory) } - fun checkout(name: String, repo: Provider, ref: Provider, regex: String, block: CheckoutRepo.() -> Unit): Pair, Directory> { + fun checkout( + name: String, repo: Provider, ref: Provider, regex: String, block: CheckoutRepo.() -> Unit + ): Pair, Directory> { val updatePaper = configureTask("update${name}Paper", "Update $name's Paper") { this.repo.convention(extension.paperRepo) this.ref.convention(extension.paperRef) @@ -113,8 +119,14 @@ abstract class PurpurUpdateTask : Task() { return updatePaper to checkout.flatMap { it.outputDir }.get() } - val (checkoutPufferfish, pufferfish) = checkout("Pufferfish", extension.pufferfishRepo, extension.pufferfishRef, "paperRef=") { onlyIf { extension { usePufferfish } } } - val (checkoutPurpur, purpur) = checkout("Purpur", extension.purpurRepo, extension.purpurRef, "paperCommit = ") { dependsOn(checkoutPufferfish) } + val (checkoutPufferfish, pufferfish) = + checkout("Pufferfish", extension.pufferfishRepo, extension.pufferfishRef, "paperRef=") { + onlyIf { extension { usePufferfish } } + } + val (checkoutPurpur, purpur) = + checkout("Purpur", extension.purpurRepo, extension.purpurRef, "paperCommit = ") { + dependsOn(checkoutPufferfish) + } pufferfishDir.set(pufferfish) purpurDir.set(purpur) @@ -139,36 +151,40 @@ abstract class PurpurUpdateTask : Task() { dependsOn(preparePurpur, preparePufferfish) - val serverPatch = configureTask("generateMergedServerPatches", "Generate Merged Server Patch") { - dependsOn(preparePurpur) - if (!extension { usePufferfish }) { - workDir.convention(purpur.dir("Purpur-Server")) - commitTitle.convention("Purpur Server Changes") - license.convention(purpurHeader) - author.convention(purpurAuthor) - return@configureTask - } + val serverPatch = + configureTask("generateMergedServerPatches", "Generate Merged Server Patch") { + dependsOn(preparePurpur) + if (!extension { usePufferfish }) { + workDir.convention(purpur.dir("Purpur-Server")) + commitTitle.convention("Purpur Server Changes") + license.convention(purpurHeader) + author.convention(purpurAuthor) + return@configureTask + } - dependsOn(preparePufferfish) - workDir.convention(pufferfish.dir("pufferfish-server")) - commitTitle.convention("Pufferfish Server Changes") - license.convention(pufferfishHeader) - author.convention(pufferfishAuthor) + dependsOn(preparePufferfish) + workDir.convention(pufferfish.dir("pufferfish-server")) + commitTitle.convention("Pufferfish Server Changes") + license.convention(pufferfishHeader) + author.convention(pufferfishAuthor) - doLast { - val dotGit = pufferfish.dir("pufferfish-server/.git").path.toFile() + doLast { + val dotGit = pufferfish.dir("pufferfish-server/.git").path.toFile() - purpur.path.resolve("Purpur-Server").let { - val purpurDotGit = it.resolve(".git").toFile().also(File::deleteRecursively) + purpur.path.resolve("Purpur-Server").let { + val purpurDotGit = it.resolve(".git").toFile().also(File::deleteRecursively) - copySource(it) - dotGit.copyRecursively(purpurDotGit, overwrite = true) - Git(it).addCommit("Purpur Server Changes\n\n$purpurHeader", purpurAuthor) + copySource(it) + dotGit.copyRecursively(purpurDotGit, overwrite = true) + Git(it).addCommit("Purpur Server Changes\n\n$purpurHeader", "--author=$purpurAuthor") + } } } - } - val pufferfishAPIChanges = configureTask("generateMergedPufferfishAPIPatch", "Generate Merged Pufferfish API Patch") { + val pufferfishAPIChanges = configureTask( + "generateMergedPufferfishAPIPatch", + "Generate Merged Pufferfish API Patch" + ) { dependsOn(preparePufferfish) inputDir.convention(pufferfish.dir(".gradle/caches/paperweight/upstreams/paper/Paper-API/.git")) workDir.convention(pufferfish.dir("pufferfish-api")) @@ -177,7 +193,10 @@ abstract class PurpurUpdateTask : Task() { author.convention(pufferfishAuthor) } - val apiPatch = configureTask("generateMergedAPIPatches", "Generate Merged API Patches") { + val apiPatch = configureTask( + "generateMergedAPIPatches", + "Generate Merged API Patches" + ) { dependsOn(preparePurpur) if (extension { usePufferfish }) dependsOn(pufferfishAPIChanges) @@ -204,19 +223,21 @@ abstract class PurpurUpdateTask : Task() { val patches = purpur.resolve("patches") with(layout.projectDirectory.path.resolve("patches")) { - patches.resolve("server").copyPatch(resolve("server"), + patches.resolve("server").copyPatch( resolve("server"), if (pufferfish == null) "" else "Pufferfish-Server-Changes", "Purpur-Server-Changes" ) - patches.resolve("api").copyPatch(resolve("api"), + patches.resolve("api").copyPatch( resolve("api"), if (pufferfish == null) "" else "Pufferfish-API-Changes", "Purpur-API-Changes" ) } file("gradle.properties").let { - it.writeText(it.readText().replace("purpurCommit = .*".toRegex(), "purpurCommit = ${Git(purpur).revParse()}")) + it.writeText( + it.readText().replace("purpurCommit = .*".toRegex(), "purpurCommit = ${Git(purpur).revParse()}") + ) } } diff --git a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/SimpleUpstreamUpdateTask.kt b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/SimpleUpstreamUpdateTask.kt index 15e71e084..652bbde0f 100644 --- a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/SimpleUpstreamUpdateTask.kt +++ b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/SimpleUpstreamUpdateTask.kt @@ -9,7 +9,8 @@ import org.gradle.api.tasks.InputDirectory import org.gradle.api.tasks.Optional import org.gradle.api.tasks.TaskAction import org.plazmamc.alwaysuptodate.AlwaysUpToDateException -import org.plazmamc.alwaysuptodate.utils.* +import org.plazmamc.alwaysuptodate.utils.dependsOn +import org.plazmamc.alwaysuptodate.utils.extension abstract class SimpleUpstreamUpdateTask : Task() { @@ -19,10 +20,6 @@ abstract class SimpleUpstreamUpdateTask : Task() { @get:Input abstract val ref: Property - @get:Input - @get:Optional - abstract val commitPropertyName: Property - @get:InputDirectory abstract val workDir: DirectoryProperty @@ -30,14 +27,8 @@ abstract class SimpleUpstreamUpdateTask : Task() { abstract val regex: Property override fun init(): Unit = with(project) { - outputs.upToDateWhen { - if (commitPropertyName.orNull != null) - checkCommitFor { repo to ref to (commitPropertyName) } - else - false - } - dependsOn("createCompareComment", "Create Paper Compare Comment") { + onlyIf { !this@SimpleUpstreamUpdateTask.state.upToDate } clear.convention(false) repo.convention(extension.paperRepo) ref.convention(extension.paperRef) @@ -49,9 +40,9 @@ abstract class SimpleUpstreamUpdateTask : Task() { fun update() = (Git(workDir.path)("ls-remote", repo.get()).readText()?.lines() ?.filterNot("[a-z0-9]{40}\trefs/heads/${ref.get()}".toRegex()::matches)?.first()?.split("\t")?.first() ?: throw AlwaysUpToDateException("Failed to get latest commit")).let { commit -> - workDir.file("gradle.properties").path.toFile().let { - it.writeText(it.readText().replace("${regex.get()}.*".toRegex(), "${regex.get()}$commit")) - } + workDir.file("gradle.properties").path.toFile().let { + it.writeText(it.readText().replace("${regex.get()}.*".toRegex(), "${regex.get()}$commit")) } + } } diff --git a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/Task.kt b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/Task.kt index 0797d86a4..0cea6e734 100644 --- a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/Task.kt +++ b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/tasks/Task.kt @@ -6,6 +6,8 @@ abstract class Task : DefaultTask() { protected open fun init() {} - init { this.init() } + init { + this.init() + } } diff --git a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/utils/Git.kt b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/utils/Git.kt index d48048853..a5f1babe9 100644 --- a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/utils/Git.kt +++ b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/utils/Git.kt @@ -2,13 +2,9 @@ package org.plazmamc.alwaysuptodate.utils import io.papermc.paperweight.util.Git import org.gradle.api.tasks.TaskAction -import org.plazmamc.alwaysuptodate.AlwaysUpToDateException import org.plazmamc.alwaysuptodate.tasks.Task import java.nio.file.Path -import kotlin.io.path.ExperimentalPathApi import kotlin.io.path.exists -import kotlin.io.path.notExists -import kotlin.io.path.walk val Git.path: Path get() = Git::class.java.getDeclaredField("repo").apply { isAccessible = true }.get(this) as Path diff --git a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/utils/Gradle.kt b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/utils/Gradle.kt index 04ca42a27..591803f9e 100644 --- a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/utils/Gradle.kt +++ b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/utils/Gradle.kt @@ -14,8 +14,17 @@ class Gradle(private val repo: Path) { } operator fun invoke(vararg args: String): Command { - val builder = ProcessBuilder("java", "-cp", "gradle/wrapper/gradle-wrapper.jar", "org.gradle.wrapper.GradleWrapperMain", *args, "--no-daemon", "--stacktrace").directory(repo) - val command = builder.command().joinToString(" ") { if (it.codePoints().anyMatch(Character::isWhitespace)) "\"$it\"" else it } + val builder = ProcessBuilder( + "java", + "-cp", + "gradle/wrapper/gradle-wrapper.jar", + "org.gradle.wrapper.GradleWrapperMain", + *args, + "--no-daemon", + "--stacktrace" + ).directory(repo) + val command = builder.command() + .joinToString(" ") { if (it.codePoints().anyMatch(Character::isWhitespace)) "\"$it\"" else it } return try { Command(builder, command) diff --git a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/utils/Tasks.kt b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/utils/Tasks.kt index b80fe5ff6..caab45e0f 100644 --- a/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/utils/Tasks.kt +++ b/buildSrc/src/main/kotlin/org/plazmamc/alwaysuptodate/utils/Tasks.kt @@ -19,7 +19,8 @@ private var extensionAccessor: AlwaysUpToDateExtension? = null val Project.extension: AlwaysUpToDateExtension get() { - if (extensionAccessor == null) extensionAccessor = project.extensions["alwaysUpToDate"] as AlwaysUpToDateExtension + if (extensionAccessor == null) extensionAccessor = + project.extensions["alwaysUpToDate"] as AlwaysUpToDateExtension return extensionAccessor!! } @@ -31,28 +32,56 @@ fun Project.extension(block: AlwaysUpToDateExtension.() -> Property): T = fun Project.property(block: AlwaysUpToDateExtension.() -> Property) = this.property(extension(block)) as String -inline fun Task.dependsOn(name: String, description: String, noinline block: T.() -> Unit = {}): TaskProvider = +inline fun Task.dependsOn( + name: String, + description: String, + noinline block: T.() -> Unit = {} +): TaskProvider = project.configureTask(name, description, block).also { this.dependsOn(it) } @JvmName("dependsOnDefaultTask") -fun Task.dependsOn(name: String, description: String, block: DefaultTask.() -> Unit = {}): TaskProvider = - project.configureTask(name, description, block).also { this.dependsOn(it) } +fun Task.dependsOn( + name: String, + description: String, + block: DefaultTask.() -> Unit = {} +): TaskProvider = + this.dependsOn(name, description, block) -inline fun Task.finalizedBy(name: String, description: String, noinline block: T.() -> Unit = {}): TaskProvider = +inline fun Task.finalizedBy( + name: String, + description: String, + noinline block: T.() -> Unit = {} +): TaskProvider = project.configureTask(name, description, block).also { this.finalizedBy(it) } @JvmName("finalizedByDefaultTask") -fun Task.finalizedBy(name: String, description: String, block: DefaultTask.() -> Unit = {}): TaskProvider = - project.configureTask(name, description, block).also { this.finalizedBy(it) } +fun Task.finalizedBy( + name: String, + description: String, + block: DefaultTask.() -> Unit = {} +): TaskProvider = + this.finalizedBy(name, description, block) -inline fun Task.mustRunAfter(name: String, description: String, noinline block: T.() -> Unit = {}): TaskProvider = +inline fun Task.mustRunAfter( + name: String, + description: String, + noinline block: T.() -> Unit = {} +): TaskProvider = project.configureTask(name, description, block).also { this.mustRunAfter(it) } @JvmName("mustRunAfterDefaultTask") -fun Task.mustRunAfter(name: String, description: String, block: DefaultTask.() -> Unit = {}): TaskProvider = - project.configureTask(name, description, block).also { this.mustRunAfter(it) } +fun Task.mustRunAfter( + name: String, + description: String, + block: DefaultTask.() -> Unit = {} +): TaskProvider = + this.mustRunAfter(name, description, block) -inline fun Project.configureTask(name: String, description: String, noinline block: T.() -> Unit = {}): TaskProvider = +inline fun Project.configureTask( + name: String, + description: String, + noinline block: T.() -> Unit = {} +): TaskProvider = tasks.configureTask(name) { this.group = "always up to date" this.description = description @@ -60,16 +89,28 @@ inline fun Project.configureTask(name: String, description: St } @JvmName("configureDefaultTask") -fun Project.configureTask(name: String, description: String, block: DefaultTask.() -> Unit = {}): TaskProvider = - tasks.configureTask(name) { - this.group = "always up to date" - this.description = description - this.block() - } +fun Project.configureTask( + name: String, + description: String, + block: DefaultTask.() -> Unit = {} +): TaskProvider = + this.configureTask(name, description, block) -inline fun Project.registerTask(name: String, description: String, crossinline block: T.() -> Unit = {}): TaskProvider = +inline fun Project.registerTask( + name: String, + description: String, + crossinline block: T.() -> Unit = {} +): TaskProvider = tasks.register(name, T::class.java) { this.group = "always up to date" this.description = description this.block() } + +@JvmName("registerDefaultTask") +fun Project.registerTask( + name: String, + description: String, + block: DefaultTask.() -> Unit = {} +): TaskProvider = + this.registerTask(name, description, block) diff --git a/gradle.properties b/gradle.properties index f0b861144..35bf13d1a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,8 +25,5 @@ pufferfishRepo = https://github.com/PlazmaMC/Pufferfish pufferfishBranch = ver/1.20 usePufferfish = true -#paperCommit = 5d8e53d78d0089894c9552b95b7b8ad9dcc8cb6f -#purpurCommit = 7095128d494cf55d8de10bece0a05f444fda183e - -paperCommit = 347bbe389786d5cdae7cd1c6ec32cacba2a9aac7 -purpurCommit = a5b3783e35e3486ec3b0829e54d3eff665030bb7 +paperCommit = 5d8e53d78d0089894c9552b95b7b8ad9dcc8cb6f +purpurCommit = 7095128d494cf55d8de10bece0a05f444fda183e diff --git a/patches/api/0001-Pufferfish-API-Changes.patch b/patches/api/0001-Pufferfish-API-Changes.patch index 16da6580d..9ad5fa55e 100644 --- a/patches/api/0001-Pufferfish-API-Changes.patch +++ b/patches/api/0001-Pufferfish-API-Changes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: --author=Kevin Raneri -Date: Sun, 2 Jun 2024 20:00:52 +0900 +From: Kevin Raneri +Date: Sun, 2 Jun 2024 20:42:32 +0900 Subject: [PATCH] Pufferfish API Changes Pufferfish diff --git a/patches/api/0002-Purpur-API-Changes.patch b/patches/api/0002-Purpur-API-Changes.patch index 18d2a6592..b90e11cb6 100644 --- a/patches/api/0002-Purpur-API-Changes.patch +++ b/patches/api/0002-Purpur-API-Changes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: --author=granny -Date: Sun, 2 Jun 2024 20:02:16 +0900 +From: granny +Date: Sun, 2 Jun 2024 20:43:53 +0900 Subject: [PATCH] Purpur API Changes PurpurMC diff --git a/patches/server/0001-Pufferfish-Server-Changes.patch b/patches/server/0001-Pufferfish-Server-Changes.patch index 154884924..0ebc0b247 100644 --- a/patches/server/0001-Pufferfish-Server-Changes.patch +++ b/patches/server/0001-Pufferfish-Server-Changes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: --author=Kevin Raneri -Date: Sun, 2 Jun 2024 20:02:21 +0900 +From: Kevin Raneri +Date: Sun, 2 Jun 2024 20:43:58 +0900 Subject: [PATCH] Pufferfish Server Changes Pufferfish diff --git a/patches/server/0002-Purpur-Server-Changes.patch b/patches/server/0002-Purpur-Server-Changes.patch index 92de08cd1..b64ad4df5 100644 --- a/patches/server/0002-Purpur-Server-Changes.patch +++ b/patches/server/0002-Purpur-Server-Changes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: granny -Date: Sun, 2 Jun 2024 20:02:23 +0900 +Date: Sun, 2 Jun 2024 20:43:59 +0900 Subject: [PATCH] Purpur Server Changes PurpurMC