forked from skies-starred/OdinClient
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
136 lines (113 loc) · 4.01 KB
/
build.gradle.kts
File metadata and controls
136 lines (113 loc) · 4.01 KB
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
@file:Suppress("UnstableApiUsage")
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.loom)
alias(libs.plugins.ksp)
alias(libs.plugins.fletchingTable)
`maven-publish`
}
val mc = stonecutter.current.version
version = "${property("mod.version")}+$mc"
base.archivesName = property("mod.id").toString()
repositories {
@Suppress("UnstableApiUsage")
fun strictMaven(url: String, vararg groups: String) = maven(url) { content { groups.forEach(::includeGroupAndSubgroups) } }
strictMaven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1", "me.djtheredstoner")
strictMaven("https://api.modrinth.com/maven", "maven.modrinth")
strictMaven("https://maven.parchmentmc.org/", "org.parchmentmc")
strictMaven("https://jitpack.io", "com.github.stivais", "com.github.odtheking", "com.github.sivthepolarfox")
}
fletchingTable {
mixins.create("main") {
mixin("default", "odinClient.mixins.json") {
env("CLIENT")
}
}
}
dependencies {
minecraft("com.mojang:minecraft:$mc")
mappings(loom.layered {
officialMojangMappings()
parchment("parchment".mc(mc))
})
modRuntimeOnly(libs.devauth)
modCompileOnly("firmament".mc(mc))
modImplementation("fabric-api".mc(mc))
modImplementation("odin-prod".mc(mc))
modImplementation(libs.fabric.loader)
modImplementation(libs.fabric.language.kotlin)
modImplementation(libs.commodore)
// needed by odin to work properly in dev env as we use modrinth which doesn't provide the transitive dependencies
modImplementation(libs.okhttp)
modImplementation(libs.okio)
modImplementation(libs.lwjgl.nanovg)
}
loom {
fabricModJsonPath = rootProject.file("src/main/resources/fabric.mod.json")
runConfigs.named("client") {
isIdeConfigGenerated = true
vmArgs.addAll(
arrayOf(
"-Dmixin.debug.export=true",
"-Ddevauth.enabled=true",
"-Ddevauth.account=main",
"-XX:+AllowEnhancedClassRedefinition"
)
)
}
runConfigs.named("server") {
isIdeConfigGenerated = false
}
}
afterEvaluate {
loom.runs.named("client") {
vmArg("-javaagent:${configurations.compileClasspath.get().find { it.name.contains("sponge-mixin") }}")
}
}
tasks {
processResources {
inputs.property("id", project.property("mod.id"))
inputs.property("name", project.property("mod.name"))
inputs.property("version", project.property("mod.version"))
inputs.property("minecraft", project.property("mod.mc_dep"))
filesMatching("fabric.mod.json") {
expand(
mapOf(
"id" to project.property("mod.id"),
"name" to project.property("mod.name"),
"version" to project.property("mod.version"),
"minecraft" to project.property("mod.mc_dep")
)
)
}
}
compileKotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
freeCompilerArgs.add("-Xlambdas=class") //Commodore
}
}
compileJava {
sourceCompatibility = "21"
targetCompatibility = "21"
options.encoding = "UTF-8"
options.compilerArgs.addAll(listOf("-Xlint:deprecation", "-Xlint:unchecked"))
}
register<Copy>("buildAndCollect") {
group = "build"
from(remapJar.map { it.archiveFile }, remapSourcesJar.map { it.archiveFile })
into(rootProject.layout.buildDirectory.file("libs/${project.property("mod.version")}"))
dependsOn("build")
}
}
fabricApi {
configureDataGeneration {
client = true
}
}
fun String.mc(mc: String): Provider<MinimalExternalModuleDependency> = project.extensions.getByType<VersionCatalogsExtension>().named("libs").findLibrary("$this-${mc.replace(".", "_")}").get()
fun DependencyHandler.shadow(dep: Any) {
include(dep)
modImplementation(dep)
}