-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
106 lines (88 loc) · 2.84 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import io.papermc.paperweight.util.*
import io.papermc.paperweight.util.constants.*
plugins {
java
id("com.github.johnrengelman.shadow") version "8.1.1"
id("io.papermc.paperweight.patcher") version "1.5.4"
}
allprojects {
apply(plugin = "java")
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
}
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
repositories {
mavenCentral()
maven(paperMavenPublicUrl) {
content {
onlyForConfigurations(PAPERCLIP_CONFIG)
}
}
}
dependencies {
remapper("net.fabricmc:tiny-remapper:0.8.6:fat")
decompiler("net.minecraftforge:forgeflower:2.0.629.0")
paperclip("io.papermc:paperclip:3.0.3")
}
subprojects {
tasks.withType<JavaCompile>().configureEach {
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)
maven("https://jitpack.io")
}
}
paperweight {
serverProject.set(project(":zilla-server"))
remapRepo.set(paperMavenPublicUrl)
decompileRepo.set(paperMavenPublicUrl)
useStandardUpstream("Kaiiju") {
url.set(github("KaiijuMC", "Kaiiju"))
ref.set(providers.gradleProperty("kaiijuRef"))
withStandardPatcher {
baseName("Kaiiju")
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
apiOutputDir.set(layout.projectDirectory.dir("zilla-api"))
serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
serverOutputDir.set(layout.projectDirectory.dir("zilla-server"))
}
}
}
tasks.register("kaiijuRefLatest") {
// Update the kaiijuRef in gradle.properties to be the latest commit.
val tempDir = layout.cacheDir("kaiijuRefLatest");
val file = "gradle.properties";
doFirst {
data class GithubCommit(
val sha: String
)
val kaiijuLatestCommitJson = layout.cache.resolve("kaiijuLatestCommit.json");
download.get().download("https://api.github.com/repos/KaiijuMC/Kaiiju/commits/ver/1.20.1", kaiijuLatestCommitJson);
val kaiijuLatestCommit = gson.fromJson<paper.libs.com.google.gson.JsonObject>(kaiijuLatestCommitJson)["sha"].asString;
copy {
from(file)
into(tempDir)
filter { line: String ->
line.replace("kaiijuRef = .*".toRegex(), "kaiijuRef = $kaiijuLatestCommit")
}
}
}
doLast {
copy {
from(tempDir.file("gradle.properties"))
into(project.file(file).parent)
}
}
}