forked from Johni0702/BetterPortals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
281 lines (250 loc) · 9.37 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
buildscript {
ext.kotlin_version = '1.3.10'
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
maven { url = "https://repo.spongepowered.org/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'org.spongepowered.mixin'
ext {
mixinDep = 'org.spongepowered:mixin:0.7.11-SNAPSHOT'
twilightforestDepBase = 'the-twilight-forest:twilightforest-1.12.2:3.9.984'
twilightforestDep = "$twilightforestDepBase:universal"
mekanismDepBase = 'mekanism:Mekanism:1.12.2'
mekanismDep = "$mekanismDepBase:9.7.9.380" // yes, the classifier is the version (really, CF?!)...
aetherDepBase = 'the-aether:aether_legacy:1.12.2'
aetherDep = "$aetherDepBase:v1.4.4"
cubicChunksDepBase = 'opencubicchunks:CubicChunks-1.12.2-0.0.970.0:SNAPSHOT'
cubicChunksDep = "$cubicChunksDepBase:all"
}
version = determineVersion()
group = "de.johni0702.minecraft"
archivesBaseName = "betterportals"
sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
sourceSets {
view {
compileClasspath += sourceSets.api.compileClasspath
compileClasspath += sourceSets.api.output
}
transition {
compileClasspath += sourceSets.api.compileClasspath
compileClasspath += sourceSets.api.output
}
portal {
compileClasspath += sourceSets.api.compileClasspath
compileClasspath += sourceSets.api.output
}
vanilla {
compileClasspath += sourceSets.api.compileClasspath
compileClasspath += sourceSets.api.output
}
twilightforest {
compileClasspath += sourceSets.api.compileClasspath
compileClasspath += sourceSets.api.output
}
mekanism {
compileClasspath += sourceSets.api.compileClasspath
compileClasspath += sourceSets.api.output
}
aether {
compileClasspath += sourceSets.api.compileClasspath
compileClasspath += sourceSets.api.output
}
main {
compileClasspath += sourceSets.view.output
compileClasspath += sourceSets.transition.output
compileClasspath += sourceSets.portal.output
compileClasspath += sourceSets.vanilla.output
compileClasspath += sourceSets.twilightforest.output
compileClasspath += sourceSets.mekanism.output
compileClasspath += sourceSets.aether.output
}
integrationTest {
compileClasspath += sourceSets.main.compileClasspath
compileClasspath += sourceSets.main.output
}
}
minecraft {
// Note: For development, either uncomment the following line or manually add -Dfml.coreMods.load=de.johni0702.minecraft.betterportals.impl.MixinLoader
// to the jvm arguments.
// coreMod = "de.johni0702.minecraft.betterportals.impl.MixinLoader"
version = "1.12.2-14.23.5.2838"
runDir = "run"
mappings = "snapshot_20171003"
}
mixin {
add sourceSets.view, "mixins.betterportals.view.refmap.json"
add sourceSets.transition, "mixins.betterportals.transition.refmap.json"
add sourceSets.portal, "mixins.betterportals.refmap.json"
add sourceSets.integrationTest, "mixins.betterportals.test.refmap.json"
extraSrgFile "searge", "extra.srg"
}
repositories {
maven {
name = "SpongePowered Repo"
url = "http://repo.spongepowered.org/maven/"
}
mavenCentral()
maven {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven/"
}
jcenter()
maven {
name = "Shadowfacts"
url = "https://maven.shadowfacts.net"
}
}
configurations {
shade
compile.extendsFrom shade
integrationTest.extendsFrom main
}
dependencies {
compile 'net.shadowfacts:Forgelin:1.8.2'
def withoutOldMixinDeps = {
exclude group: 'com.google.guava' // 17.0
exclude group: 'com.google.code.gson' // 2.2.4
}
runtime mixinDep, withoutOldMixinDeps
viewCompile mixinDep, withoutOldMixinDeps
portalCompile mixinDep, withoutOldMixinDeps
// We want FG to deobf our mod-deps for us.
// However FG sucks and doesn't support non-standard source sets, so we need to use this workaround...
// Might need to run `./gradlew deobfCompileDummyTask` before importing into IDEA (doesn't happen automatically).
deobfCompile cubicChunksDep
runtime "deobf.$cubicChunksDepBase"
viewCompile "deobf.$cubicChunksDepBase"
deobfCompile twilightforestDep
runtime "deobf.$twilightforestDepBase"
twilightforestCompile "deobf.$twilightforestDepBase"
deobfCompile mekanismDep
runtime "deobf.$mekanismDepBase"
mekanismCompile "deobf.$mekanismDepBase"
// Mekanism deps (cause CF and/or FG break transitive dependencies)
deobfCompile 'redstone-flux:RedstoneFlux-1.12:2.1.0.6:universal'
mekanismCompile 'deobf.redstone-flux:RedstoneFlux-1.12:2.1.0.6'
deobfCompile 'industrial-craft:Industrialcraft-2-2.8.111:ex112:api'
mekanismCompile 'deobf.industrial-craft:Industrialcraft-2-2.8.111:ex112'
deobfCompile aetherDep
runtime "deobf.$aetherDepBase"
aetherCompile "deobf.$aetherDepBase"
integrationTestCompile 'org.junit.jupiter:junit-jupiter-engine:5.5.1'
integrationTestCompile 'org.junit.platform:junit-platform-launcher:1.5.0'
integrationTestCompile 'io.kotlintest:kotlintest-runner-junit5:3.4.0'
integrationTestRuntimeOnly configurations.forgeGradleGradleStart
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
jar {
from ({files(configurations.runtime.findAll {it.name.startsWith 'mixin-'} + configurations.shade)
.collect {it.isDirectory() ? it : zipTree(it)}}) {
exclude 'META-INF/*.SF'
exclude 'META-INF/*.RSA'
}
from sourceSets.api.output
from sourceSets.view.output
from sourceSets.transition.output
from sourceSets.portal.output
from sourceSets.vanilla.output
from sourceSets.twilightforest.output
from sourceSets.mekanism.output
from sourceSets.aether.output
exclude 'de/johni0702/minecraft/betterportals/MixinLoader.class'
exclude 'mixins.betterportals.test.refmap.json' // MixinGradle is being stupid
manifest {
attributes 'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
'TweakOrder': '0',
'ForceLoadAsMod': 'true',
'FMLCorePluginContainsFMLMod': 'true',
'MixinConfigs': 'mixins.betterportals.json,mixins.betterportals.view.json',
'FMLAT': 'betterportals_at.cfg'
}
}
task copySrg(type: Copy, dependsOn: 'genSrgs') {
from {project.tasks.genSrgs.mcpToSrg}
into 'build'
}
setupDecompWorkspace.dependsOn copySrg
setupDevWorkspace.dependsOn copySrg
project.tasks.idea.dependsOn copySrg
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
kotlinOptions {
jvmTarget = "1.8"
}
}
task runIntegrationTest(type: JavaExec) {
dependsOn tasks.jar
dependsOn tasks.makeStart
main = 'GradleStart'
standardOutput = System.out
errorOutput = System.err
enableAssertions = true
def testDir = new File(project.buildDir, "integration-test")
args "--gameDir", testDir.canonicalPath
workingDir testDir
doFirst {
testDir.deleteDir()
testDir.mkdirs()
}
// Default MC/Forge deps
classpath configurations.runtime
classpath configurations.forgeGradleMc
classpath configurations.forgeGradleMcDeps
classpath configurations.forgeGradleGradleStart
// Base mod
classpath tasks.jar.archivePath
// Test classes and deps
classpath sourceSets.integrationTest.output
classpath configurations.integrationTestCompile
systemProperty "fml.noGrab", "true"
systemProperty "fml.coreMods.load", "de.johni0702.minecraft.betterportals.impl.TestLoader"
}
def determineVersion() {
def latestVersion = file('version.txt').readLines().first()
def releaseCommit = command('git', 'blame', '-p', '-l', 'version.txt').first().tokenize(' ').first()
def currentCommit = command('git', 'rev-parse', 'HEAD').first()
def version
if (releaseCommit == currentCommit) {
version = latestVersion
} else {
def diff = command('git', 'log', '--format=oneline', "$releaseCommit..$currentCommit").size()
version = "$latestVersion-$diff-g${currentCommit.substring(0, 7)}"
}
if (!command('git', 'status', '--porcelain').empty) {
version = "$version*"
}
return version
}
def command(Object...cmd) {
def stdout = new ByteArrayOutputStream()
exec {
commandLine cmd
standardOutput = stdout
}
return stdout.toString().tokenize('\n')
}