-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle
265 lines (226 loc) · 7.88 KB
/
build.gradle
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
import org.gradle.internal.jvm.Jvm
plugins {
alias libs.plugins.architectury
alias libs.plugins.architectury.loom apply false
alias libs.plugins.vineFlower apply false // VineFlower, a better decompiler
alias libs.plugins.machete // automatic jar compressing on build
alias libs.plugins.shadow
}
apply plugin: "dev.architectury.loom"
//apply plugin: "io.github.juuxel.loom-vineflower"
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
archivesBaseName = "${project.name}-${libs.versions.minecraft.get()}"
group = properties.maven_group
// Formats the mod version to include the loader, Minecraft version, and build number (if present)
String buildNumber = System.getenv("GITHUB_ACTION_NUMBER")
version = "${mod_version}" + (buildNumber != null ? "-build_${System.getenv("GITHUB_RUN_NUMBER")}" : "")
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.release.set 17
}
java {
withSourcesJar()
}
def mod_id = properties.mod_id
architectury {
platformSetupLoomIde()
forge()
minecraft = libs.versions.minecraft
}
static def isJetBrainsRuntime() {
return System.getProperty('java.vm.vendor').contains('JetBrains')
}
loom {
accessWidenerPath = file("src/main/resources/${mod_id}.accesswidener")
silentMojangMappingsLicense()
forge {
mixinConfig(
"${mod_id}.mixins.json",
)
convertAccessWideners = true
extraAccessWideners.add loom.accessWidenerPath.get().asFile.name
dataGen{
mod(mod_id)
}
}
runConfigs.named("data").configure {
programArg("--existing=" + file("src/main/resources").absolutePath)
programArgs("--client", "--server")
}
if (isJetBrainsRuntime()) {
runs {
client {
vmArgs '-XX:+AllowEnhancedClassRedefinition'
vmArgs '-XX:HotswapAgent=fatjar'
}
}
}
}
configurations {
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentForge.extendsFrom common
}
repositories {
mavenLocal()
maven {
name = 'GTCEu Maven'
url = 'https://maven.gtceu.com'
content {
includeGroup 'com.gregtechceu.gtceu'
}
}
// mavens for Forge-exclusives
maven { url = "https://api.modrinth.com/maven" } // Jade
maven { url = "https://maven.theillusivec4.top/" } // Curios
maven { url = "https://maven.terraformersmc.com/releases/" } // Mod Menu, EMI
maven { // Create Forge and Registrate Forge
url = "https://maven.tterrag.com/"
content {
includeGroup("com.tterrag.registrate")
includeGroup("com.simibubi.create")
}
}
maven { url = "https://maven.parchmentmc.org" } // Parchment mappings
maven { url = "https://maven.quiltmc.org/repository/release" } // Quilt Mappings
maven { // TOP
url "https://maven.k-4u.nl"
}
maven {
// saps.dev Maven (KubeJS and Rhino)
url = "https://maven.saps.dev/minecraft"
content {
includeGroup "dev.latvian.mods"
}
}
mavenLocal()
mavenCentral()
maven { url = "https://maven.shedaniel.me/" } // Cloth Config, REI
maven {
url "https://cursemaven.com"
content {
includeGroup "curse.maven"
}
} // Curse Forge File
maven {
name = "Jared's maven"
url = "https://maven.blamejared.com/"
} // JEI
maven { url 'https://jitpack.io' } // MixinExtras
maven {
// location of a maven mirror for JEI files, as a fallback
name = "ModMaven"
url = "https://modmaven.dev"
} // JEI mirror, AE2
maven { url = "https://maven.parchmentmc.org" } // Parchment mappings
maven { url = "https://maven.quiltmc.org/repository/release/" } // Quilt Mappings
maven { url = "https://maven.firstdarkdev.xyz/snapshots" } // LDLib
maven {
name = "redlance"
url = "https://repo.constructlegacy.ru/public"
}
maven {
name = "mixin"
url = "https://repo.spongepowered.org/repository/maven-public/"
}
}
dependencies {
minecraft libs.minecraft
forge forge.minecraftForge
// The following line declares the mojmap mappings, you may use other mappings as well
mappings loom.layered {
it.mappings("org.quiltmc:quilt-mappings:${libs.versions.minecraft.get()}+build.${libs.versions.quiltMappings.get()}:intermediary-v2")
it.parchment("org.parchmentmc.data:parchment-${libs.versions.minecraft.get()}:${libs.versions.parchment.get()}@zip")
it.officialMojangMappings { nameSyntheticMembers = false }
}
// LDLib
modImplementation(forge.gtceu.forge) { transitive = false }
modImplementation(forge.ldlib.forge) { transitive = false }
// Registrate
modImplementation("com.tterrag.registrate:Registrate:${forge.versions.registrate.get()}")
// REI
modImplementation forge.emi
// TOP
modCompileOnly(forge.theoneprobe) { transitive = false }
// KJS
modImplementation forge.kubejs.forge
// Configuration
modImplementation(forge.configuration)
// Mixin Extras
implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:${forge.versions.mixinExtras.get()}"))
api("io.github.llamalad7:mixinextras-forge:${forge.versions.mixinExtras.get()}")
// apply a newer mixin AP to fix an issue with building the Lithium mixins
implementation(annotationProcessor("org.spongepowered:mixin:${libs.versions.mixin.get()}:processor"))
// lombok
compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
// testing mods
modCompileOnly forge.radium
}
tasks.register("run + RenderDoc", Exec.class) {
var javaHome = Jvm.current().javaHome
commandLine = [
"C:\\Program Files\\RenderDoc\\renderdoccmd.exe",
"capture",
"--opt-api-validation", // Remove if you don't want api validation
"--opt-api-validation-unmute", // Remove if you don't want api validation
"--opt-hook-children",
"--wait-for-exit",
"--working-dir",
".",
"$javaHome/bin/java.exe",
"-Xmx64m",
"-Xms64m",
//"-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005", // Uncomment for remote debug
"-Dorg.gradle.appname=gradlew",
"-Dorg.gradle.java.home=$javaHome",
"-classpath",
"./gradle/wrapper/gradle-wrapper.jar",
"org.gradle.wrapper.GradleWrapperMain",
"runClient",
]
}
processResources {
// set up properties for filling into metadata
var properties = [
"version": version,
"mod_id": project.mod_id,
"forge_version": forge.versions.forgeShortVersion.get().split("\\.")[0], // only specify major version of forge
"minecraft_version": libs.versions.minecraft.get(),
"gtceu_version": forge.versions.gtceu.get(),
"mod_name": mod_name,
]
inputs.properties(properties)
filesMatching("META-INF/mods.toml") {
expand properties
}
}
remapJar {
inputFile.set jar.archiveFile
dependsOn(":optimizeOutputsOfJar")
archiveClassifier.set(null)
}
jar {
archiveClassifier.set("dev")
}
components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}
publishing {
publications {
mavenForge(MavenPublication) {
artifactId = archivesBaseName
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}