This repository has been archived by the owner on May 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
build.gradle
310 lines (266 loc) · 9.56 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath "org.spongepowered:mixingradle:${mixingradle_version}"
}
}
plugins {
id 'net.minecraftforge.gradle' version "${forge_gradle_version}"
id 'wtf.gofancy.fancygradle' version "${fancy_gradle_version}"
}
apply plugin: 'org.spongepowered.mixin'
version = mod_version
group = project.maven_group
archivesBaseName = "${project.archives_base_name}-${project.minecraft_version}"
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
if (project.use_intellij_idea.toBoolean()) {
apply {
plugin 'java'
plugin 'idea'
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
}
if (project.use_eclipse.toBoolean()) {
apply {
plugin 'java'
plugin 'eclipse'
}
eclipse {
module {
downloadJavadoc = true
downloadSources = true
}
}
}
minecraft {
mappings channel: "${mcp_mappings_channel}", version: "${mcp_mappings_version}"
accessTransformer = file('src/main/resources/META-INF/gregification_at.cfg')
runs {
client {
//noinspection GroovyAssignabilityCheck
workingDirectory project.file('run')
jvmArg '-Dfml.coreMods.load=' + coremod_plugin_class_name
jvmArg '-Dmixin.hotSwap=true'
jvmArg '-Dmixin.checks.interfaces=true'
jvmArg '-Dmixin.debug=true'
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
environment 'MC_VERSION', minecraft_version.toString()
}
server {
//noinspection GroovyAssignabilityCheck
workingDirectory project.file('run')
jvmArg '-Dfml.coreMods.load=' + coremod_plugin_class_name
jvmArg '-Dmixin.hotSwap=true'
jvmArg '-Dmixin.checks.interfaces=true'
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
environment 'MC_VERSION', minecraft_version.toString()
}
}
}
repositories {
maven {
name 'Cleanroom Maven'
url 'https://maven.cleanroommc.com'
}
maven {
// JEI
name 'Progwml6 Maven'
url 'https://dvs1.progwml6.com/files/maven/'
}
maven {
// CraftTweaker and JEI Backup
name 'BlameJared Maven'
url 'https://maven.blamejared.com'
}
maven {
name 'Curse Maven'
url 'https://www.cursemaven.com'
content {
includeGroup 'curse.maven'
}
}
maven {
name 'Sponge Maven'
url 'https://repo.spongepowered.org/maven'
}
}
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
// Hard-Deps
implementation fg.deobf("curse.maven:gregtech-ce-unofficial-${project.gt_id}:${project.gt_version}")
implementation fg.deobf("curse.maven:codechicken-lib-1-8-242818:2779848")
implementation fg.deobf("curse.maven:mixin-booter-419286:4090558")
// Useful stuff
implementation "mezz.jei:jei_1.12.2:4.16.1.302"
implementation "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-${project.ct_version}"
implementation files("libs/groovyscript-0.4.0.jar")
implementation fg.deobf("curse.maven:the-one-probe-245211:2667280")
// Direct compat mods
// Must be present in-dev as their code is referenced in this mod
implementation fg.deobf("curse.maven:ctm-267602:2915363")
implementation fg.deobf("curse.maven:forestry-59751:2918418")
implementation fg.deobf("curse.maven:tinkers-construct-74072:2902483")
implementation fg.deobf("curse.maven:mantle-74924:2713386")
implementation fg.deobf("curse.maven:shadowfacts-forgelin-248453:2785465")
implementation fg.deobf("curse.maven:ex-nihilo-creatio-274456:2817545")
implementation fg.deobf("curse.maven:opencomputers-223008:2828357")
implementation fg.deobf("curse.maven:tfcraft-302973:3268988")
implementation fg.deobf("curse.maven:ae2-extended-life-570458:4323863")
implementation fg.deobf("curse.maven:gregtech-food-option-${project.gtfo_id}:${project.gtfo_version}")
// May get some form of compatibility in the future
//implementation fg.deobf("curse.maven:mcjtylib-233105:2745846")
//implementation fg.deobf("curse.maven:xnet-260912:2745852")
// Addons and other mods
// Enable for testing as needed
//implementation fg.deobf("curse.maven:binnies-mods-223525:2916129")
//implementation fg.deobf("curse.maven:magic-bees-65764:2566282")
//implementation fg.deobf("curse.maven:gendustry-70492:2516215")
//implementation fg.deobf("curse.maven:bdlib-70496:2518031")
//implementation fg.deobf("curse.maven:career-bees-281791:2534481")
//implementation fg.deobf("curse.maven:retrobees-300139:2934369")
//implementation fg.deobf("curse.maven:the-twilight-forest-227639:3051450")
//implementation fg.deobf("curse.maven:thaumcraft-223628:2629023")
//implementation fg.deobf("curse.maven:baubles-227083:2518667")
//implementation fg.deobf("curse.maven:biomes-o-plenty-220318:2715506")
//implementation fg.deobf("curse.maven:extra-utilities-225561:2678374")
// Mixin related things
compileOnly "zone.rong:mixinbooter:${project.mixinbooter_version}"
runtimeOnly "zone.rong:mixinbooter:${project.mixinbooter_version}"
annotationProcessor "org.spongepowered:mixin:${project.mixin_annotations_version}:processor"
}
fancyGradle {
patches {
resources
coremods
asm
codeChickenLib
}
}
processJarTask jar
def final is_ci_env = providers.environmentVariable('CI').getOrElse('false').toBoolean()
if (is_ci_env || project.build_deobfJar.toBoolean()) {
// Create deobf dev jars
tasks.register('deobfJar', Jar) {
archiveClassifier.set 'deobf'
from sourceSets.main.output
}
processJarTask deobfJar
}
if (is_ci_env || project.build_apiJar.toBoolean()) {
// Create API library jar
tasks.register('apiJar', Jar) {
archiveClassifier.set 'api'
from(sourceSets.main.java) {
include 'gregification/api/**'
}
from(sourceSets.main.output) {
include 'gregification/api/**'
}
}
}
if (is_ci_env || project.build_sourceJar.toBoolean()) {
// Create source jar
tasks.register('sourcesJar', Jar) {
archiveClassifier.set 'sources'
from sourceSets.main.allJava
}
}
// Loading resources, works even on IDE client runs
sourceSets {
main {
ext.refMap = 'mixins.' + archives_base_name + '.refmap.json'
java {
srcDirs = ['src/main/java', 'src/api/java']
}
resources {
srcDirs = ['src/main/resources']
}
}
test {
java {
srcDirs = ['src/test/java']
}
resources {
srcDirs = ['src/test/resources']
}
}
// at compile time, put resources in same directories as classes
main.output.setResourcesDir(main.java.classesDirectory)
}
artifacts {
if (is_ci_env || project.build_deobfJar.toBoolean()) {
archives deobfJar
}
if (is_ci_env || project.build_apiJar.toBoolean()) {
archives apiJar
}
if (is_ci_env || project.build_sourceJar.toBoolean()) {
archives sourcesJar
}
}
// It is important to NOT re-obfuscate jars for the deobfuscated environment.
// Therefore, we do not finalize the 'jar' task with the 'reobfJar' task.
// The Forge FG5 example buildscript states otherwise, however it creates broken builds in deobfuscated environments.
processResources {
// required to allow file expansion later
duplicatesStrategy = DuplicatesStrategy.INCLUDE
// this will ensure that this task is redone when the versions change.
inputs.property 'version', version
inputs.property 'mcversion', minecraft_version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand(['version': version, 'mcversion': minecraft_version])
}
// copy everything else except mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
test {
testLogging {
events TestLogEvent.STARTED, TestLogEvent.PASSED, TestLogEvent.FAILED
exceptionFormat TestExceptionFormat.FULL
showExceptions true
showStackTraces true
showCauses true
showStandardStreams true
}
useJUnitPlatform()
}
/**
* Applies required processing to jar tasks
* @param task the task to process
*/
private void processJarTask(task) {
task.configure {
manifest {
// noinspection GroovyAssignabilityCheck
def attribute_map = [:]
attribute_map['FMLCorePlugin'] = project.coremod_plugin_class_name
attribute_map['FMLCorePluginContainsFMLMod'] = true
attribute_map['ForceLoadAsMod'] = project.gradle.startParameter.taskNames[0] == 'build'
attribute_map['TweakClass'] = 'org.spongepowered.asm.launch.MixinTweaker'
attribute_map['FMLAT'] = 'gregification_at.cfg'
attributes(attribute_map)
}
// exclude all files in src/api from being shipped in the jar
// this prevents crashes in obfuscated environments
file('src/api/').eachDirRecurse { dir ->
exclude dir.name
}
}
}