-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
121 lines (102 loc) · 2.74 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
110
111
112
113
114
115
116
117
118
119
120
121
import java.time.Instant
plugins {
id("fabric-loom") version "0.10.64"
id("net.nemerosa.versioning") version "2.15.1"
id("signing")
}
group = "dev.sapphic"
version = "4.0.0"
java {
withSourcesJar()
}
repositories {
maven("https://maven.terraformersmc.com/releases") {
content {
includeGroup("com.terraformersmc")
}
}
}
dependencies {
minecraft("com.mojang:minecraft:1.18.1")
mappings(loom.officialMojangMappings())
modImplementation("net.fabricmc:fabric-loader:0.12.9")
implementation("org.jetbrains:annotations:23.0.0")
implementation("org.checkerframework:checker-qual:3.20.0")
modRuntimeOnly("com.terraformersmc:modmenu:3.0.0")
}
tasks {
compileJava {
with(options) {
release.set(8)
isFork = true
isDeprecation = true
encoding = "UTF-8"
compilerArgs.addAll(listOf("-Xlint:all", "-parameters"))
}
}
processResources {
filesMatching("/fabric.mod.json") {
expand("version" to project.version)
}
}
jar {
from("/LICENSE")
manifest.attributes(
"Build-Timestamp" to Instant.now(),
"Build-Revision" to versioning.info.commit,
"Build-Jvm" to "${
System.getProperty("java.version")
} (${
System.getProperty("java.vendor")
} ${
System.getProperty("java.vm.version")
})",
"Built-By" to GradleVersion.current(),
"Implementation-Title" to project.name,
"Implementation-Version" to project.version,
"Implementation-Vendor" to project.group,
"Specification-Title" to "FabricMod",
"Specification-Version" to "1.0.0",
"Specification-Vendor" to project.group,
"Sealed" to "true"
)
}
remapJar {
archiveClassifier.set("fabric")
}
named<Jar>("sourcesJar") {
archiveClassifier.set("fabric-${archiveClassifier.get()}")
}
if (hasProperty("signing.mods.keyalias")) {
val alias = property("signing.mods.keyalias")
val keystore = property("signing.mods.keystore")
val password = property("signing.mods.password")
listOf(remapJar, remapSourcesJar).forEach {
it.get().doLast {
if (!project.file(keystore!!).exists()) {
error("Missing keystore $keystore")
}
val file = outputs.files.singleFile
ant.invokeMethod(
"signjar", mapOf(
"jar" to file,
"alias" to alias,
"storepass" to password,
"keystore" to keystore,
"verbose" to true,
"preservelastmodified" to true
)
)
signing.sign(file)
}
}
}
assemble {
dependsOn(versionFile, remapJar, remapSourcesJar)
doFirst {
delete(buildDir.resolve("libs").listFiles { _, name ->
name.endsWith("-dev.jar")
})
}
}
}