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
/
Copy pathbuild.gradle.kts
254 lines (210 loc) · 7.27 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
import net.darkhax.curseforgegradle.TaskPublishCurseForge
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
val kotlinVersion: String by System.getProperties()
kotlin("jvm").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 cache2kVersion: String by project
val prometheusVersion: String by project
val nightConfigVersion: String by project
val clothConfigVersion: String by project
val clothApiVersion: String by project
val modMenuVersion: String by project
val scLibraryVersion: String by project
val archivesBaseName = "sc-peripherals"
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")
}
}
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") {
// mod-menu
content {
includeGroup("com.terraformersmc")
}
}
}
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))
// CC: Tweaked
modApi("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))
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))
implementation(include("org.cache2k", "cache2k-api", cache2kVersion))
implementation(include("org.cache2k", "cache2k-core", cache2kVersion))
implementation(include("io.prometheus", "simpleclient", prometheusVersion))
implementation(include("io.prometheus", "simpleclient_hotspot", prometheusVersion))
implementation(include("io.prometheus", "simpleclient_httpserver", prometheusVersion))
}
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-peripherals.accesswidener"))
sourceSets {
main {
resources {
srcDir("src/generated/resources")
exclude("src/generated/resources/.cache")
}
}
}
runs {
configureEach {
property("fabric.debug.disableModShuffle")
// vmArgs("-XX:+AllowEnhancedClassRedefinition")
}
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")
}
}
}
}
modrinth {
token.set(findProperty("modrinthApiKey") as String? ?: "")
projectId.set("OvQeJciX")
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-peripherals/commits/$minecraftVersion).")
gameVersions.add(minecraftVersion)
loaders.add("fabric")
syncBodyFrom.set(provider {
file("README.md").readText()
.replace("img/header.png", "https://cdn.modrinth.com/data/OvQeJciX/images/ba615a2fdb61b935fc7aab15ed69291a7b32b266.png")
})
dependencies {
required.project("fabric-api")
required.project("fabric-language-kotlin")
required.project("cc-tweaked")
}
}
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("807669", 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-peripherals/commits/$minecraftVersion)."
mainFile.changelogType = "markdown"
mainFile.addGameVersion(minecraftVersion)
mainFile.addRequirement("fabric-api")
mainFile.addRequirement("fabric-language-kotlin")
mainFile.addRequirement("cc-tweaked")
}
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")
}
}
}
}