-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
161 lines (144 loc) · 5.34 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
plugins {
alias(libs.plugins.kotlin)
alias(libs.plugins.forge.gradle)
alias(libs.plugins.librarian.forgegradle)
alias(libs.plugins.mixin)
alias(libs.plugins.mod.publish)
}
version = project.property("mod_version") as String
group = project.property("maven_group") as String
base {
archivesName.set(project.property("archives_base_name") as String)
}
java {
toolchain.languageVersion = JavaLanguageVersion.of(17)
}
mixin {
add(sourceSets.main.get(), "tacztweaks.refmap.json")
config("tacztweaks.mixins.json")
}
minecraft {
accessTransformer("src/main/resources/META-INF/accesstransformer.cfg")
mappings(mapOf(
"channel" to "parchment",
"version" to "${libs.versions.parchment.get()}-${libs.versions.minecraft.asProvider().get()}"
))
runs {
configureEach {
workingDirectory(project.file("run"))
property("forge.logging.markers", "REGISTRIES")
property("forge.logging.console.level", "debug")
mods {
create("tacztweaks") {
source(sourceSets["main"])
}
}
}
val client = create("client")
create("client2") {
parent(client)
args("--username", "Dev2")
}
create("server") {
args("--nogui")
}
}
}
repositories {
mavenCentral()
maven("https://thedarkcolour.github.io/KotlinForForge")
maven("https://maven.bawnorton.com/releases")
maven("https://repo.spongepowered.org/repository/maven-public")
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = uri("https://api.modrinth.com/maven")
}
}
forRepositories(fg.repository)
filter {
includeGroup("maven.modrinth")
}
}
maven("https://maven.valkyrienskies.org")
}
dependencies {
minecraft(libs.net.minecraftforge.forge)
implementation(libs.thedarkcolour.kotlinforforge)
compileOnly(annotationProcessor(libs.com.github.bawnorton.mixinsquared.common.get())) { }
implementation(jarJar(libs.com.github.bawnorton.mixinsquared.forge.get())) {
jarJar.ranged(this, "[${libs.versions.mixinsquared.get()},)")
}
compileOnly(annotationProcessor(libs.io.github.llamalad7.mixinextras.common.get())) { }
implementation(jarJar(libs.io.github.llamalad7.mixinextras.forge.get())) {
jarJar.ranged(this, "[${libs.versions.mixinextras.get()},)")
}
annotationProcessor(variantOf(libs.org.spongepowered.mixin) { classifier("processor") })
implementation(fg.deobf(libs.modrinth.tacz.get()))
implementation(fg.deobf(libs.modrinth.firstaid.get()))
implementation(fg.deobf(libs.org.valkyrienskies.forge.get()))
compileOnly(libs.org.valkyrienskies.core.api)
compileOnly(libs.org.valkyrienskies.core.api.game)
compileOnly(libs.org.valkyrienskies.core.util)
compileOnly(libs.org.valkyrienskies.core.impl)
runtimeOnly(fg.deobf(libs.modrinth.neat.get()))
}
tasks.processResources {
val properties = mapOf(
"id" to project.property("mod_id") as String,
"version" to project.version as String,
"name" to project.property("mod_name") as String,
"minecraft_version" to libs.versions.minecraft.asProvider().get(),
"minecraft_version_range" to libs.versions.minecraft.range.get(),
"forge_version" to libs.versions.forge.asProvider().get(),
"forge_version_range" to "[${libs.versions.forge.asProvider().get().substringBefore('.')},)",
"loader_version_range" to "[${libs.versions.forge.asProvider().get().substringBefore('.')},)",
"tacz_version_range" to "(${libs.versions.tacz.previous.get()},${libs.versions.tacz.next.get()})",
"kotlinforforge_version_range" to "[${libs.versions.kotlinforforge.get().substringBeforeLast('.')},)"
)
inputs.properties(properties)
filesMatching(listOf("META-INF/mods.toml", "pack.mcmeta")) { expand(properties) }
}
tasks.jar {
manifest {
attributes(mapOf(
"Implementation-Title" to project.name,
"Implementation-Version" to project.version
))
}
from("LICENSE") {
rename { "${it}_${archiveBaseName.get()}" }
}
finalizedBy("reobfJar")
}
tasks.jarJar {
from("LICENSE") {
rename { "${it}_${archiveBaseName.get()}" }
}
finalizedBy("reobfJarJar")
}
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
}
publishMods {
displayName = "${project.findProperty("mod_name")} ${project.version}"
changelog = providers.fileContents(layout.projectDirectory.file("CHANGELOG.md")).asText
file = tasks.jarJar.get().archiveFile
type = STABLE
modLoaders.add("forge")
modrinth {
projectId = project.findProperty("modrinth_id") as String
projectDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
minecraftVersions.addAll(libs.versions.minecraft.list.get().split(','))
requires("kotlin-for-forge")
requires("timeless-and-classics-zero")
}
github {
repository = project.findProperty("repository") as String
accessToken = providers.environmentVariable("GITHUB_TOKEN")
commitish = "main"
tagName = "v${project.version}"
}
}