This repository has been archived by the owner on Sep 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle.kts
285 lines (234 loc) · 8.32 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
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
import net.darkhax.curseforgegradle.TaskPublishCurseForge
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
val kotlinVersion: String by System.getProperties()
kotlin("jvm").version(kotlinVersion)
kotlin("plugin.serialization").version(kotlinVersion)
id("fabric-loom") version "1.6-SNAPSHOT"
id("maven-publish")
id("signing")
id("com.modrinth.minotaur") version "2.+"
id("net.darkhax.curseforgegradle") version "1.0.11"
}
val modVersion: String by project
val mavenGroup: String by project
val minecraftVersion: String by project
val minecraftTargetVersion: String by project
val yarnMappings: String by project
val loaderVersion: String by project
val fabricKotlinVersion: String by project
val fabricVersion: String by project
val ccVersion: String by project
val ccMcVersion: String by project
val ccTargetVersion: String by project
val nightConfigVersion: String by project
val clothConfigVersion: String by project
val clothApiVersion: String by project
val modMenuVersion: String by project
val trinketsVersion: String by project
val cardinalComponentsVersion: String by project
val scLibraryVersion: String by project
val scTextVersion: String by project
val fabricPermissionsApiVersion: String by project
val kotlinSerializationVersion: String by project
val annotationsVersion: String by project
val archivesBaseName = "sc-goodies"
version = modVersion
group = mavenGroup
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "17"
apiVersion = "1.9"
languageVersion = "1.9"
}
}
repositories {
mavenLocal {
content {
includeModule("io.sc3", "sc-library")
includeModule("io.sc3", "sc-text")
}
}
maven {
url = uri("https://repo.lem.sh/releases")
content {
includeGroup("io.sc3")
}
}
maven("https://squiddev.cc/maven") {
content {
includeGroup("cc.tweaked")
includeModule("org.squiddev", "Cobalt")
}
}
maven("https://maven.shedaniel.me") {
// cloth-config
content {
includeGroup("me.shedaniel.cloth")
includeGroup("me.shedaniel.cloth.api")
}
}
maven("https://maven.terraformersmc.com") {
// Trinkets, mod-menu
content {
includeModule("dev.emi", "trinkets")
includeGroup("com.terraformersmc")
}
}
maven("https://maven.ladysnake.org/releases") {
// Cardinal Components API (dependency of Trinkets)
content {
includeGroup("dev.onyxstudios.cardinal-components-api")
}
}
maven("https://oss.sonatype.org/content/repositories/snapshots") {
content {
includeModule("me.lucko", "fabric-permissions-api")
}
}
}
dependencies {
minecraft("com.mojang", "minecraft", minecraftVersion)
mappings("net.fabricmc", "yarn", yarnMappings, null, "v2")
modImplementation("net.fabricmc", "fabric-loader", loaderVersion)
modImplementation("net.fabricmc.fabric-api", "fabric-api", fabricVersion) {
exclude("net.fabricmc.fabric-api", "fabric-gametest-api-v1")
}
modImplementation("net.fabricmc", "fabric-language-kotlin", fabricKotlinVersion)
modImplementation(include("io.sc3", "sc-library", scLibraryVersion))
modImplementation("cc.tweaked:cc-tweaked-$ccMcVersion-fabric:$ccVersion") {
exclude("net.fabricmc.fabric-api", "fabric-gametest-api-v1")
}
modRuntimeOnly("cc.tweaked:cc-tweaked-$ccMcVersion-fabric:$ccVersion") {
exclude("net.fabricmc.fabric-api", "fabric-gametest-api-v1")
}
implementation(include("com.electronwill.night-config", "core", nightConfigVersion))
implementation(include("com.electronwill.night-config", "toml", nightConfigVersion))
modImplementation("dev.emi:trinkets:${trinketsVersion}")
modApi("me.shedaniel.cloth:cloth-config-fabric:$clothConfigVersion") {
exclude("net.fabricmc.fabric-api")
}
include("me.shedaniel.cloth", "cloth-config-fabric", clothConfigVersion)
modImplementation(include("me.shedaniel.cloth.api", "cloth-utils-v1", clothApiVersion))
modImplementation(include("com.terraformersmc", "modmenu", modMenuVersion))
modImplementation(include("me.lucko", "fabric-permissions-api", fabricPermissionsApiVersion))
modImplementation(include("dev.onyxstudios.cardinal-components-api", "cardinal-components-base", cardinalComponentsVersion))
modImplementation(include("dev.onyxstudios.cardinal-components-api", "cardinal-components-entity", cardinalComponentsVersion))
implementation("org.jetbrains", "annotations", annotationsVersion)
implementation("org.jetbrains.kotlinx", "kotlinx-serialization-json", kotlinSerializationVersion)
modImplementation(include("io.sc3", "sc-text", scTextVersion))
}
tasks {
processResources {
inputs.property("version", project.version)
filesMatching("fabric.mod.json") { expand(mutableMapOf(
"version" to project.version,
"minecraft_target_version" to minecraftTargetVersion,
"fabric_kotlin_version" to fabricKotlinVersion,
"loader_version" to loaderVersion,
"cc_target_version" to ccTargetVersion,
)) }
}
jar {
from("LICENSE") {
rename { "${it}_${archivesBaseName}" }
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE
exclude("META-INF/INDEX.LIST", "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA", "module-info.class")
}
remapJar {
exclude("META-INF/INDEX.LIST", "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA", "module-info.class")
destinationDirectory.set(file("${rootDir}/build/final"))
}
loom {
accessWidenerPath.set(file("src/main/resources/sc-goodies.accesswidener"))
sourceSets {
main {
resources {
srcDir("src/generated/resources")
exclude("src/generated/resources/.cache")
}
}
}
runs {
configureEach {
property("fabric.debug.disableModShuffle")
}
create("datagen") {
client()
name("Data Generation")
vmArgs(
"-Dfabric-api.datagen",
"-Dfabric-api.datagen.output-dir=${file("src/generated/resources")}",
"-Dfabric-api.datagen.modid=${archivesBaseName}"
)
runDir("build/datagen")
}
named("client") {
property("mixin.debug.export", "true")
}
}
}
}
modrinth {
token.set(findProperty("modrinthApiKey") as String? ?: "")
projectId.set("glA8M6fC")
versionNumber.set("$minecraftVersion-$modVersion")
versionName.set(modVersion)
versionType.set("release")
uploadFile.set(tasks.remapJar as Any)
changelog.set("Release notes can be found on the [GitHub repository](https://github.com/SwitchCraftCC/sc-goodies/commits/$minecraftVersion).")
gameVersions.add(minecraftVersion)
loaders.add("fabric")
syncBodyFrom.set(provider {
file("README.md").readText()
.replace("img/header.png", "https://cdn.modrinth.com/data/glA8M6fC/images/4a678749f05541893dcba84ea92b8740644e57e9.png")
})
dependencies {
required.project("fabric-api")
required.project("fabric-language-kotlin")
required.project("trinkets")
}
}
tasks.modrinth { dependsOn(tasks.modrinthSyncBody) }
tasks.publish { dependsOn(tasks.modrinth) }
val publishCurseForge by tasks.registering(TaskPublishCurseForge::class) {
group = PublishingPlugin.PUBLISH_TASK_GROUP
description = "Upload artifacts to CurseForge"
apiToken = findProperty("curseForgeApiKey") as String? ?: ""
enabled = apiToken != ""
val mainFile = upload("807667", tasks.remapJar.get().archiveFile)
dependsOn(tasks.remapJar)
mainFile.releaseType = "release"
mainFile.changelog = "Release notes can be found on the [GitHub repository](https://github.com/SwitchCraftCC/sc-goodies/commits/$minecraftVersion)."
mainFile.changelogType = "markdown"
mainFile.addGameVersion(minecraftVersion)
mainFile.addRequirement("fabric-api")
mainFile.addRequirement("fabric-language-kotlin")
mainFile.addRequirement("trinkets")
}
tasks.publish { dependsOn(publishCurseForge) }
publishing {
publications {
register("mavenJava", MavenPublication::class) {
from(components["java"])
}
}
repositories {
maven {
name = "lemmmyRepo"
url = uri("https://repo.lem.sh/releases")
if (!System.getenv("MAVEN_USERNAME").isNullOrEmpty()) {
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
} else {
credentials(PasswordCredentials::class)
}
authentication {
create<BasicAuthentication>("basic")
}
}
}
}