blob: eea616011ec8b58d8cd8ae547c2ee67c902e903a (
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
|
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") version "fffc76c"
id("io.github.juuxel.loom-quiltflower") version "1.7.3"
id("io.gitlab.arturbosch.detekt") version "1.22.0"
}
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("-XX:+AllowEnhancedClassRedefinition")
vmArg("-XX:HotswapAgent=fatjar")
*/
}
}
}
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://server.bbkr.space/artifactory/libs-release")
maven("https://repo.nea.moe/releases")
mavenLocal()
}
val shadowMe by configurations.creating {
configurations.implementation.get().extendsFrom(this)
}
val transInclude by configurations.creating {
exclude(group = "com.mojang")
exclude(group = "org.jetbrains.kotlin")
exclude(group = "org.jetbrains.kotlinx")
isTransitive = true
}
dependencies {
// Minecraft dependencies
"minecraft"(libs.minecraft)
"mappings"("net.fabricmc:yarn:${libs.versions.yarn.get()}:v2")
// Fabric dependencies
modImplementation(libs.fabric.loader)
modImplementation(libs.fabric.kotlin)
modImplementation(libs.libgui)
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(implementation(ktor("client-core"))!!)
transInclude(implementation(ktor("client-java"))!!)
transInclude(implementation(ktor("serialization-kotlinx-json"))!!)
transInclude(implementation(ktor("client-content-negotiation"))!!)
// 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()
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(17)
}
java {
withSourcesJar()
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
// could not set to 17, up to 16
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
jvmTarget = "16"
}
val compileTestKotlin: KotlinCompile by tasks
compileTestKotlin.kotlinOptions {
jvmTarget = "16"
}
tasks.shadowJar {
configurations = listOf(shadowMe)
archiveClassifier.set("dev-thicc")
}
tasks.remapJar {
injectAccessWidener.set(true)
inputFile.set(tasks.shadowJar.flatMap { it.archiveFile })
dependsOn(tasks.shadowJar)
archiveClassifier.set("thicc")
}
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())
}
filesMatching("**/lang/*.json") {
// flattenJson(this)
}
from(tasks.license)
}
tasks.license {
scanConfiguration(project.configurations.compileClasspath.get())
outputFile.set(file("$buildDir/LICENSES-FIRMAMENT.json"))
licenseFormatter.set(moe.nea.licenseextractificator.JsonLicenseFormatter())
}
|