9
0
mirror of https://github.com/SparklyPower/SparklyPaper.git synced 2025-12-19 15:09:27 +00:00

Update to Paper 1.21.4 (post hard fork™️ edition)

This commit is contained in:
MrPowerGamerBR
2025-01-14 00:52:12 -03:00
parent 3e8eff82ea
commit 8e7b51f5d7
98 changed files with 3947 additions and 5536 deletions

View File

@@ -1,41 +1,64 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
java
`maven-publish`
// In general, keep this version in sync with upstream. Sometimes a newer version than upstream might work, but an older version is extremely likely to break.
id("io.papermc.paperweight.patcher") version "1.7.5"
java // TODO java launcher tasks
id("io.papermc.paperweight.patcher") version "2.0.0-beta.13"
}
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
paperweight {
upstreams.paper {
ref = providers.gradleProperty("paperRef")
repositories {
mavenCentral()
maven(paperMavenPublicUrl) {
content { onlyForConfigurations(configurations.paperclip.name) }
}
}
dependencies {
remapper("net.fabricmc:tiny-remapper:0.10.3:fat") // Must be kept in sync with upstream
decompiler("org.vineflower:vineflower:1.10.1") // Must be kept in sync with upstream
paperclip("io.papermc:paperclip:3.0.3") // You probably want this to be kept in sync with upstream
}
allprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
patchFile {
path = "paper-server/build.gradle.kts"
outputFile = file("sparklypaper-server/build.gradle.kts")
patchFile = file("sparklypaper-server/build.gradle.kts.patch")
}
patchFile {
path = "paper-api/build.gradle.kts"
outputFile = file("sparklypaper-api/build.gradle.kts")
patchFile = file("sparklypaper-api/build.gradle.kts.patch")
}
patchDir("paperApi") {
upstreamPath = "paper-api"
excludes = setOf("build.gradle.kts")
patchesDir = file("sparklypaper-api/paper-patches")
outputDir = file("paper-api")
}
patchDir("paperApiGenerator") {
upstreamPath = "paper-api-generator"
patchesDir = file("sparklypaper-api-generator/paper-patches")
outputDir = file("paper-api-generator")
}
}
}
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
subprojects {
apply(plugin = "java-library")
apply(plugin = "maven-publish")
extensions.configure<JavaPluginExtension> {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenCentral()
maven(paperMavenPublicUrl)
}
tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
tasks.withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
options.release.set(21)
options.release = 21
options.isFork = true
}
tasks.withType<Javadoc> {
options.encoding = Charsets.UTF_8.name()
@@ -43,75 +66,22 @@ subprojects {
tasks.withType<ProcessResources> {
filteringCharset = Charsets.UTF_8.name()
}
repositories {
mavenCentral()
maven(paperMavenPublicUrl)
}
}
paperweight {
serverProject.set(project(":sparklypaper-server"))
remapRepo.set(paperMavenPublicUrl)
decompileRepo.set(paperMavenPublicUrl)
usePaperUpstream(providers.gradleProperty("paperRef")) {
withPaperPatcher {
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
apiOutputDir.set(layout.projectDirectory.dir("sparklypaper-api"))
serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
serverOutputDir.set(layout.projectDirectory.dir("sparklypaper-server"))
}
patchTasks.register("generatedApi") {
isBareDirectory = true
upstreamDirPath = "paper-api-generator/generated"
patchDir = layout.projectDirectory.dir("patches/generatedApi")
outputDir = layout.projectDirectory.dir("paper-api-generator/generated")
tasks.withType<Test> {
testLogging {
showStackTraces = true
exceptionFormat = TestExceptionFormat.FULL
events(TestLogEvent.STANDARD_OUT)
}
}
}
//
// Everything below here is optional if you don't care about publishing API or dev bundles to your repository
//
tasks.generateDevelopmentBundle {
apiCoordinates.set("net.sparklypower.sparklypaper:sparklypaper-api")
libraryRepositories.set(
listOf(
"https://repo.maven.apache.org/maven2/",
paperMavenPublicUrl,
// "https://my.repo/", // This should be a repo hosting your API (in this example, 'net.sparklypower.sparklypaper:sparklypaper-api')
)
)
}
allprojects {
// Publishing API:
// ./gradlew :SparklyPaper-API:publish[ToMavenLocal]
publishing {
extensions.configure<PublishingExtension> {
repositories {
maven {
name = "PerfectDreams"
url = uri("https://repo.perfectdreams.net/")
// See Gradle docs for how to provide credentials to PasswordCredentials
// https://docs.gradle.org/current/samples/sample_publishing_credentials.html
/*
maven("https://repo.papermc.io/repository/maven-snapshots/") {
name = "paperSnapshots"
credentials(PasswordCredentials::class)
}
}
}
}
publishing {
// Publishing dev bundle:
// ./gradlew publishDevBundlePublicationTo(MavenLocal|MyRepoSnapshotsRepository) -PpublishDevBundle
if (project.hasProperty("publishDevBundle")) {
publications.create<MavenPublication>("devBundle") {
artifact(tasks.generateDevelopmentBundle) {
artifactId = "dev-bundle"
}
*/
}
}
}