-
-
Notifications
You must be signed in to change notification settings - Fork 641
/
build.gradle.kts
84 lines (64 loc) · 2.03 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
plugins {
id("java")
id("fabric-loom") version("1.7.3") apply(false)
}
val MINECRAFT_VERSION by extra { "1.21.1" }
val NEOFORGE_VERSION by extra { "21.1.58" }
val FABRIC_LOADER_VERSION by extra { "0.16.4" }
val FABRIC_API_VERSION by extra { "0.103.0+1.21.1" }
// This value can be set to null to disable Parchment.
// TODO: Re-add Parchment
val PARCHMENT_VERSION by extra { null }
// https://semver.org/
val MOD_VERSION by extra { "1.8.1" }
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.irisshaders"
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(21)
}
// Disables Gradle's custom module metadata from being published to maven. The
// metadata includes mapped dependencies which are not reasonably consumable by
// other mod developers.
tasks.withType<GenerateModuleMetadata>().configureEach {
enabled = false
}
}