plugins { `java-library` id("io.papermc.paperweight.userdev") version "2.0.0-beta.23" id("com.gradleup.shadow") version "9.6.1" } group = property("group") as String version = property("version") as String val javaRelease = (property("javaRelease") as String).toInt() val paperDevBundleVersion = property("paperDevBundleVersion") as String repositories { mavenCentral() maven("https://repo.papermc.io/repository/maven-public/") } dependencies { paperweight.paperDevBundle(paperDevBundleVersion) // Region files written by 1.21.2+ servers may be LZ4-compressed. The // server bundles lz4-java (Paper's at.yawk.lz4 fork, same net.jpountz // package) and the dev bundle exposes it, so nothing is shaded for it. // slf4j-api is likewise provided by the server (log4j-slf4j2-impl). compileOnly("org.slf4j:slf4j-api:2.0.18") testImplementation(platform("org.junit:junit-bom:6.1.1")) testImplementation("org.junit.jupiter:junit-jupiter") testRuntimeOnly("org.junit.platform:junit-platform-launcher") } // Paper has been Mojang-mapped at runtime since 1.20.5, so the compiled jar is // used as-is; no reobfuscation step. The manifest attribute below tells the // server not to try remapping it either. paperweight.reobfArtifactConfiguration = io.papermc.paperweight.userdev.ReobfArtifactConfiguration.MOJANG_PRODUCTION // No toolchain block on purpose (same reasoning as geoblock-limiter): any JDK // >= javaRelease builds it, and --release pins the class-file level. java { withSourcesJar() } tasks.withType().configureEach { options.release.set(javaRelease) options.encoding = "UTF-8" // Warnings are informative, not fatal: a dev-bundle bump routinely // deprecates something and must not break a routine dependency update. options.compilerArgs.add("-Xlint:all,-serial,-processing") } tasks.processResources { val props = mapOf("version" to project.version.toString()) inputs.properties(props) filesMatching("plugin.yml") { expand(props) } } tasks.jar { // The thin jar is an intermediate; the shaded one is the deliverable. archiveClassifier.set("thin") } tasks.shadowJar { archiveBaseName.set("mapsyncer-paper") archiveClassifier.set("") // Nothing is bundled today; the shadow task exists so a future dependency // can be added without changing the CI or the deploy path. manifest { attributes("paperweight-mappings-namespace" to "mojang") } } tasks.assemble { dependsOn(tasks.shadowJar) } tasks.test { useJUnitPlatform() // Optional: -Pmapsyncer.test.mca=/path/to/r.0.0.mca runs the conversion // test against a real region file; without it that test is skipped. val realMca = providers.gradleProperty("mapsyncer.test.mca").orNull if (realMca != null) { systemProperty("mapsyncer.test.mca", realMca) inputs.file(realMca) } testLogging { events("failed") exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL } }