Skip to content

Commit

Permalink
Fix build.gradle.kts
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaKR93 committed Feb 26, 2024
1 parent b6561c8 commit f031ff1
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,20 @@ tasks {
)
)
}

register("checkNeedsUpdate") {
var latest: String = ""

doFirst {
val commit = layout.cache.resolve("commit.json")
download.get().download("https://api.github.com/repos/PlazmaMC/PlazmaBukkit/commits/${project.properties["plazmaRef"]}", commit)
latest = gson.fromJson<paper.libs.com.google.gson.JsonObject>(commit)["sha"].asString
}

doLast {
println(latest != project.properties["plazmaCommit"])
}
}

register("updateUpstream") {
val tempDir = layout.cacheDir("updateUpstream")
Expand All @@ -147,11 +161,11 @@ tasks {

doFirst {
val commit = layout.cache.resolve("commit.json")
download.get().download("https://api.github.com/repos/PlazmaMC/PlazmaBukkit/commits/${property("plazmaRef")}", commit)
download.get().download("https://api.github.com/repos/PlazmaMC/PlazmaBukkit/commits/${project.properties["plazmaRef"]}", commit)
val latestCommit = gson.fromJson<paper.libs.com.google.gson.JsonObject>(commit)["sha"].asString

val compare = layout.cache.resolve("compare.json")
download.get().download("https://api.github.com/repos/PlazmaMC/PlazmaBukkit/compare/${property("plazmaCommit")}...${property("plazmaRef")}", compare)
download.get().download("https://api.github.com/repos/PlazmaMC/PlazmaBukkit/compare/${project.properties["plazmaCommit"]}...${project.properties["plazmaRef"]}", compare)
gson.fromJson<paper.libs.com.google.gson.JsonObject>(compare)["commits"].asJsonArray.forEach {
builder.append("PlazmaMC/PlazmaBukkit@${it.asJsonObject["sha"].asString.subSequence(0, 7)}: ${it.asJsonObject["commit"].asJsonObject["message"].asString.split("\n")[0]}\n")
}
Expand Down

0 comments on commit f031ff1

Please sign in to comment.