-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.gradle
270 lines (238 loc) · 9.89 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
buildscript {
repositories {
maven { url = 'https://sizableshrimp.me/maven' }
maven { url = 'https://maven.minecraftforge.net' }
maven { url='https://repo.spongepowered.org/repository/maven-public' }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'me.sizableshrimp.parchmenttest', name: 'ForgeGradle', version: '4.1.+', changing: true
classpath 'com.github.jengelman.gradle.plugins:shadow:6.1.0'
classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT'
}
}
plugins {
id "application"
}
apply plugin: "java"
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'com.github.johnrengelman.shadow'
version = "${mod_version}"
group = "${mod_base_package}.${mod_id}"
archivesBaseName = "${project.jar_name}-${minecraft_version}"
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
ext {
javaMainClass = "software.bernie.ci.TravisDiscordNotif"
}
application {
mainClassName = javaMainClass
}
minecraft {
mappings channel: "${mappings_channel}", version: "${mappings_version}"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
workingDirectory project.file('run')
arg "-mixin.config=techarium.mixin.json"
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
mods {
"${mod_id}" {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
mods {
"${mod_id}" {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
mods {
"${mod_id}" {
source sourceSets.main
}
}
}
}
}
sourceSets {
main {
resources {
srcDir 'src/generated/resources'
}
}
}
mixin {
add sourceSets.main, "${mod_id}.refmap.json"
}
repositories {
maven { url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/' }
maven { url 'https://repo.repsy.io/mvn/fadookie/particleman' }
maven { url = "https://www.cursemaven.com" }
maven {
// location of the maven that hosts JEI files
name = "Progwml6 maven"
url = "https://dvs1.progwml6.com/files/maven/"
}
maven { url "https://maven.tehnut.info" }
maven {
name 'tterrag maven'
url "https://maven.tterrag.com/"
}
maven { url 'https://maven.blamejared.com' }
maven {
// for Immersive Engineering
url "https://modmaven.dev/"
content {
includeGroup 'blusunrize.immersiveengineering'
includeGroup 'malte0811'
}
}
}
dependencies {
minecraft "net.minecraftforge:forge:${forge_version}"
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
//Geckolib
implementation fg.deobf("software.bernie.geckolib:${geckolib_version}")
//Kyori Adventure Deps. Must be shadowed into the final jar
shadow implementation("net.kyori:adventure-api:$adventure_version")
shadow implementation("net.kyori:adventure-text-serializer-gson:$adventure_version")
shadow implementation("net.kyori:adventure-text-serializer-legacy:$adventure_version")
shadow implementation("net.kyori:adventure-text-serializer-plain:$adventure_version")
//Integration mods
compileOnly fg.deobf("mezz.jei:jei-${jei_mc_version}:${jei_version}:api")
runtimeOnly fg.deobf("mezz.jei:jei-${jei_mc_version}:${jei_version}")
implementation fg.deobf("curse.maven:mekanism-268560:${mekanism_version}")
implementation fg.deobf("curse.maven:theoneprobe-245211:${one_probe_version}")
implementation fg.deobf("com.blamejared.crafttweaker:CraftTweaker-1.16.5:$crafttweaker_version")
implementation fg.deobf("curse.maven:mystical-agriculture-246640:${mystical_agriculture_version}")
implementation fg.deobf("curse.maven:cucumber-272335:${cucumber_version}")
implementation fg.deobf("curse.maven:pams-harvestcraft-2-crops-361385:${pams_harvestcraft_2_crops_version}")
implementation fg.deobf("curse.maven:thermal-cultivation-271835:${thermal_cultivation_version}")
implementation fg.deobf("curse.maven:thermal-foundation-222880:${thermal_foundation_version}")
implementation fg.deobf("curse.maven:xl-food-mod-plus-448703:${xl_food_plus_version}")
implementation fg.deobf("curse.maven:farmers-delight-398521:${farmers_delight_version}")
implementation fg.deobf("curse.maven:oh-the-biomes-youll-go-247560:${oh_the_biomes_youll_go_version}")
implementation fg.deobf("curse.maven:biomes-o-plenty-220318:${biomes_o_plenty_version}")
implementation fg.deobf("curse.maven:ctm-267602:${ctm_version}")
implementation fg.deobf("com.teamcofh:CoFHCore:${cofh_core_version}")
compileOnly fg.deobf("blusunrize.immersiveengineering:ImmersiveEngineering:${immersive_engineering_version}")
// Compile against the Hwyla API, but run with full mod
compileOnly fg.deobf("mcp.mobius.waila:Hwyla:${hwyla_version}:api")
runtimeOnly fg.deobf("mcp.mobius.waila:Hwyla:${hwyla_version}")
//lombok
compileOnly "org.projectlombok:lombok:${lombok_version}"
annotationProcessor "org.projectlombok:lombok:${lombok_version}"
//discord webhook library
compile("club.minnced:discord-webhooks:${discord_webhooks_version}")
}
/* IntelliJ Project Import
* The Mixin annotation process does not have an obfuscation source when running through the IntelliJ compiler,
* Thus we have to prevent it from being activated as part of importing this Gradle project into IntelliJ.
*/
if (System.getProperty("idea.sync.active") == "true") {
afterEvaluate {
tasks.withType(JavaCompile).all {
it.options.annotationProcessorPath = files()
}
}
}
// Populates mods.toml file with gradle variables. Reference: https://github.com/SizableShrimp/ForgeTemplate/blob/1.16.x/build.gradle#L158-L188
def resource_targets = ["META-INF/mods.toml", "pack.mcmeta"]
task replaceResources(type: Copy) {
//Comment out dependency on jar process. This fixes an issue where this task is run too late when other projects use Techarium as a dependency.
//dependsOn(jar)
outputs.upToDateWhen { false }
def spec = copySpec {
from(sourceSets.main.resources) {
include resource_targets
expand "project": project, "mod_id": mod_id, "mod_name": mod_name, "mod_version": mod_version,
"mod_authors": mod_authors, "mod_description": mod_description,
"display_url":display_url,
"issue_tracker_url": issue_tracker_url,
"license": license,
"forge_version_range": forge_version_range, "minecraft_version_range": minecraft_version_range,
"loader_version_range": loader_version_range,
"geckolib_version_range":geckolib_version_range
}
}
with spec
into "$buildDir/resources/main/"
// If IntelliJ's output dir exists, copy it there as well
if (new File("$rootDir/out/production/${project.name}.main/").exists()) {
copy {
with spec
into "$rootDir/out/production/${project.name}.main/"
}
}
//If Eclipse's output dir exists, copy it there as well
if (new File("$rootDir/bin/main/").exists()) {
copy {
with spec
into "$rootDir/bin/main/"
}
}
}
processResources { // Process resources on build
duplicatesStrategy = DuplicatesStrategy.FAIL
// Exclude the resource targets as we manually handle those and don't want them to invalidate our cache
exclude resource_targets
finalizedBy replaceResources
}
//Populate and make a copy of the CI Properties file to allow for the TravisDiscordNotif to read values from it
def build_targets = ["ci_properties_original.json"]
task createBuildscriptProperties(type: Copy) {
def spec = copySpec {
from("$projectDir/ci") {
include build_targets
expand "project": project, "jar_name": jar_name, "minecraft_version": minecraft_version, "mod_version": mod_version
}
}
with spec
into "$rootDir"
rename { filename ->
filename.replace 'ci_properties_original', 'ci_properties'
}
}
shadowJar {
classifier ''
configurations = [project.configurations.shadow]
//Disable the use of include dependency due to use of the shadow configuration. Do not uncomment this, this will break shadow jar.
//dependencies {
// include(dependency('net.kyori:.*'))
//}
relocate 'net.kyori', 'software.bernie.shadowed.net.kyori'
}
jar {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
manifest {
attributes([
"Specification-Title" : mod_id,
"Specification-Vendor" : mod_authors,
"Specification-Version" : "1.0.0",
"Implementation-Title" : project.name,
"Implementation-Version" : mod_version,
"Implementation-Vendor" : mod_authors,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConfigs": "${mod_id}.mixin.json"
])
}
}
reobf {
shadowJar {}
}
jar.finalizedBy('reobfJar')