-
Notifications
You must be signed in to change notification settings - Fork 99
/
build.gradle.kts
173 lines (144 loc) · 4.19 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
import com.modrinth.minotaur.dependencies.ModDependency
import lambdynamiclights.Constants
import lambdynamiclights.Utils
import net.darkhax.curseforgegradle.TaskPublishCurseForge
plugins {
id("lambdynamiclights")
`maven-publish`
id("com.gradleup.shadow").version("8.3.3")
id("com.modrinth.minotaur").version("2.+")
id("net.darkhax.curseforgegradle").version("1.1.+")
}
base.archivesName.set(Constants.NAME)
if (!(System.getenv("CURSEFORGE_TOKEN") != null || System.getenv("MODRINTH_TOKEN") != null || System.getenv("LDL_MAVEN") != null)) {
version = (version as String) + "-local"
}
logger.lifecycle("Preparing version ${version}...")
repositories {
mavenLocal()
maven {
name = "Terraformers"
url = uri("https://maven.terraformersmc.com/releases/")
}
maven {
name = "ParchmentMC"
url = uri("https://maven.parchmentmc.org")
}
}
loom {
accessWidenerPath = file("src/main/resources/lambdynlights.accesswidener")
}
dependencies {
implementation(project(":api", configuration = "namedElements"))
modImplementation(libs.fabric.api)
implementation(libs.nightconfig.core)
implementation(libs.nightconfig.toml)
modImplementation(libs.spruceui)
include(libs.spruceui)
modImplementation(libs.pridelib)
include(libs.pridelib)
modImplementation(libs.modmenu) {
this.isTransitive = false
}
shadow(project(":api", configuration = "namedElements")) {
isTransitive = false
}
shadow(libs.yumi.commons.core) {
isTransitive = false
}
shadow(libs.yumi.commons.collections) {
isTransitive = false
}
shadow(libs.yumi.commons.event) {
isTransitive = false
}
shadow(libs.nightconfig.core)
shadow(libs.nightconfig.toml)
}
tasks.processResources {
val version = project.version
inputs.property("version", version)
filesMatching("fabric.mod.json") {
expand("version" to version)
}
}
tasks.shadowJar {
dependsOn(tasks.jar)
configurations = listOf(project.configurations["shadow"])
destinationDirectory.set(file("${project.layout.buildDirectory.get()}/devlibs"))
archiveClassifier.set("dev")
relocate("com.electronwill.nightconfig", "dev.lambdaurora.lambdynlights.shadow.nightconfig")
}
tasks.remapJar {
dependsOn(tasks.shadowJar)
}
modrinth {
projectId = project.property("modrinth_id") as String
versionName = "LambDynamicLights ${Constants.VERSION} (${Constants.mcVersion()})"
uploadFile.set(tasks.remapJar.get())
loaders.set(listOf("fabric", "quilt"))
gameVersions.set(listOf(Constants.mcVersion()))
versionType.set(Constants.getVersionType())
syncBodyFrom.set(Utils.parseReadme(project))
dependencies.set(
listOf(
ModDependency("P7dR8mSH", "required")
)
)
// Changelog fetching
val changelogContent = Utils.fetchChangelog(project)
if (changelogContent != null) {
changelog.set(changelogContent)
} else {
afterEvaluate {
tasks.modrinth.get().isEnabled = false
}
}
}
tasks.modrinth {
dependsOn(tasks.modrinthSyncBody)
}
tasks.register<TaskPublishCurseForge>("curseforge") {
this.group = "publishing"
val token = System.getenv("CURSEFORGE_TOKEN")
if (token != null) {
this.apiToken = token
} else {
this.isEnabled = false
return@register
}
// Changelog fetching
var changelogContent = Utils.fetchChangelog(project)
if (changelogContent != null) {
changelogContent = "Changelog:\n\n${changelogContent}"
} else {
this.isEnabled = false
return@register
}
val mainFile = upload(project.property("curseforge_id"), tasks.remapJar.get())
mainFile.releaseType = Constants.getVersionType()
mainFile.addGameVersion(Constants.mcVersion())
mainFile.addModLoader("Fabric", "Quilt")
mainFile.addJavaVersion("Java 21", "Java 22")
mainFile.addEnvironment("Client")
mainFile.displayName = "LambDynamicLights ${Constants.VERSION} (${Constants.mcVersion()})"
mainFile.addRequirement("fabric-api")
mainFile.addOptional("modmenu")
mainFile.addIncompatibility("optifabric")
mainFile.changelogType = "markdown"
mainFile.changelog = changelogContent
}
// Configure the maven publication.
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
groupId = "$group.lambdynamiclights"
artifactId = "lambdynamiclights-runtime"
pom {
name.set("LambDynamicLights")
description.set("Adds dynamic lighting to Minecraft.")
}
}
}
}