forked from IrisShaders/Iris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
83 lines (65 loc) · 2.1 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
plugins {
id("java")
id("fabric-loom") version("1.7.2") apply(false)
}
val MINECRAFT_VERSION by extra { "1.21.1" }
val NEOFORGE_VERSION by extra { "21.1.19" }
val FABRIC_LOADER_VERSION by extra { "0.16.0" }
val FABRIC_API_VERSION by extra { "0.102.0+1.21.1" }
val SODIUM_FILE by extra { "sodium-LOADER-0.6.0-snapshot+mc1.21-local.jar" }
// https://semver.org/
val MOD_VERSION by extra { "1.8.0-beta.2" }
allprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
subprojects {
apply(plugin = "maven-publish")
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
repositories {
maven {
name = "ParchmentMC"
url = uri("https://maven.parchmentmc.org")
}
}
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
}
}