-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
109 lines (89 loc) · 2.75 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
@file:Suppress("SpellCheckingInspection")
import java.text.SimpleDateFormat
import java.util.*
var envVersion: String = System.getenv("VERSION") ?: "9.9.9"
if (envVersion.startsWith("v"))
envVersion = envVersion.trimStart('v')
val isRelease: Boolean = (System.getenv("RELEASE") ?: "false").equals("true", true)
fun prop(name: String): String {
if (project.properties.containsKey(name))
return project.property(name) as String;
return "";
}
plugins {
id("idea")
id("eclipse")
id("maven-publish")
id("java-library")
alias(neoforged.plugins.moddev)
}
base {
archivesName.set("ui")
group = "dev.compactmods.gander"
version = envVersion
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
neoForge {
version = neoforged.versions.neoforge
parchment {
minecraftVersion = libs.versions.parchmentMC
mappingsVersion = libs.versions.parchment
}
}
repositories {
mavenLocal()
}
dependencies {
implementation(project(":core"))
implementation(project(":levels"))
implementation(project(":rendering"))
}
tasks.withType<ProcessResources> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.compilerArgs.addAll(arrayOf("-Xmaxerrs", "1000"))
}
tasks.withType<Jar> {
val gitVersion = providers.exec {
commandLine("git", "rev-parse", "HEAD")
}.standardOutput.asText.get().trimEnd()
manifest {
from("src/main/resources/META-INF/MANIFEST.MF")
val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date())
val name = prop("mod_name")
val attrs = mapOf<String, Any>(
"Specification-Title" to name,
"Specification-Vendor" to "CompactMods",
"Specification-Version" to "1",
"Implementation-Title" to name,
"Implementation-Version" to envVersion,
"Implementation-Vendor" to "CompactMods",
"Implementation-Timestamp" to now,
"Minecraft-Version" to mojang.versions.minecraft.get(),
"NeoForge-Version" to neoforged.versions.neoforge.get(),
"Main-Commit" to gitVersion,
"FMLModType" to "GAMELIBRARY"
)
attributes(attrs)
}
}
val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/gander"
publishing {
publications.register<MavenPublication>("levels") {
from(components.getByName("java"))
}
repositories {
// GitHub Packages
maven(PACKAGES_URL) {
name = "GitHubPackages"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}