-
Notifications
You must be signed in to change notification settings - Fork 87
/
build.gradle
439 lines (392 loc) · 14.2 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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
plugins {
id 'java-library'
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.moddev' version '1.0.1'
id 'com.diffplug.spotless' version '6.25.0'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id "com.modrinth.minotaur" version "2.+"
}
version = System.getenv("MI_VERSION")
? System.getenv("MI_VERSION")
: "0.0.0-local"
group = "aztech"
base {
archivesName = "Modern-Industrialization"
}
logger.lifecycle("Modern Industrialization version ${version}")
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
withSourcesJar()
}
repositories {
// for KJS
maven {
url "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
}
}
// for Patchouli
maven {
url 'https://maven.blamejared.com'
}
// for AE2 and JEI
maven {
name "Modmaven"
url "https://modmaven.dev"
content {
includeGroup "appeng"
includeGroup "dev.technici4n"
includeGroup "mezz.jei"
}
}
maven {
url "https://maven.shedaniel.me"
content {
includeGroup "me.sargunvohra.mcmods"
includeGroup "me.shedaniel.cloth"
includeGroup "me.shedaniel"
includeGroup "dev.architectury"
}
}
maven {
url "https://maven.terraformersmc.com"
content {
includeGroup "com.terraformersmc"
includeGroup "dev.emi"
}
}
maven {
name 'Jitpack for MI'
url 'https://jitpack.io'
content {
includeGroup "com.github.KubeJS-Mods"
includeGroup "com.github.GabrielOlvH"
/* For Magna */
includeGroup "com.github.Draylar.omega-config"
/* For KubeJS */
includeGroup "com.github.llamalad7.mixinextras"
}
}
// to build indrev
maven {
name = "CottonMC"
url = "https://server.bbkr.space/artifactory/libs-release"
content {
includeGroup "io.github.cottonmc"
}
}
maven {
name = "dblsaiko"
url = "https://maven.dblsaiko.net/"
}
maven {
name = "Technici4n"
url = "https://raw.githubusercontent.com/Technici4n/Technici4n-maven/master/"
content {
includeGroup "net.fabricmc.fabric-api"
includeGroup "dev.technici4n"
includeGroup "dev.latvian.mods"
}
}
maven {
url "https://maven.saps.dev/minecraft"
content {
includeGroup "dev.latvian.mods"
includeGroup "dev.ftb.mods"
}
}
maven {
url "https://maven.ftb.dev/snapshots"
content {
includeGroup "dev.ftb.mods"
}
}
maven {
url "https://maven.parchmentmc.net/"
content {
includeGroup "org.parchmentmc.data"
}
}
// for AE2
maven {
name = "Modmaven"
url = uri("https://modmaven.dev/")
content {
includeGroup("appeng")
}
}
// For the "No Indium?" mod
maven {
url = 'https://maven.cafeteria.dev/releases/'
content {
includeGroup "me.luligabi"
}
}
// For FTBTeams/FTBQuests
maven {
url "https://maven.saps.dev/minecraft"
content {
includeGroup "dev.latvian.mods"
includeGroup "dev.ftb.mods"
}
}
maven {
url "https://maven.teamresourceful.com/repository/maven-public/"
content {
includeGroup "com.teamresourceful"
includeGroup "com.teamresourceful.resourcefullib"
includeGroup "earth.terrarium.argonauts"
includeGroup "earth.terrarium.athena"
}
}
mavenLocal()
}
sourceSets {
main {
java {
srcDir "src/main"
}
resources {
srcDir "src/generated/resources"
}
}
client {
compileClasspath += sourceSets.main.compileClasspath
runtimeClasspath += sourceSets.main.runtimeClasspath
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}
neoForge {
version = project.neo_version
mods {
modern_industrialization {
sourceSet sourceSets.main
}
modern_industrialization_with_client {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}
runs {
// applies to all the run configs below
configureEach {
mods = [neoForge.mods.modern_industrialization]
// Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
systemProperty 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
systemProperty 'forge.logging.console.level', 'debug'
}
client {
client()
sourceSet = sourceSets.client
mods = [neoForge.mods.modern_industrialization_with_client]
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
systemProperty 'forge.enabledGameTestNamespaces', "modern_industrialization"
}
server {
server()
systemProperty 'forge.enabledGameTestNamespaces', "modern_industrialization"
programArgument '--nogui'
}
// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
type = "gameTestServer"
systemProperty 'forge.enabledGameTestNamespaces', "modern_industrialization"
}
data {
data()
sourceSet = sourceSets.client
mods = [neoForge.mods.modern_industrialization_with_client]
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
// workingDirectory project.file('run-data')
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
programArguments.addAll '--mod', "modern_industrialization", '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
autotestServer {
server()
systemProperty 'modern_industrialization.autoTest', 'true'
}
}
}
configurations {
localRuntimeOnly
runtimeClasspath.extendsFrom localRuntimeOnly
}
dependencies {
api jarJar("dev.technici4n:GrandPower:${project.grandpower_version}")
compileOnly "mezz.jei:jei-${project.jei_minecraft_version}-neoforge-api:${project.jei_version}"
if (project.runtime_itemlist_mod == "jei") {
localRuntimeOnly "mezz.jei:jei-${project.jei_minecraft_version}-neoforge:${project.jei_version}"
}
compileOnly "me.shedaniel:RoughlyEnoughItems-neoforge:${project.rei_version}"
compileOnly "me.shedaniel:REIPluginCompatibilities-forge-annotations:${project.rei_annotations_version}"
if (project.runtime_itemlist_mod == "rei") {
localRuntimeOnly "me.shedaniel:RoughlyEnoughItems-neoforge:${project.rei_version}"
}
compileOnly "dev.emi:emi-neoforge:${project.emi_version}+${project.emi_minecraft_version}"
if (project.runtime_itemlist_mod == "emi") {
localRuntimeOnly "dev.emi:emi-neoforge:${project.emi_version}+${project.emi_minecraft_version}"
// Add JEI so that we can use EMI's builtin compat layer
localRuntimeOnly "mezz.jei:jei-${project.jei_minecraft_version}-neoforge:${project.jei_version}"
}
if (!(project.runtime_itemlist_mod in ["jei", "rei", "emi", "none"])) {
throw new GradleException("Invalid runtime_itemlist_mod value: " + project.runtime_itemlist_mod)
}
compileOnly "vazkii.patchouli:Patchouli:${project.patchouli_version}:api"
localRuntimeOnly "vazkii.patchouli:Patchouli:${project.patchouli_version}"
jarJar "vazkii.patchouli:Patchouli:${project.patchouli_version}"
implementation "me.shedaniel.cloth:cloth-config-neoforge:${project.cloth_config_version}"
/*localRuntimeOnly*/ compileOnly("curse.maven:jade-324717:${project.jade_file_id}")
// TODO: compileOnly because implementation will cause datagen to crash... hopefully kubejs fixes it soon
/*localRuntimeOnly*/ compileOnly("dev.latvian.mods:kubejs-neoforge:${project.kubejs_version}")
localRuntimeOnly compileOnly("appeng:appliedenergistics2:${project.ae2_version}")
compileOnly "earth.terrarium.argonauts:argonauts-neoforge-${project.argonauts_minecraft_version}:${project.argonauts_version}"
localRuntimeOnly compileOnly("earth.terrarium.athena:athena-neoforge-${project.athena_minecraft_version}:${project.athena_version}")
compileOnly "dev.ftb.mods:ftb-quests-neoforge:${project.ftb_quests_version}"
compileOnly "dev.ftb.mods:ftb-teams-neoforge:${project.ftb_teams_version}"
}
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
var replaceProperties = [
neo_version: neo_version,
neo_version_range: neo_version_range,
mod_version: version,
cloth_config_version_range: cloth_config_version_range,
grandpower_version_range: grandpower_version_range,
ae2_version_range: ae2_version_range,
jei_version_range: jei_version_range,
]
inputs.properties replaceProperties
from 'src/main/templates'
into layout.buildDirectory.dir('generated/sources/modMetadata')
expand replaceProperties
}
sourceSets.main.resources.srcDir generateModMetadata
tasks.named("neoForgeIdeSync").configure {
dependsOn generateModMetadata
}
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
}
jar {
from "LICENSE"
from sourceSets.client.output
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
// select the repositories you want to publish to
repositories {
maven {
credentials {
username = System.getenv("MODMAVEN_USER")
password = System.getenv("MODMAVEN_PASSWORD")
}
name = "modmaven"
url = "https://modmaven.dev/artifactory/local-releases/"
}
}
}
spotless {
format 'misc', {
target '*.gradle', '*.md', '.gitignore'
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
java {
importOrder()
removeUnusedImports()
eclipse().configFile('eclipse-format.xml')
indentWithSpaces()
endWithNewline()
licenseHeaderFile 'LICENSE.java'
}
}
def releaseChannel = "release"
def changelog = System.getenv("CHANGELOG") ?: "Please visit our github repository for a changelog: https://github.com/AztechMC/Modern-Industrialization/releases."
if (version.toLowerCase().contains("alpha")) {
releaseChannel = "alpha"
changelog = "THIS IS AN ALPHA RELEASE, MAKE A BACKUP BEFORE INSTALLING AND FREQUENTLY WHILE PLAYING, AND PLEASE REPORT ANY ISSUE YOU MAY FIND ON OUR ISSUE TRACKER.\n\n" + changelog
} else if (version.toLowerCase().contains("beta")) {
releaseChannel = "beta"
changelog = "This is a beta release. It is expected to be mostly stable, but in any case please report any issue you may find.\n\n" + changelog
}
// Publishing
if (System.getenv("CURSEFORGE_API_KEY") && !version.endsWith("-SNAPSHOT")) {
curseforge {
apiKey = System.getenv().get("CURSEFORGE_API_KEY")
project {
id = project.curseforge_project
releaseType = releaseChannel
changelogType = "markdown"
delegate.changelog = changelog
addGameVersion project.minecraft_version
addGameVersion "NeoForge"
addGameVersion "Java 21"
relations {
requiredDependency "cloth-config"
optionalDependency "wthit"
optionalDependency "emi"
optionalDependency "jei"
optionalDependency "roughly-enough-items"
embeddedLibrary "grandpower"
embeddedLibrary "patchouli"
}
mainArtifact(tasks.named("jar").flatMap { it.archiveFile }) {
displayName = "Modern Industrialization v${version}"
}
}
options {
forgeGradleIntegration = false
}
afterEvaluate {
tasks.getByName("curseforge${project.curseforge_project}").dependsOn tasks.jar
}
}
}
modrinth {
token = System.getenv("MODRINTH_API_KEY")
projectId = project.modrinth_project
versionNumber = version
versionName = "Modern Industrialization v${version}"
delegate.changelog = changelog
versionType = releaseChannel
uploadFile = tasks.jar
gameVersions = [project.minecraft_version]
loaders = ["neoforge"]
dependencies {
required.project "cloth-config"
optional.project "wthit"
optional.project "emi"
optional.project "jei"
optional.project "rei"
embedded.project "patchouli"
}
}
tasks.modrinth.onlyIf {
System.getenv("MODRINTH_API_KEY") && !version.endsWith("-SNAPSHOT")
}