Folia/build.gradle.kts
2024-03-24 13:44:25 -07:00

122 lines
3.1 KiB
Plaintext

import io.papermc.paperweight.tasks.RebuildGitPatches
plugins {
java
`maven-publish`
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
id("io.papermc.paperweight.patcher") version "1.5.11"
}
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
repositories {
mavenCentral()
maven(paperMavenPublicUrl) {
content { onlyForConfigurations(configurations.paperclip.name) }
}
}
dependencies {
remapper("net.fabricmc:tiny-remapper:0.10.1:fat")
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
paperclip("io.papermc:paperclip:3.0.3")
}
allprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
}
subprojects {
tasks.withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
}
tasks.withType<Javadoc> {
options.encoding = Charsets.UTF_8.name()
}
tasks.withType<ProcessResources> {
filteringCharset = Charsets.UTF_8.name()
}
repositories {
mavenCentral()
maven(paperMavenPublicUrl)
}
}
paperweight {
serverProject.set(project(":folia-server"))
remapRepo.set(paperMavenPublicUrl)
decompileRepo.set(paperMavenPublicUrl)
usePaperUpstream(providers.gradleProperty("paperRef")) {
withPaperPatcher {
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
apiOutputDir.set(layout.projectDirectory.dir("Folia-API"))
serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
serverOutputDir.set(layout.projectDirectory.dir("Folia-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.generateDevelopmentBundle {
apiCoordinates.set("dev.folia:folia-api")
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
libraryRepositories.addAll(
"https://repo.maven.apache.org/maven2/",
paperMavenPublicUrl,
)
}
allprojects {
publishing {
repositories {
maven("https://repo.papermc.io/repository/maven-snapshots/") {
name = "paperSnapshots"
credentials(PasswordCredentials::class)
}
}
}
}
publishing {
if (project.hasProperty("publishDevBundle")) {
publications.create<MavenPublication>("devBundle") {
artifact(tasks.generateDevelopmentBundle) {
artifactId = "dev-bundle"
}
}
}
}
tasks.withType<RebuildGitPatches> {
filterPatches.set(false)
}
tasks.register("printMinecraftVersion") {
doLast {
println(providers.gradleProperty("mcVersion").get().trim())
}
}
tasks.register("printPaperVersion") {
doLast {
println(project.version)
}
}