Skip to content

Commit

Permalink
Fix build.gradle.kts (#70)
Browse files Browse the repository at this point in the history
* Fix Exploits

* Fix build.gradle.kts

* Fix build.gradle.kts

---------

Signed-off-by: IPECTER 이팩터 <80433772+IPECTER@users.noreply.github.com>
  • Loading branch information
IPECTER authored Dec 30, 2023
1 parent 2b8e2f0 commit 32dc8ec
Showing 1 changed file with 94 additions and 2 deletions.
96 changes: 94 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
java
`maven-publish`
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
id("io.papermc.paperweight.patcher") version "1.5.7-SNAPSHOT"
id("io.papermc.paperweight.patcher") version "1.5.10"
}

repositories {
Expand All @@ -18,7 +18,7 @@ repositories {
}

dependencies {
remapper("net.fabricmc:tiny-remapper:0.8.9:fat")
remapper("net.fabricmc:tiny-remapper:0.8.11:fat")
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
paperclip("io.papermc:paperclip:3.0.3")
}
Expand Down Expand Up @@ -47,3 +47,95 @@ allprojects {
}
}
}

subprojects {
apply(plugin = "java")

tasks {
withType<JavaCompile>().configureEach {
options.compilerArgs.add("--add-modules=jdk.incubator.vector")
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
}

withType<Javadoc> {
options.encoding = Charsets.UTF_8.name()
}

withType<ProcessResources> {
filteringCharset = Charsets.UTF_8.name()
}

withType<Test> {
minHeapSize = "2g"
maxHeapSize = "2g"
}
}

repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/groups/public/")
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://ci.emc.gs/nexus/content/groups/aikar/")
maven("https://repo.aikar.co/content/groups/aikar")
maven("https://repo.md-5.net/content/repositories/releases/")
maven("https://hub.spigotmc.org/nexus/content/groups/public/")
maven("https://jitpack.io")
maven("https://oss.sonatype.org/content/repositories/snapshots/")
}

}

paperweight {
serverProject.set(project(":plazma-server"))

remapRepo.set("https://maven.fabricmc.net/")
decompileRepo.set("https://files.minecraftforge.net/maven/")

usePaperUpstream(providers.gradleProperty("paperCommit")) {
withPaperPatcher {
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
apiOutputDir.set(layout.projectDirectory.dir("Plazma-API"))

serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
serverOutputDir.set(layout.projectDirectory.dir("Plazma-Server"))
}
}
}

tasks {
generateDevelopmentBundle {
apiCoordinates.set("org.plazmamc.plazma:plazma-api")
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
libraryRepositories.addAll(
"https://repo.maven.apache.org/maven2/",
"https://papermc.io/repo/repository/maven-public/"
)
}

register("updateUpstream") {
val tempDir = layout.cacheDir("updateUpstream");
val file = "gradle.properties";

doFirst {
val apiResponse = layout.cache.resolve("apiResponse.json");
download.get().download("https://api.github.com/repos/PaperMC/Paper/commits/master", apiResponse);
val latestCommit = gson.fromJson<paper.libs.com.google.gson.JsonObject>(apiResponse)["sha"].asString;

copy {
from(file)
into(tempDir)
filter { line: String ->
line.replace("paperCommit = .*".toRegex(), "paperCommit = $latestCommit")
}
}
}

doLast {
copy {
from(tempDir.file("gradle.properties"))
into(project.file(file).parent)
}
}
}
}

0 comments on commit 32dc8ec

Please sign in to comment.