generated from Polyfrost/OneConfigExampleMod
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
168 lines (153 loc) · 4.79 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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import gg.essential.gradle.util.noServerRunConfigs
plugins {
kotlin("jvm")
kotlin("plugin.serialization") version "1.4.21"
id("gg.essential.multi-version")
id("gg.essential.defaults.repo")
id("gg.essential.defaults.java")
id("gg.essential.defaults.loom")
id("com.github.johnrengelman.shadow")
id("net.kyori.blossom") version "1.3.0"
id("io.github.juuxel.loom-quiltflower-mini")
id("signing")
java
}
val mod_name: String by project
val mod_version: String by project
val mod_id: String by project
preprocess {
vars.put("MODERN", if (project.platform.mcMinor >= 16) 1 else 0)
}
blossom {
replaceToken("@VER@", mod_version)
replaceToken("@NAME@", mod_name)
replaceToken("@ID@", mod_id)
}
version = mod_version
group = "dev.dediamondpro"
base {
archivesName.set("$mod_name ($platform)")
}
val shade: Configuration by configurations.creating {
configurations.implementation.get().extendsFrom(this)
}
val runtimeMod by configurations.creating {
isTransitive = false
isVisible = false
}
sourceSets {
main {
output.setResourcesDir(java.classesDirectory)
}
}
repositories {
mavenCentral()
maven("https://repo.polyfrost.cc/releases")
maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1")
maven("https://jitpack.io") {
content {
includeGroupByRegex("com\\.github\\..*")
}
}
}
dependencies {
modRuntimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.1.0")
shade("gg.essential:loader-launchwrapper:1.1.3")
modCompileOnly("gg.essential:essential-1.8.9-forge:4804+g97db1f45b")
annotationProcessor("org.spongepowered:mixin:0.8.5:processor")
compileOnly("org.spongepowered:mixin:0.8.5")
modCompileOnly("com.github.notenoughupdates:notenoughupdates:v2.1.0:all")
runtimeMod("com.github.notenoughupdates:notenoughupdates:v2.1.1-alpha16:all")
shade("me.xdrop:fuzzywuzzy:1.4.0")
}
loom {
noServerRunConfigs()
if (project.platform.isForge) {
launchConfigs.named("client") {
arg("--tweakClass", "gg.essential.loader.stage0.EssentialSetupTweaker")
property("mixin.debug.export", "true")
val modFiles = runtimeMod.files
arg("--mods", modFiles.joinToString(",") { it.relativeTo(file("run")).path })
}
forge {
mixinConfig("mixins.${mod_id}.json")
}
}
mixin.defaultRefmapName.set("mixins.${mod_id}.refmap.json")
}
tasks.processResources {
inputs.property("id", mod_id)
inputs.property("name", mod_name)
val java = if (project.platform.mcMinor >= 18) {
17
} else {
if (project.platform.mcMinor == 17) 16 else 8
}
val compatLevel = "JAVA_${java}"
inputs.property("java", java)
inputs.property("java_level", compatLevel)
inputs.property("version", mod_version)
inputs.property("mcVersionStr", project.platform.mcVersionStr)
filesMatching(listOf("mcmod.info", "mixins.${mod_id}.json", "mods.toml")) {
expand(
mapOf(
"id" to mod_id,
"name" to mod_name,
"java" to java,
"java_level" to compatLevel,
"version" to mod_version,
"mcVersionStr" to project.platform.mcVersionStr
)
)
}
filesMatching("fabric.mod.json") {
expand(
mapOf(
"id" to mod_id,
"name" to mod_name,
"java" to java,
"java_level" to compatLevel,
"version" to mod_version,
"mcVersionStr" to project.platform.mcVersionStr.substringBeforeLast(".") + ".x"
)
)
}
}
tasks {
withType(Jar::class.java) {
if (project.platform.isFabric) {
exclude("mcmod.info", "mods.toml")
} else {
exclude("fabric.mod.json")
if (project.platform.isLegacyForge) {
exclude("mods.toml")
} else {
exclude("mcmod.info")
}
}
}
named<ShadowJar>("shadowJar") {
archiveClassifier.set("dev")
configurations = listOf(shade)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
relocate("me.xdrop", "dev.dediamondpro.skyguide.libs")
}
remapJar {
input.set(shadowJar.get().archiveFile)
archiveClassifier.set("")
}
jar {
manifest {
attributes(mapOf(
"ModSide" to "CLIENT",
"TweakOrder" to "0",
"TweakClass" to "gg.essential.loader.stage0.EssentialSetupTweaker",
"ForceLoadAsMod" to true
))
}
dependsOn(shadowJar)
archiveClassifier.set("")
enabled = false
}
}