-
-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathbuild.gradle.kts
89 lines (70 loc) · 2.14 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
plugins {
id("java")
id("fabric-loom") version ("1.8.9") apply (false)
}
val MINECRAFT_VERSION by extra { "1.21.4" }
val NEOFORGE_VERSION by extra { "21.4.2-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.
val PARCHMENT_VERSION by extra { null }
// https://semver.org/
val MAVEN_GROUP by extra { "me.flashyreese.mods" }
val ARCHIVE_NAME by extra { "sodium-extra" }
val MOD_VERSION by extra { "0.6.1" }
val SODIUM_VERSION by extra { "mc1.21.4-0.6.2" }
allprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")
group = MAVEN_GROUP
version = createVersionString()
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
subprojects {
apply(plugin = "maven-publish")
repositories {
maven("https://maven.parchmentmc.org/")
maven("https://api.modrinth.com/maven")
maven("https://libraries.minecraft.net")
}
base {
archivesName = "$ARCHIVE_NAME-${project.name}"
}
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
tasks.processResources {
filesMatching("META-INF/neoforge.mods.toml") {
expand(mapOf("version" to createVersionString()))
}
}
version = createVersionString()
group = "me.flashyreese.mods"
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(21)
}
tasks.withType<GenerateModuleMetadata>().configureEach {
enabled = false
}
}
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.split('-')[0])
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()
}