-
Notifications
You must be signed in to change notification settings - Fork 192
/
build.gradle.kts
91 lines (70 loc) · 2.3 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
plugins {
id("java")
id("fabric-loom") version ("1.8.9") apply (false)
// Mixin config plugin is a subproject for creating lithium's settings from annotations in each mixin package.
id("net.caffeinemc.mixin-config-plugin") version ("1.0-SNAPSHOT") apply (false)
}
// Fabric: https://fabricmc.net/develop/
// Neoforge: https://neoforged.net/
val MINECRAFT_VERSION by extra { "1.21.4" }
val NEOFORGE_VERSION by extra { "21.4.0-beta" }
val FABRIC_LOADER_VERSION by extra { "0.16.9" }
val FABRIC_API_VERSION by extra { "0.110.5+1.21.4" }
// This value can be set to null to disable Parchment.
// TODO: Add Parchment
val PARCHMENT_VERSION by extra { null }
// https://semver.org/
val MOD_VERSION by extra { "0.14.4" }
allprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
tasks.jar {
enabled = false
}
subprojects {
apply(plugin = "maven-publish")
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
fun createVersionString(): String {
val builder = StringBuilder()
val isReleaseBuild = project.hasProperty("build.release")
val buildId = System.getenv("GITHUB_RUN_NUMBER")
if (isReleaseBuild) {
builder.append(MOD_VERSION)
} else {
builder.append(MOD_VERSION.substringBefore('-'))
builder.append("-snapshot")
}
builder.append("+mc").append(MINECRAFT_VERSION)
if (!isReleaseBuild) {
if (buildId != null) {
builder.append("-build.${buildId}")
} else {
builder.append("-local")
}
}
return builder.toString()
}
tasks.processResources {
filesMatching("META-INF/neoforge.mods.toml") {
expand(mapOf("version" to createVersionString()))
}
}
version = createVersionString()
group = "net.caffeinemc.mods"
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(21)
}
tasks.withType<GenerateModuleMetadata>().configureEach {
enabled = false
}
//make builds more reproducible
tasks.withType<AbstractArchiveTask>().configureEach {
isReproducibleFileOrder = true
isPreserveFileTimestamps = false
}
}