-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
113 lines (90 loc) · 2.74 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
107
108
109
110
111
112
113
object Constants {
const val VERSION = "0.4.4"
const val VERSION_JAVA = 21
const val VERSION_MINECRAFT = "1.21.4"
}
plugins {
id("fabric-loom") version "1.9.2"
}
base {
group = "io.github.startsmercury.visual_snowy_leaves"
archivesName = "visual-snowy-leaves"
version = createVersionString()
}
java {
withSourcesJar()
toolchain {
languageVersion = JavaLanguageVersion.of(Constants.VERSION_JAVA)
}
}
loom {
accessWidenerPath = file("src/client/resources/visual-snowy-leaves.accesswidener")
runtimeOnlyLog4j = true
splitEnvironmentSourceSets()
mods.register("visual-snowy-leaves") {
sourceSet("main")
sourceSet("client")
}
}
repositories {
maven {
name = "Terraformers Maven"
url = uri("https://maven.terraformersmc.com")
content {
includeGroup("com.terraformersmc")
}
}
maven {
name = "Modrinth Maven"
url = uri("https://api.modrinth.com/maven")
content {
includeGroup("maven.modrinth")
}
}
}
dependencies {
minecraft("com.mojang:minecraft:${Constants.VERSION_MINECRAFT}")
mappings(loom.officialMojangMappings())
modImplementation("net.fabricmc:fabric-loader:0.16.10")
modImplementation(fabricApi.module("fabric-resource-loader-v0", "0.115.1+1.21.4"))
modImplementation("com.terraformersmc:modmenu:13.0.1")
modRuntimeOnly(fabricApi.module("fabric-screen-api-v1", "0.115.1+1.21.4"))
modRuntimeOnly(fabricApi.module("fabric-key-binding-api-v1", "0.115.1+1.21.4"))
modRuntimeOnly(fabricApi.module("fabric-lifecycle-events-v1", "0.115.1+1.21.4"))
modCompileOnly("maven.modrinth:sodium:mc1.21.4-0.6.6-fabric")
}
tasks.withType<ProcessResources> {
val data = mapOf(
"version" to Constants.VERSION,
"version_java" to Constants.VERSION_JAVA,
"version_minecraft" to Constants.VERSION_MINECRAFT,
)
inputs.properties(data)
filesMatching("fabric.mod.json") {
expand(data)
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release = Constants.VERSION_JAVA
}
fun createVersionString(): String {
val builder = StringBuilder()
val isReleaseBuild = project.hasProperty("build.release")
val buildId = System.getenv("GITHUB_RUN_NUMBER")
if (isReleaseBuild) {
builder.append(Constants.VERSION)
} else {
builder.append(Constants.VERSION.substringBefore('-'))
builder.append("-snapshot")
}
builder.append("+mc").append(Constants.VERSION_MINECRAFT)
if (!isReleaseBuild) {
if (buildId != null) {
builder.append("-build.${buildId}")
} else {
builder.append("-local")
}
}
return builder.toString()
}