-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
189 lines (176 loc) · 6.53 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
import com.matthewprenger.cursegradle.CurseArtifact
import com.matthewprenger.cursegradle.CurseProject
import com.matthewprenger.cursegradle.CurseRelation
import com.matthewprenger.cursegradle.Options
import org.jetbrains.kotlin.cli.common.toBooleanLenient
plugins {
id("fabric-loom")
val kotlinVersion: String by System.getProperties()
kotlin("jvm").version(kotlinVersion)
id("com.modrinth.minotaur") version "2.+"
id("com.matthewprenger.cursegradle") version "1.4.0"
}
base {
val archivesBaseName: String by project
archivesName.set(archivesBaseName)
}
val log: File = file("changelog.md")
val modVersion: String by project
version = modVersion
val mavenGroup: String by project
group = mavenGroup
println("## Changelog for ${base.archivesName.get()} $modVersion \n\n" + log.readText())
println(base.archivesName.get().replace('_','-'))
repositories {
maven {
name = "FallenBreath"
url = uri("https://maven.fallenbreath.me/releases")
}
maven {
name = "Modrinth"
url = uri("https://api.modrinth.com/maven")
content {
includeGroup("maven.modrinth")
}
}
maven {
name = "Jitpack"
url = uri("https://jitpack.io")
}
mavenCentral()
}
dependencies {
val guavaVersion: String by project
implementation("com.google.guava:guava:$guavaVersion")
val minecraftVersion: String by project
minecraft("com.mojang:minecraft:$minecraftVersion")
val yarnMappings: String by project
mappings("net.fabricmc:yarn:$yarnMappings:v2")
val loaderVersion: String by project
modImplementation("net.fabricmc:fabric-loader:$loaderVersion")
val fabricVersion: String by project
modImplementation("net.fabricmc.fabric-api:fabric-api:$fabricVersion")
val fabricKotlinVersion: String by project
modImplementation("net.fabricmc:fabric-language-kotlin:$fabricKotlinVersion")
val fzzyConfigVersion: String by project
modImplementation("maven.modrinth:fzzy-config:$fzzyConfigVersion") {
exclude("net.fabricmc.fabric-api")
}
val cmVersion: String by project
implementation("me.fallenbreath:conditional-mixin:$cmVersion")
include("me.fallenbreath:conditional-mixin:$cmVersion")
runtimeOnly("net.peanuuutz.tomlkt:tomlkt:0.3.7")
runtimeOnly("blue.endless:jankson:1.2.3")
}
tasks {
val javaVersion = JavaVersion.VERSION_21
withType<JavaCompile> {
options.encoding = "UTF-8"
sourceCompatibility = javaVersion.toString()
targetCompatibility = javaVersion.toString()
options.release.set(javaVersion.toString().toInt())
}
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions { jvmTarget = javaVersion.toString() }
}
jar {
from("LICENSE") { rename { "${base.archivesName.get()}_${it}" } }
}
jar {
from( "credits.txt") { rename { "${base.archivesName.get()}_${it}" } }
}
processResources {
val loaderVersion: String by project
val fabricKotlinVersion: String by project
val fzzyConfigVersion: String by project
inputs.property("version", project.version)
inputs.property("id", base.archivesName.get())
inputs.property("loaderVersion", loaderVersion)
inputs.property("fabricKotlinVersion", fabricKotlinVersion)
inputs.property("fzzyConfigVersion", fzzyConfigVersion)
filesMatching("fabric.mod.json") {
expand(mutableMapOf(
"version" to project.version,
"id" to base.archivesName.get(),
"loaderVersion" to loaderVersion,
"fabricKotlinVersion" to fabricKotlinVersion,
"fzzyConfigVersion" to fzzyConfigVersion)
)
}
}
java {
toolchain { languageVersion.set(JavaLanguageVersion.of(javaVersion.toString())) }
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
//withSourcesJar()
}
modrinth.get().group = "upload"
modrinthSyncBody.get().group = "upload"
}
if (System.getenv("MODRINTH_TOKEN") != null) {
modrinth {
val releaseType: String by project
val mcVersions: String by project
val uploadDebugMode: String by project
val modrinthSlugName: String by project
token.set(System.getenv("MODRINTH_TOKEN"))
projectId.set(modrinthSlugName)
versionNumber.set(modVersion)
versionName.set("${base.archivesName.get()}-$modVersion")
versionType.set(releaseType)
uploadFile.set(tasks.remapJar.get())
gameVersions.addAll(mcVersions.split(","))
loaders.addAll("fabric", "quilt")
detectLoaders.set(false)
changelog.set(log.readText())
dependencies {
required.project("fabric-api")
required.project("fabric-language-kotlin")
required.project("fzzy-config")
}
debugMode.set(uploadDebugMode.toBooleanLenient() ?: true)
}
}
if (System.getenv("CURSEFORGE_TOKEN") != null) {
curseforge {
val releaseType: String by project
val mcVersions: String by project
val uploadDebugMode: String by project
apiKey = System.getenv("CURSEFORGE_TOKEN")
project(closureOf<CurseProject> {
id = "985426"
changelog = log
changelogType = "markdown"
this.releaseType = releaseType
for (ver in mcVersions.split(",")){
addGameVersion(ver)
}
addGameVersion("Fabric")
addGameVersion("Quilt")
mainArtifact(tasks.remapJar.get().archiveFile.get(), closureOf<CurseArtifact> {
displayName = "${base.archivesName.get()}-$modVersion"
relations(closureOf<CurseRelation>{
this.requiredDependency("fabric-api")
this.requiredDependency("fabric-language-kotlin")
this.requiredDependency("fzzy-config")
})
})
relations(closureOf<CurseRelation>{
this.requiredDependency("fabric-api")
this.requiredDependency("fabric-language-kotlin")
this.requiredDependency("fzzy-config")
})
})
options(closureOf<Options> {
javaIntegration = false
forgeGradleIntegration = false
javaVersionAutoDetect = false
debug = uploadDebugMode.toBooleanLenient() ?: true
})
}
}
tasks.register("uploadAll") {
group = "upload"
dependsOn(tasks.modrinth.get())
dependsOn(tasks.curseforge.get())
}