-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
142 lines (123 loc) · 5.09 KB
/
build.gradle.kts
File metadata and controls
142 lines (123 loc) · 5.09 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
137
138
139
140
141
142
plugins {
`maven-publish`
id("fabric-loom")
id("me.modmuss50.mod-publish-plugin")
}
version = "${property("mod.version")}+${stonecutter.current.version}"
base.archivesName = property("mod.id") as String
repositories {
mavenCentral()
fun strictMaven(url: String, alias: String, vararg groups: String) = exclusiveContent {
forRepository { maven(url) { name = alias } }
filter { groups.forEach(::includeGroup) }
}
strictMaven("https://api.modrinth.com/maven", "Modrinth", "maven.modrinth")
maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1")
exclusiveContent {
forRepository {
maven {
url = uri("https://maven.azureaaron.net/releases")
}
}
filter {
includeGroup("net.azureaaron")
}
}
}
dependencies {
minecraft("com.mojang:minecraft:${stonecutter.current.version}")
mappings(loom.officialMojangMappings())
modImplementation("net.fabricmc:fabric-loader:${property("deps.fabric_loader")}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${property("deps.fabric_api")}")
modImplementation("maven.modrinth:midnightlib:${property("deps.midnightlib_version")}")
include("maven.modrinth:midnightlib:${property("deps.midnightlib_version")}")
modImplementation("net.azureaaron:hm-api:${property("deps.hm_api_version")}")
include("net.azureaaron:hm-api:${property("deps.hm_api_version")}")
modRuntimeOnly("me.djtheredstoner:DevAuth-fabric:1.2.2")
modRuntimeOnly("maven.modrinth:modmenu:${property("deps.modmenu_version")}")
}
loom {
decompilerOptions.named("vineflower") {
options.put("mark-corresponding-synthetics", "1") // Adds names to lambdas - useful for mixins
}
runConfigs.all {
ideConfigGenerated(true)
vmArgs("-Dmixin.debug.export=true") // Exports transformed classes for debugging
runDir = "../../run" // Shares the run directory between versions
}
}
java {
withSourcesJar()
val java = if (stonecutter.eval(stonecutter.current.version, ">=1.20.5"))
JavaVersion.VERSION_21 else JavaVersion.VERSION_17
targetCompatibility = java
sourceCompatibility = java
}
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"))
inputs.property("fabricloader", project.property("deps.fabric_loader"))
inputs.property("midnightlib", project.property("deps.midnightlib_version"))
inputs.property("fabric_api", project.property("deps.fabric_api"))
inputs.property("hm_api", project.property("deps.hm_api_version"))
val props = 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"),
"fabricloader" to project.property("deps.fabric_loader"),
"midnightlib" to project.property("deps.midnightlib_version"),
"fabric_api" to project.property("deps.fabric_api"),
"hm_api" to project.property("deps.hm_api_version"),
)
filesMatching("fabric.mod.json") { expand(props) }
}
jar {
from("LICENSE") {
rename { fileName -> "${fileName}_${project.property("mod.id")}" }
}
}
// Builds the version into a shared folder in `build/libs/${mod version}/`
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")
}
}
publishMods {
file = tasks.remapJar.map { it.archiveFile.get() }
additionalFiles.from(tasks.remapSourcesJar.map { it.archiveFile.get() })
displayName = "${property("mod.name")} ${property("mod.version")} for ${stonecutter.current.version}"
version = property("mod.version") as String
changelog = rootProject.file("CHANGELOG.md").readText()
type = STABLE
modLoaders.add("fabric")
dryRun = providers.environmentVariable("MODRINTH_TOKEN").getOrNull() == null
|| providers.environmentVariable("CURSEFORGE_TOKEN").getOrNull() == null
modrinth {
projectId = property("publish.modrinth") as String
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
minecraftVersions.add(stonecutter.current.version)
requires {
slug = "P7dR8mSH" // Fabric API
}
optional {
slug = "mOgUt4GM" // ModMenu
}
}
curseforge {
projectId = property("publish.curseforge") as String
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
minecraftVersions.add(stonecutter.current.version)
requires {
slug = "fabric-api"
}
optional {
slug = "modmenu"
}
}
}