forked from SpongePowered/SpongeForge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
183 lines (146 loc) · 5.45 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
// Gradle plugins
buildscript {
repositories {
maven {
name = 'sponge'
url = 'https://repo.spongepowered.org/repository/maven-public/'
}
}
dependencies {
classpath('net.minecraftforge.gradle:ForgeGradle:2.3+') {
// The gradle Kotlin plugin depends on Intellij's custom fork
// of GNU Trove, which it doesn't relocate.
// Therefore, we need to remove any other version of Trove
// from the classpath, to ensure that 'gnu.trove.*' always
// resolves to Intellij's version of Trove at runtime
// See https://youtrack.jetbrains.com/issue/IDEA-211616
exclude group: 'trove', module: 'trove'
exclude group: 'net.sf.trove4j', module: 'trove4j'
}
classpath 'gradle.plugin.net.minecrell:licenser:0.3'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
classpath 'gradle.plugin.org.spongepowered:spongegradle:0.8.1'
classpath 'org.spongepowered:mixingradle:0.5-SNAPSHOT'
}
}
repositories {
mavenLocal()
}
// ForgeGradle tries to pull in typesafe config 1.2.1,
// which causes issues when running Sponge from Intellij.
// We force Gradle to use 1.3.1, which resolves the issue
configurations.all {
resolutionStrategy {
force 'com.typesafe:config:1.3.1'
// Force McTester to use our local SpongeAPI
/*dependencySubstitution {
substitute(module("org.spongepowered:spongeapi")).with(project(":SpongeCommon:SpongeAPI"))
}*/
}
}
configurations { testCompile.extendsFrom(forgeGradleMcDeps) }
// On Forge, we use the Forge build number as Minecraft version for ForgeGradle
ext.common = project(":SpongeCommon")
ext.minecraftVersion = common.minecraftVersion + "-" + forgeVersion + '.' + forgeBuild
ext.testmods = project.project('testmods')
ext.implementationId = "spongeforge"
// Apply shared implementation Gradle config
apply from: common.file('gradle/implementation.gradle')
version = "$minecraft.version-$forgeBuild-$implementationVersion"
minecraft {
coreMod = 'org.spongepowered.mod.SpongeCoremod'
replace '@expected_certificate_fingerprint@', project.hasProperty('spongeCertificateFingerprint') ? project.property('spongeCertificateFingerprint') : ''
}
sponge.plugin.meta {
dependencies {
forge {
version = forgeVersion + '.' + forgeBuild
}
}
}
dependencies {
runtime testmods
}
compileJava {
options.compilerArgs += [ "-Atokens=FORGE=$forgeBuild;FML=$forgeBuild" ]
}
if (project.hasProperty('spongeKeyStore')) {
task signShadowJar(type: SignJar, dependsOn: reobfJar) {
keyStore = project.spongeKeyStore
alias = project.spongeKeyStoreAlias
storePass = project.spongeKeyStorePass
keyPass = project.spongeKeyStoreKeyPass
inputFile = shadowJar.archivePath
outputFile = shadowJar.archivePath
}
signShadowJar.dependsOn shadowJar
build.dependsOn signShadowJar
}
jar {
exclude 'log4j2.xml' // log4j2 configuration is for the development workspace only
manifest {
attributes(
'Main-Class': 'org.spongepowered.launch.Main',
'TargetForgeBuild': forgeBuild,
'TargetForgeVersion': minecraft.forgeVersion,
'FMLCorePlugin': 'org.spongepowered.mod.SpongeCoremod',
'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
'TweakOrder': 0
)
}
}
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
task shadowDevJar(type: ShadowJar) {
classifier = 'dev-shaded'
from sourceSets.main.output
from sourceSets.java6.output
// Default settings for shadow tasks
configurations = [project.configurations.runtime]
manifest.inheritFrom tasks.jar.manifest
exclude 'META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA'
}
shadowDevJar shadowConfiguration
// Upload shadowDevJar to Maven repository
artifacts {
archives shadowDevJar
}
allprojects {
// Re-obfuscate only after creating the shadowDevJar
tasks.findByName('reobfJar')?.mustRunAfter this.tasks.shadowDevJar
}
tasks.withType(ShadowJar) {
exclude 'log4j2*.xml' // log4j2 configuration is for the development workspace only
// Temporarily relocate and shade to avoid confict with forge. TODO: Remove when Forge updates to 1.3.0
relocate('com.typesafe.config', 'configurate.typesafe.config')
dependencies {
exclude project(testmods.path)
include dependency('com.typesafe:config')
// This is not available on the client so we need to shade it
include dependency('com.google.code.findbugs:jsr305')
}
}
sourceSets.java6.runtimeClasspath += sourceSets.main.runtimeClasspath
reobf {
jar {
extraFiles 'extraSrg.srg'
}
}
mixin {
extraSrgFile("searge", file('extraSrg.srg'))
}
uploadArchives {
repositories {
mavenDeployer {
pom.whenConfigured {
pom -> pom.dependencies.removeAll { it.groupId == 'org.spongepowered' && it.artifactId == 'testmods' }
}
}
}
}
tasks.withType(JavaCompile) {
options.incremental = false
}
// Unfortunately, Mixin's annotation processor requires that SpongeCommon
// is compiled, in order for SpongeForge's references to SpongeCommon
// to be resolved by the AP. See https://github.com/SpongePowered/Mixin/issues/320
project(":SpongeCommon").tasks.compileJava.outputs.upToDateWhen { false }