-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
312 lines (251 loc) · 8.86 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
plugins {
id 'java'
id 'eclipse'
id 'idea'
id 'net.minecraftforge.gradle' version '6.0.+'
id 'com.diffplug.eclipse.apt' version '4.0.+'
id 'org.spongepowered.mixin' version '0.7.+'
}
repositories {
mavenCentral()
maven {
name 'Su5ed LegacyDev Fork'
url 'https://maven.su5ed.dev/releases'
}
maven {
name 'Cleanroom Maven'
url 'https://maven.cleanroommc.com'
}
maven {
name "CurseMaven"
url 'https://www.cursemaven.com/'
content {
includeGroup "curse.maven"
}
}
}
import net.minecraftforge.gradle.mcp.MCPRepo
import net.minecraftforge.gradle.common.tasks.SignJar
import net.minecraftforge.gradle.common.util.MavenArtifactDownloader
import org.apache.tools.ant.filters.ReplaceTokens
version = "${mcversion}-${version}"
group = 'thecodex6824.thaumcraftfix'
archivesBaseName = 'ThaumcraftFix'
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
ext {
if (!project.hasProperty('certFingerprint')) {
certFingerprint = ''
}
}
legacy {
fixClasspath = true
extractMappings = true
attachMappings = true
}
final arch = System.getProperty("os.arch")
final needCustomNatives = arch != "x86" && arch != "i386" && arch != "x86_64" && arch != "amd64"
minecraft {
mappings channel: 'stable', version: '39-1.12'
accessTransformer = file('src/main/resources/META-INF/thaumcraftfix_at.cfg')
runs {
client {
workingDirectory file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
property 'fml.coreMods.load', 'thecodex6824.thaumcraftfix.core.ThaumcraftFixCore'
if (needCustomNatives) {
property 'java.library.path', ''
environment 'nativesDirectory', "${project.getProjectDir()}/natives"
}
environment 'MC_VERSION', '1.12.2'
mods {
thaumcraftfix {
source sourceSets.main
}
}
}
server {
workingDirectory file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
property 'fml.coreMods.load', 'thecodex6824.thaumcraftfix.core.ThaumcraftFixCore'
if (needCustomNatives) {
property 'java.library.path', ''
environment 'nativesDirectory', "${project.getProjectDir()}/natives"
}
environment 'MC_VERSION', '1.12.2'
mods {
thaumcraftfix {
source sourceSets.main
}
}
}
}
}
mixin {
add sourceSets.main, "${refmap}"
checks = true
debug.countInjections = true
debug.strict = true
debug.verbose = true
env.remapRefMap = true
overwriteErrorLevel = 'error'
quiet
}
configurations {
testAgent
testImplementation.extendsFrom testAgent
testImplementation.extendsFrom implementation
}
dependencies {
minecraft "net.minecraftforge:forge:${mcversion}-${forgeversion}"
implementation fg.deobf('curse.maven:thaumcraft-223628:2629023')
implementation fg.deobf('curse.maven:baubles-227083:2518667')
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.+'
testImplementation 'org.junit.platform:junit-platform-launcher:1.11.+'
testAgent 'net.bytebuddy:byte-buddy-agent:1.15.+'
runtimeOnly 'curse.maven:jei-238222:2995897'
runtimeOnly 'curse.maven:thaumic-jei-285492:2705304'
runtimeOnly 'curse.maven:the-one-probe-245211:2667280'
runtimeOnly 'curse.maven:ctm-267602:2915363'
annotationProcessor 'org.ow2.asm:asm-debug-all:5.2'
annotationProcessor 'com.google.guava:guava:32.1.2-jre'
annotationProcessor 'com.google.code.gson:gson:2.8.9'
// fixes annotation compiler warnings in guava
compileOnly 'com.google.errorprone:error_prone_annotations:2.10.0'
implementation("zone.rong:mixinbooter:${mixinbooterversion}") {
transitive = false
}
annotationProcessor("zone.rong:mixinbooter:${mixinbooterversion}") {
transitive = false
}
constraints {
implementation('net.minecraftforge:legacydev:0.3.0.0-legacyExt') {
because 'needed to have all ATs work properly'
}
implementation('org.ow2.asm:asm-debug-all:5.2') {
because 'newer ASM versions include module info that causes errors in Java 8'
}
}
configurations.configureEach {
// mergetool pollutes the classpath with conflicting classes
it.exclude(group: 'net.minecraftforge', module: 'mergetool')
// legacydev forge dep wants fatjar as the classifier, but 3.0 lacks it
it.resolutionStrategy.eachDependency {
if (it.requested.module.toString() == 'net.minecraftforge:legacydev') {
it.artifactSelection {
it.selectArtifact(DependencyArtifact.DEFAULT_TYPE, null, null)
}
}
}
}
// For the native library binding jars (which need to be the exact same version as the natives)
if (needCustomNatives) {
implementation fileTree(dir: 'natives', include: '*.jar')
}
}
idea {
module {
inheritOutputDirs = true
downloadJavadoc = true
downloadSources = true
}
}
task filterTokens(type: Sync) {
// this will ensure that this task is redone when the versions change.
inputs.property 'version', version
inputs.property 'apiversion', apiversion
inputs.property 'certFingerprint', certFingerprint
from sourceSets.main.java
filter(ReplaceTokens, tokens: [APIVERSION: apiversion.toString(), VERSION: version.toString(), FINGERPRINT: certFingerprint.toString()])
into "$buildDir/src/$sourceSets.main.name/$sourceSets.main.java.name"
}
compileJava.source = filterTokens.outputs
processResources {
// required to allow file expansion later
duplicatesStrategy = 'include'
// this will ensure that this task is redone when the versions change.
inputs.property 'version', version
inputs.property 'apiversion', apiversion
inputs.property 'mcversion', mcversion
inputs.property 'forgeminversion', forgeminversion
inputs.property 'mixinminversion', mixinminversion
inputs.property 'refmap', refmap
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version': version, 'mcversion': mcversion, 'forgeversion': forgeversion, 'forgeminversion': forgeminversion
}
// do the same for all mixin config jsons
from(sourceSets.main.resources.srcDirs) {
include 'mixin/*.json'
expand 'mixinminversion': mixinminversion, 'refmap': refmap
}
// copy everything else except everything handled above
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
exclude 'mixin/*.json'
}
}
javadoc {
include 'thecodex6824/thaumcraftfix/api/**'
}
task signJar(type: SignJar) {
dependsOn 'jar'
onlyIf { project.hasProperty('keyStore') }
if (project.hasProperty('keyStore')) { // needed to skip gradle trying to find vars
keyStore = project.keyStore
alias = project.alias
storePass = project.storePass
keyPass = project.keyPass
inputFile = jar.archivePath
outputFile = jar.archivePath
}
}
jar {
manifest {
attributes 'FMLAT': 'thaumcraftfix_at.cfg'
attributes 'FMLCorePlugin': 'thecodex6824.thaumcraftfix.core.ThaumcraftFixCore'
attributes 'FMLCorePluginContainsFMLMod': 'true'
}
}
tasks.compileJava {
options.compilerArgs += "-Werror"
// processing must be disabled due to "No processor claimed any of these annotations" warnings
options.compilerArgs += "-Xlint:all,-processing"
}
tasks.build.dependsOn(tasks.signJar)
tasks.test.dependsOn(tasks.createSrgToMcp)
project.tasks.whenTaskAdded {
if (it.name.equals('reobfJar')) {
tasks.signJar.dependsOn(it)
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from 'build/docs/javadoc'
archiveClassifier = 'javadoc'
}
task apiJar(type: Jar) {
from sourceSets.main.output
from sourceSets.main.java
archiveClassifier = 'api'
include 'thecodex6824/thaumcraftfix/api/**'
}
task sourcesJar(type: Jar) {
from sourceSets.main.java
archiveClassifier = 'sources'
}
artifacts {
archives apiJar
archives javadocJar
archives sourcesJar
}
test {
useJUnitPlatform()
afterEvaluate {
configurations.testAgent.each {
jvmArgs += "-javaagent:${it}"
}
}
}