-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathbuild.gradle
277 lines (221 loc) · 8.16 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
plugins {
id 'java'
id 'eclipse'
id 'idea'
id 'net.minecraftforge.gradle' version '6.0.+'
}
repositories {
maven {
name "Su5ed LegacyDev Fork"
url "https://maven.su5ed.dev/releases"
}
}
// eclipse thinks test needs resources if this is not here
sourceSets {
test {
resources.setSrcDirs([])
}
}
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
repositories {
maven {
url = 'https://www.cursemaven.com/'
content {
includeGroup "curse.maven"
}
}
}
version = "${mcversion}-${version}"
group = 'thecodex6824.thaumicaugmentation'
archivesBaseName = 'ThaumicAugmentation'
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/thaumicaugmentation_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.thaumicaugmentation.core.ThaumicAugmentationCore'
if (needCustomNatives) {
property 'java.library.path', ''
environment 'nativesDirectory', "${project.getProjectDir()}/natives"
}
environment 'MC_VERSION', '1.12.2'
mods {
thaumicaugmentation {
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.thaumicaugmentation.core.ThaumicAugmentationCore'
if (needCustomNatives) {
property 'java.library.path', ''
environment 'nativesDirectory', "${project.getProjectDir()}/natives"
}
environment 'MC_VERSION', '1.12.2'
mods {
thaumicaugmentation {
source sourceSets.main
}
}
}
}
}
configurations {
testCompile.extendsFrom compile
}
dependencies {
minecraft "net.minecraftforge:forge:${mcversion}-${forgeversion}"
implementation fg.deobf('curse.maven:thaumcraft-223628:2629023')
implementation fg.deobf('curse.maven:baubles-227083:2518667')
compileOnly 'curse.maven:jeid-296289:2919737'
compileOnly 'curse.maven:botania-225643:2846950'
compileOnly 'curse.maven:auracontrol-397104:3013979'
compileOnly 'curse.maven:electroblobs-wizardry-265642:2929294'
compileOnly 'curse.maven:thaumcraftfix-1069346:5889900'
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.+'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.+'
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'
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.forEach {
// 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)
}
}
}
}
// if the curse maven is down or otherwise not working:
// comment the above "implementation", "compileOnly", and "runtimeOnly" entries
// uncomment the following and put jars into subfolders in the "lib" folder
//implementation fileTree(dir: 'lib/implementation', include: '*.jar')
//compileOnly fileTree(dir: 'lib/compileOnly', include: '*.jar')
//runtimeOnly fileTree(dir: 'lib/runtimeOnly', include: '*.jar')
// note that the first line has no deobf - if you need it use BON2 or something
// to avoid needing test jars, comment the "testImplementation" lines and put "-x test" on the command line
// 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
// 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
}
// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
javadoc {
include 'thecodex6824/thaumicaugmentation/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': 'thaumicaugmentation_at.cfg'
attributes 'FMLCorePlugin': 'thecodex6824.thaumicaugmentation.core.ThaumicAugmentationCore'
attributes 'FMLCorePluginContainsFMLMod': 'true'
}
}
tasks.build.dependsOn(tasks.signJar)
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/thaumicaugmentation/api/**'
}
task sourcesJar(type: Jar) {
from sourceSets.main.java
archiveClassifier = 'sources'
}
artifacts {
archives apiJar
archives javadocJar
archives sourcesJar
}
test {
useJUnit()
maxHeapSize = '1G'
}