From ad2a112c89920249b16eb2fd3fe7c7735acfc399 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Tue, 15 Jun 2021 22:10:05 -0700
Subject: [PATCH] Update runDev task for Gradle 7.1 deprecations

also no longer disable watchdog by default, instead require `disableWatchdog` Gradle property to be set
---
 .../server/0001-Setup-Gradle-project.patch    | 43 ++++++++++---------
 .../server/0003-Build-system-changes.patch    |  8 ++--
 ...oleAppender-for-console-improvements.patch |  4 +-
 ...n-prefixes-using-Log4J-configuration.patch |  4 +-
 ...224-Use-asynchronous-Log4j-2-loggers.patch |  4 +-
 .../0424-Implement-Brigadier-Mojang-API.patch |  4 +-
 .../server/0430-Implement-Mob-Goal-API.patch  |  4 +-
 ...pport-for-hex-color-codes-in-console.patch |  4 +-
 work/Bukkit                                   |  2 +-
 work/CraftBukkit                              |  2 +-
 10 files changed, 40 insertions(+), 39 deletions(-)

diff --git a/patches/server/0001-Setup-Gradle-project.patch b/patches/server/0001-Setup-Gradle-project.patch
index 8672be8dda..2159f800cc 100644
--- a/patches/server/0001-Setup-Gradle-project.patch
+++ b/patches/server/0001-Setup-Gradle-project.patch
@@ -17,18 +17,17 @@ index 67fb370cad6924895a6b27052dbd5c1767e3f0c9..3e05459f27c4c5697ae65da504d67a6a
  /.project
 diff --git a/build.gradle.kts b/build.gradle.kts
 new file mode 100644
-index 0000000000000000000000000000000000000000..80fab4621582aed02cc029900999ceff72e027ef
+index 0000000000000000000000000000000000000000..792fea417637493814071850e780e9923d75a637
 --- /dev/null
 +++ b/build.gradle.kts
-@@ -0,0 +1,131 @@
+@@ -0,0 +1,132 @@
 +import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer
 +import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer
 +import io.papermc.paperweight.util.Git
 +import io.papermc.paperweight.util.path
-+import org.gradle.api.file.FileTreeElement
 +import shadow.org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor.PLUGIN_CACHE_FILE
-+import java.util.Date
 +import java.text.SimpleDateFormat
++import java.util.Date
 +
 +plugins {
 +    java
@@ -114,20 +113,24 @@ index 0000000000000000000000000000000000000000..80fab4621582aed02cc029900999ceff
 +    exclude("org/bukkit/craftbukkit/inventory/ItemStack*Test.class")
 +}
 +
-+fun TaskContainer.registerRunTask(name: String, block: JavaExec.() -> Unit): TaskProvider<JavaExec> =
-+    register<JavaExec>(name) {
-+        group = "Paper"
-+        workingDir = rootProject.layout.projectDirectory.dir(
-+            providers.gradleProperty("runWorkDir").forUseAtConfigurationTime().orElse("run")
-+        ).get().asFile
-+        doFirst {
-+            workingDir.mkdirs()
-+        }
-+        standardInput = System.`in`
-+        args("--nogui")
-+        systemProperty("net.kyori.adventure.text.warnWhenLegacyFormattingDetected", true)
-+        block(this)
++fun TaskContainer.registerRunTask(
++    name: String, block: JavaExec.() -> Unit
++): TaskProvider<JavaExec> = register<JavaExec>(name) {
++    group = "paper"
++    standardInput = System.`in`
++    workingDir = rootProject.layout.projectDirectory.dir(
++        providers.gradleProperty("runWorkDir").forUseAtConfigurationTime().orElse("run")
++    ).get().asFile
++    args("--nogui")
++    systemProperty("net.kyori.adventure.text.warnWhenLegacyFormattingDetected", true)
++    if (project.hasProperty("disableWatchdog")) {
++        systemProperty("disable.watchdog", true)
 +    }
++    doFirst {
++        workingDir.mkdirs()
++    }
++    block(this)
++}
 +
 +tasks.registerRunTask("runShadow") {
 +    description = "Spin up a test server from the shadowJar archiveFile"
@@ -141,10 +144,8 @@ index 0000000000000000000000000000000000000000..80fab4621582aed02cc029900999ceff
 +
 +tasks.registerRunTask("runDev") {
 +    description = "Spin up a non-shaded non-remapped test server"
-+    classpath = project.convention.getPlugin(JavaPluginConvention::class.java)
-+        .sourceSets.getByName("main").runtimeClasspath
-+    main = "org.bukkit.craftbukkit.Main"
-+    systemProperty("disable.watchdog", true)
++    classpath = java.sourceSets.main.get().runtimeClasspath
++    mainClass.set("org.bukkit.craftbukkit.Main")
 +}
 +
 +class ModifiedLog4j2PluginsCacheFileTransformer : Transformer by Log4j2PluginsCacheFileTransformer() {
diff --git a/patches/server/0003-Build-system-changes.patch b/patches/server/0003-Build-system-changes.patch
index 37c7c0d01e..6281f539c1 100644
--- a/patches/server/0003-Build-system-changes.patch
+++ b/patches/server/0003-Build-system-changes.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Build system changes
 
 
 diff --git a/build.gradle.kts b/build.gradle.kts
-index 80fab4621582aed02cc029900999ceff72e027ef..07be9eb1dd7f0f85e8a36cc4e8df807bae989372 100644
+index 792fea417637493814071850e780e9923d75a637..c255556783133278aaa0720969324f4c870ad7be 100644
 --- a/build.gradle.kts
 +++ b/build.gradle.kts
-@@ -22,21 +22,24 @@ repositories {
+@@ -21,21 +21,24 @@ repositories {
  dependencies {
      implementation(project(":Paper-API"))
      implementation("jline:jline:2.12.1")
@@ -37,7 +37,7 @@ index 80fab4621582aed02cc029900999ceff72e027ef..07be9eb1dd7f0f85e8a36cc4e8df807b
      testImplementation("junit:junit:4.13.1")
      testImplementation("org.hamcrest:hamcrest-library:1.3")
  }
-@@ -53,7 +56,8 @@ tasks.jar {
+@@ -52,7 +55,8 @@ tasks.jar {
              "Implementation-Vendor" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(Date()), // Paper
              "Specification-Title" to "Bukkit",
              "Specification-Version" to project.version,
@@ -47,7 +47,7 @@ index 80fab4621582aed02cc029900999ceff72e027ef..07be9eb1dd7f0f85e8a36cc4e8df807b
          ))
          for (tld in listOf("net", "com", "org")) {
              attributes(mapOf(
-@@ -73,9 +77,17 @@ configure<PublishingExtension> {
+@@ -72,9 +76,17 @@ configure<PublishingExtension> {
      }
  }
  
diff --git a/patches/server/0137-Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/0137-Use-TerminalConsoleAppender-for-console-improvements.patch
index a4ec9e1c30..5fa80f2400 100644
--- a/patches/server/0137-Use-TerminalConsoleAppender-for-console-improvements.patch
+++ b/patches/server/0137-Use-TerminalConsoleAppender-for-console-improvements.patch
@@ -19,10 +19,10 @@ Other changes:
     configuration
 
 diff --git a/build.gradle.kts b/build.gradle.kts
-index 07be9eb1dd7f0f85e8a36cc4e8df807bae989372..2d016978c4e2ee2d222b177ccdb1f356ffd60db1 100644
+index c255556783133278aaa0720969324f4c870ad7be..a2346d6ca23ab24c5fe6048a2ab3d7cad23ad091 100644
 --- a/build.gradle.kts
 +++ b/build.gradle.kts
-@@ -21,7 +21,17 @@ repositories {
+@@ -20,7 +20,17 @@ repositories {
  
  dependencies {
      implementation(project(":Paper-API"))
diff --git a/patches/server/0157-Handle-plugin-prefixes-using-Log4J-configuration.patch b/patches/server/0157-Handle-plugin-prefixes-using-Log4J-configuration.patch
index f95216ecdd..f37426e4f4 100644
--- a/patches/server/0157-Handle-plugin-prefixes-using-Log4J-configuration.patch
+++ b/patches/server/0157-Handle-plugin-prefixes-using-Log4J-configuration.patch
@@ -15,10 +15,10 @@ This may cause additional prefixes to be disabled for plugins bypassing
 the plugin logger.
 
 diff --git a/build.gradle.kts b/build.gradle.kts
-index 7d969b0c2a4c15c7c12ab1dd0b002a7b53cebeed..ac607a3be84bc02dedb95cab9a5eace40e33b511 100644
+index a2346d6ca23ab24c5fe6048a2ab3d7cad23ad091..03c157bb563b6c7b89e56e4c8e9c31b221b17bf9 100644
 --- a/build.gradle.kts
 +++ b/build.gradle.kts
-@@ -30,7 +30,7 @@ dependencies {
+@@ -29,7 +29,7 @@ dependencies {
            all its classes to check if they are plugins.
            Scanning takes about 1-2 seconds so adding this speeds up the server start.
       */
diff --git a/patches/server/0224-Use-asynchronous-Log4j-2-loggers.patch b/patches/server/0224-Use-asynchronous-Log4j-2-loggers.patch
index f70348c336..c8c5e93cb5 100644
--- a/patches/server/0224-Use-asynchronous-Log4j-2-loggers.patch
+++ b/patches/server/0224-Use-asynchronous-Log4j-2-loggers.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Use asynchronous Log4j 2 loggers
 
 
 diff --git a/build.gradle.kts b/build.gradle.kts
-index 755d0472684579272a63a481d7504ff2dae69c2d..39ae4cc76438c40e007bfe5e8ace7cbaee66d3b8 100644
+index 03c157bb563b6c7b89e56e4c8e9c31b221b17bf9..ef743e289163cd7dc73a01f0aae784cb6c11d970 100644
 --- a/build.gradle.kts
 +++ b/build.gradle.kts
-@@ -42,6 +42,7 @@ dependencies {
+@@ -41,6 +41,7 @@ dependencies {
      }
      runtimeOnly("org.xerial:sqlite-jdbc:3.34.0")
      runtimeOnly("mysql:mysql-connector-java:8.0.23") // Paper
diff --git a/patches/server/0424-Implement-Brigadier-Mojang-API.patch b/patches/server/0424-Implement-Brigadier-Mojang-API.patch
index 8ce200e5ba..1ab1141852 100644
--- a/patches/server/0424-Implement-Brigadier-Mojang-API.patch
+++ b/patches/server/0424-Implement-Brigadier-Mojang-API.patch
@@ -10,10 +10,10 @@ Adds CommandRegisteredEvent
   - Allows manipulating the CommandNode to add more children/metadata for the client
 
 diff --git a/build.gradle.kts b/build.gradle.kts
-index 39ae4cc76438c40e007bfe5e8ace7cbaee66d3b8..23e8666e2b5691eb814af7e06b75c8507f0ed253 100644
+index ef743e289163cd7dc73a01f0aae784cb6c11d970..f1cbacb9f87f15c4cc2d1999cdb17a47eca9a7c3 100644
 --- a/build.gradle.kts
 +++ b/build.gradle.kts
-@@ -21,6 +21,7 @@ repositories {
+@@ -20,6 +20,7 @@ repositories {
  
  dependencies {
      implementation(project(":Paper-API"))
diff --git a/patches/server/0430-Implement-Mob-Goal-API.patch b/patches/server/0430-Implement-Mob-Goal-API.patch
index 44b1aa853b..42a8e60e8a 100644
--- a/patches/server/0430-Implement-Mob-Goal-API.patch
+++ b/patches/server/0430-Implement-Mob-Goal-API.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Implement Mob Goal API
 
 
 diff --git a/build.gradle.kts b/build.gradle.kts
-index 23e8666e2b5691eb814af7e06b75c8507f0ed253..01989dc93f768165f9de341d9df51355fd5f2727 100644
+index f1cbacb9f87f15c4cc2d1999cdb17a47eca9a7c3..7c99d0d173c8b36e26f90ec2126f3924997e6fa9 100644
 --- a/build.gradle.kts
 +++ b/build.gradle.kts
-@@ -52,6 +52,7 @@ dependencies {
+@@ -51,6 +51,7 @@ dependencies {
      implementation("co.aikar:cleaner:1.0-SNAPSHOT") // Paper
      implementation("io.netty:netty-all:4.1.65.Final") // Paper
  
diff --git a/patches/server/0623-Add-support-for-hex-color-codes-in-console.patch b/patches/server/0623-Add-support-for-hex-color-codes-in-console.patch
index 6e07ceb12e..31ce6553d1 100644
--- a/patches/server/0623-Add-support-for-hex-color-codes-in-console.patch
+++ b/patches/server/0623-Add-support-for-hex-color-codes-in-console.patch
@@ -6,10 +6,10 @@ Subject: [PATCH] Add support for hex color codes in console
 Converts upstream's hex color code legacy format into actual hex color codes in the console.
 
 diff --git a/build.gradle.kts b/build.gradle.kts
-index 01989dc93f768165f9de341d9df51355fd5f2727..f9d93a70ac754150b6e545c70b3071632be8f294 100644
+index 7c99d0d173c8b36e26f90ec2126f3924997e6fa9..f111042223f0d7974785c37245bb60b75388163e 100644
 --- a/build.gradle.kts
 +++ b/build.gradle.kts
-@@ -32,6 +32,7 @@ dependencies {
+@@ -31,6 +31,7 @@ dependencies {
            Scanning takes about 1-2 seconds so adding this speeds up the server start.
       */
      implementation("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - implementation
diff --git a/work/Bukkit b/work/Bukkit
index e9ce88b99c..ebb0e28d11 160000
--- a/work/Bukkit
+++ b/work/Bukkit
@@ -1 +1 @@
-Subproject commit e9ce88b99c08332877866313784cd84e9d9b54fb
+Subproject commit ebb0e28d11747aa0bb4bb39fad8979ccfaa925b6
diff --git a/work/CraftBukkit b/work/CraftBukkit
index d7ef1e91fa..f992ce6097 160000
--- a/work/CraftBukkit
+++ b/work/CraftBukkit
@@ -1 +1 @@
-Subproject commit d7ef1e91fa6431aa649b4bfcdabdbbef8ba41267
+Subproject commit f992ce6097f846ed5967fc797d98ae3e84ef1b10