blob: 276d26c66a256d6e40668aa7d08d471165c038e5 (
plain)
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
import moe.nea.licenseextractificator.LicenseDiscoveryTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
java
`maven-publish`
kotlin("jvm") version "1.8.10"
kotlin("plugin.serialization") version "1.8.10"
id("dev.architectury.loom") version "1.1.336"
id("com.github.johnrengelman.shadow") version "7.1.2"
id("moe.nea.licenseextractificator")
id("io.github.juuxel.loom-quiltflower") version "1.10.0"
}
java {
withSourcesJar()
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
jvmTarget = "17"
}
val compileTestKotlin: KotlinCompile by tasks
compileTestKotlin.kotlinOptions {
jvmTarget = "17"
}
repositories {
maven("https://maven.terraformersmc.com/releases/")
maven("https://maven.shedaniel.me")
maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1")
maven("https://api.modrinth.com/maven") {
content {
includeGroup("maven.modrinth")
}
}
maven("https://repo.sleeping.town") {
content {
includeGroup("com.unascribed")
}
}
ivy("https://github.com/HotswapProjects/HotswapAgent/releases/download") {
patternLayout {
artifact("[revision]/[artifact]-[revision].[ext]")
}
content {
includeGroup("virtual.github.hotswapagent")
}
metadataSources {
artifact()
}
}
maven("https://server.bbkr.space/artifactory/libs-release")
maven("https://repo.nea.moe/releases")
mavenLocal()
}
val shadowMe by configurations.creating
val transInclude by configurations.creating {
exclude(group = "com.mojang")
exclude(group = "org.jetbrains.kotlin")
exclude(group = "org.jetbrains.kotlinx")
isTransitive = true
}
val hotswap by configurations.creating {
isVisible = false
}
val nonModImplentation by configurations.creating {
extendsFrom(shadowMe)
configurations.implementation.get().extendsFrom(this)
}
dependencies {
// Minecraft dependencies
"minecraft"(libs.minecraft)
"mappings"("net.fabricmc:yarn:${libs.versions.yarn.get()}:v2")
// Hotswap Dependency
hotswap(libs.hotswap)
// Fabric dependencies
modImplementation(libs.fabric.loader)
modImplementation(libs.fabric.kotlin)
modImplementation(libs.modmenu)
modImplementation(libs.libgui)
modImplementation(libs.lib39.core)
include(libs.lib39.core)
include(libs.libgui)
modApi(libs.fabric.api)
modApi(libs.architectury)
// Actual dependencies
modCompileOnly(libs.rei.api) {
exclude(module = "architectury")
exclude(module = "architectury-fabric")
}
shadowMe(libs.repoparser)
shadowMe(libs.bundles.dbus)
fun ktor(mod: String) = "io.ktor:ktor-$mod-jvm:${libs.versions.ktor.get()}"
transInclude(nonModImplentation(ktor("client-core"))!!)
transInclude(nonModImplentation(ktor("client-java"))!!)
transInclude(nonModImplentation(ktor("serialization-kotlinx-json"))!!)
transInclude(nonModImplentation(ktor("client-content-negotiation"))!!)
transInclude(nonModImplentation(ktor("client-encoding"))!!)
transInclude(nonModImplentation(ktor("client-logging"))!!)
// Dev environment preinstalled mods
modRuntimeOnly(libs.bundles.runtime.required)
modRuntimeOnly(libs.bundles.runtime.optional)
transInclude.resolvedConfiguration.resolvedArtifacts.forEach {
include(it.moduleVersion.id.toString())
}
}
version = rootProject.property("mod_version").toString()
group = rootProject.property("maven_group").toString()
loom {
clientOnlyMinecraftJar()
accessWidenerPath.set(project.file("src/main/resources/firmament.accesswidener"))
runs {
removeIf { it.name != "client" }
named("client") {
property("devauth.enabled", "true")
property("fabric.log.level", "info")
property("firmament.debug", "true")
vmArg("-ea")
vmArg("-XX:+AllowEnhancedClassRedefinition")
vmArg("-XX:HotswapAgent=external")
vmArg("-javaagent:${hotswap.resolve().single().absolutePath}")
}
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(17)
}
tasks.jar {
destinationDirectory.set(layout.buildDirectory.dir("badjars"))
archiveClassifier.set("slim")
}
tasks.shadowJar {
configurations = listOf(shadowMe)
archiveClassifier.set("")
relocate("io.github.moulberry.repo", "moe.nea.firmament.deps.repo")
}
tasks.remapJar {
destinationDirectory.set(layout.buildDirectory.dir("badjars"))
injectAccessWidener.set(true)
inputFile.set(tasks.shadowJar.flatMap { it.archiveFile })
dependsOn(tasks.shadowJar)
archiveClassifier.set("dev")
}
tasks.processResources {
val replacements = listOf(
"version" to project.version,
"minecraft_version" to libs.versions.minecraft.get(),
"fabric_kotlin_version" to libs.versions.fabric.kotlin.get()
).map { (k, v) -> k to v.toString() }
replacements.forEach { (key, value) -> inputs.property(key, value) }
filesMatching("**/fabric.mod.json") {
expand(*replacements.toTypedArray())
}
from(tasks.scanLicenses)
}
tasks.scanLicenses {
scanConfiguration(nonModImplentation)
scanConfiguration(configurations.modCompileClasspath.get())
outputFile.set(file("$buildDir/LICENSES-FIRMAMENT.json"))
licenseFormatter.set(moe.nea.licenseextractificator.JsonLicenseFormatter())
}
tasks.create("printAllLicenses", LicenseDiscoveryTask::class.java, licensing).apply {
outputFile.set(file("$buildDir/LICENSES-FIRMAMENT.txt"))
licenseFormatter.set(moe.nea.licenseextractificator.TextLicenseFormatter())
scanConfiguration(nonModImplentation)
scanConfiguration(configurations.modCompileClasspath.get())
doLast {
println(outputFile.get().asFile.readText())
}
outputs.upToDateWhen { false }
}
licensing.addExtraLicenseMatchers()
|