diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..45f806e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,32 @@ +name: Patch and Build +on: [ push, pull_request ] +jobs: + build: + # Only run on PRs if the source branch is on someone else's repo + if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} + runs-on: ubuntu-latest + steps: + - name: Checkout Git Repository + uses: actions/checkout@v2 + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Cache Gradle + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/gradle.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Set up JDK + uses: actions/setup-java@v2.3.0 + with: + distribution: 'temurin' + java-version: '16' + - name: Configure Git User Details + run: git config --global user.email "actions@github.com" && git config --global user.name "Github Actions" + - name: Apply Patches + run: ./gradlew applyPatches --stacktrace + - name: Build + run: ./gradlew build --stacktrace diff --git a/build.gradle.kts b/build.gradle.kts index 57aa822..8bcb5eb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,41 +1,47 @@ +import io.papermc.paperweight.util.constants.* + plugins { java + `maven-publish` id("com.github.johnrengelman.shadow") version "7.0.0" apply false - id("io.papermc.paperweight.patcher") version "1.1.5" + id("io.papermc.paperweight.patcher") version "1.1.11" } repositories { mavenCentral() maven("https://papermc.io/repo/repository/maven-public/") { - content { - onlyForConfigurations("paperclip") - } - } - maven("https://maven.quiltmc.org/repository/release/") { - content { - onlyForConfigurations("remapper") - } + content { onlyForConfigurations(PAPERCLIP_CONFIG) } } } dependencies { - remapper("org.quiltmc:tiny-remapper:0.4.1") + remapper("org.quiltmc:tiny-remapper:0.4.3") + decompiler("net.minecraftforge:forgeflower:1.5.498.12") paperclip("io.papermc:paperclip:2.0.1") } -subprojects { +allprojects { apply(plugin = "java") + apply(plugin = "maven-publish") java { toolchain { languageVersion.set(JavaLanguageVersion.of(16)) } } +} - tasks.withType().configureEach { - options.encoding = "UTF-8" +subprojects { + tasks.withType { + options.encoding = Charsets.UTF_8.name() options.release.set(16) } + tasks.withType { + options.encoding = Charsets.UTF_8.name() + } + tasks.withType { + filteringCharset = Charsets.UTF_8.name() + } repositories { mavenCentral() @@ -51,6 +57,9 @@ subprojects { paperweight { serverProject.set(project(":ForkTest-Server")) + remapRepo.set("https://maven.quiltmc.org/repository/release/") + decompileRepo.set("https://files.minecraftforge.net/maven/") + usePaperUpstream(providers.gradleProperty("paperRef")) { withPaperPatcher { apiPatchDir.set(layout.projectDirectory.dir("patches/api")) @@ -61,3 +70,50 @@ paperweight { } } } + +// +// Everything below here is optional if you don't care about publishing API or dev bundles to your repository +// + +tasks.generateDevelopmentBundle { + apiCoordinates.set("com.example.paperfork:forktest-api") + mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi") + libraryRepositories.set( + listOf( + "https://libraries.minecraft.net/", + "https://maven.quiltmc.org/repository/release/", + "https://repo.aikar.co/content/groups/aikar", + "https://ci.emc.gs/nexus/content/groups/aikar/", + "https://papermc.io/repo/repository/maven-public/", // for paper-mojangapi + // "https://my.repo/" // This should be a repo hosting your API (in this example, 'com.example.paperfork:forktest-api') + ) + ) +} + +allprojects { + // Publishing API: + // ./gradlew :ForkTest-API:publish[ToMavenLocal] + publishing { + repositories { + maven { + name = "myRepoSnapshots" + url = uri("https://my.repo/") + // See Gradle docs for how to provide credentials to PasswordCredentials + // https://docs.gradle.org/current/samples/sample_publishing_credentials.html + credentials(PasswordCredentials::class) + } + } + } +} + +publishing { + // Publishing dev bundle: + // ./gradlew publishDevBundlePublicationTo(MavenLocal|MyRepoSnapshotsRepository) -PpublishDevBundle + if (project.hasProperty("publishDevBundle")) { + publications.create("devBundle") { + artifact(tasks.generateDevelopmentBundle) { + artifactId = "dev-bundle" + } + } + } +} diff --git a/gradle.properties b/gradle.properties index 080ee20..2288d30 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ -group = com.example.paperfork -version = 1.17-R0.1-SNAPSHOT +group=com.example.paperfork +version=1.17.1-R0.1-SNAPSHOT -mcVersion = 1.17 -packageVersion = 1_17_R1 -paperRef = ea0336dff57f6c3cab42d5e94ae7a82718578dde +mcVersion=1.17.1 +paperRef=61a09c51023c53997c31ef24849a99262f7ddaf0 +org.gradle.caching=true org.gradle.parallel=true org.gradle.vfs.watch=false diff --git a/patches/server/0001-Build-changes.patch b/patches/server/0001-Build-changes.patch index 9023b52..438f327 100644 --- a/patches/server/0001-Build-changes.patch +++ b/patches/server/0001-Build-changes.patch @@ -5,21 +5,30 @@ Subject: [PATCH] Build changes diff --git a/build.gradle.kts b/build.gradle.kts -index f111042223f0d7974785c37245bb60b75388163e..043e5f4a0914fab856f98d39262a7c28c327460f 100644 +index 1876481a830228fd15fcd2a4be5f2c28bd7e51fe..872b45c4ea41372c8cfb435cec46b643291a2fa5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -19,8 +19,8 @@ repositories { +@@ -28,8 +28,8 @@ repositories { } dependencies { - implementation(project(":Paper-API")) - implementation(project(":Paper-MojangAPI")) + implementation(project(":ForkTest-API")) // ForkTest -+ implementation("com.destroystokyo.paper:paper-mojangapi:1.16.5-R0.1-SNAPSHOT") // ForkTest ++ implementation("io.papermc.paper:paper-mojangapi:1.17.1-R0.1-SNAPSHOT") // ForkTest // Paper start implementation("org.jline:jline-terminal-jansi:3.12.1") implementation("net.minecrell:terminalconsoleappender:1.2.0") -@@ -119,7 +119,7 @@ tasks.test { +@@ -80,7 +80,7 @@ tasks.jar { + attributes( + "Main-Class" to "org.bukkit.craftbukkit.Main", + "Implementation-Title" to "CraftBukkit", +- "Implementation-Version" to "git-Paper-$implementationVersion", ++ "Implementation-Version" to "git-ForkTest-$implementationVersion", // ForkTest + "Implementation-Vendor" to date, // Paper + "Specification-Title" to "Bukkit", + "Specification-Version" to project.version, +@@ -205,7 +205,7 @@ tasks.test { fun TaskContainer.registerRunTask( name: String, block: JavaExec.() -> Unit ): TaskProvider = register(name) { @@ -29,10 +38,10 @@ index f111042223f0d7974785c37245bb60b75388163e..043e5f4a0914fab856f98d39262a7c28 workingDir = rootProject.layout.projectDirectory.dir( providers.gradleProperty("runWorkDir").forUseAtConfigurationTime().orElse("run") diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c6747f49ae8ddc9fc1bad82ab480f85d0883da5d..804eb17da12b816438a4d4c39fc330c4869cea1d 100644 +index 3dded5c491ace6b073a7bc3178976bd70f0b9393..72d637ffc00b536357af02a52defe996dceda3b9 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1649,7 +1649,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla! } - public SystemReport fillSystemReport(SystemReport systemreport) { + public SystemReport fillSystemReport(SystemReport details) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 8a98bd1018afd934696fedbed24e271ab6b75f51..84c456ef6a375d84ab52e11a58a4e6fe602733c0 100644 +index 6d7f16fede01c19f638e1dcdae8b07b79cd86dc0..5b8132b32234536b89601813bdba17410803428a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -230,7 +230,7 @@ import javax.annotation.Nullable; // Paper +@@ -240,7 +240,7 @@ import javax.annotation.Nullable; // Paper import javax.annotation.Nonnull; // Paper public final class CraftServer implements Server { @@ -54,3 +63,16 @@ index 8a98bd1018afd934696fedbed24e271ab6b75f51..84c456ef6a375d84ab52e11a58a4e6fe private final String serverVersion; private final String bukkitVersion = Versioning.getBukkitVersion(); private final Logger logger = Logger.getLogger("Minecraft"); +diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java +index 774556a62eb240da42e84db4502e2ed43495be17..21f39bd0c33ef2635249298e6a247afba8b05742 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java +@@ -11,7 +11,7 @@ public final class Versioning { + public static String getBukkitVersion() { + String result = "Unknown-Version"; + +- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties"); ++ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/com.example.paperfork/forktest-api/pom.properties"); // ForkTest + Properties properties = new Properties(); + + if (stream != null) {