-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.gradle
213 lines (183 loc) · 5.79 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
buildscript {
repositories {
jcenter()
maven {
name = 'Forge'
url = "https://files.minecraftforge.net/maven"
}
maven {
name = 'Sponge'
url = 'https://repo.spongepowered.org/maven'
}
maven {
name = 'Jitpack.io'
url = 'https://jitpack.io'
}
maven {
name = 'Maven'
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'org.spongepowered.mixin'
repositories {
maven {
name = "Sponge"
url = "https://repo.spongepowered.org/maven/"
}
maven {
name = 'bStats'
//Updated to new repo for bStats
url = 'https://repo.codemc.org/repository/maven-public'
}
maven {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven"
}
maven {
name = 'Jitpack.io'
url = 'https://jitpack.io'
}
}
ext.GetCommitCount = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-list', '--all', '--count'
standardOutput = stdout
}
return stdout.toString().trim()
}
boolean isFat = hasProperty("isFat")
boolean installIntoServer = hasProperty("installIntoServer")
boolean isObfuscated = project.gradle.startParameter.taskNames.contains("build")
String buildType = (isFat ? "FAT" : "THIN")
String version_file = "./build/last_version.txt"
String last_file_name = "./build/last_file_name.txt"
String last_file_path = "./build/last_file_path.txt"
if(project.gradle.startParameter.taskNames.contains("build")) {
println("Building: " + buildType)
delete version_file
delete last_file_name
delete last_file_path
}
String spongeForgeVersion = '1.12.2-2838-7.1.11-RC4007'
String forgeVersion = '1.12.2-14.23.5.2847'
version = "1.12.2-GAMMA-1.8.1" + "-" + GetCommitCount()
group = "com.github.terminatornl"
archivesBaseName = "Tiquality-"+ (isObfuscated ? "" : "DEOBF-") + buildType
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = "1.8"
options.fork = true
options.forkOptions.executable = 'javac'
options.compilerArgs << "-XDignore.symbol.file"
}
minecraft {
version = forgeVersion
runDir = "run"
mappings = "snapshot_20180808"
replaceIn "Tiquality.java"
replace '${version}', buildType + "-" + project.version
replaceIn "mixinhelper/MixinConfigPlugin.java"
replace '${spongeforge_version}', spongeForgeVersion
replaceIn "mixinhelper/MixinConfigPlugin.java"
replace '${forge_version}', forgeVersion
}
configurations {
embed
compile.extendsFrom(embed)
compileOnly.transitive = false
}
dependencies {
/*
Sponge
*/
compile ('org.spongepowered:spongeforge:' + spongeForgeVersion + ':dev'){
transitive = true
}
/*
GriefPrevention
Run configuration requires: -Dbstats.relocatecheck="false" in VM options.
Caused by module: bstats-sponge
*/
//TODO: Wait for GriefPrevention to update to the latest Sponge API
compileOnly 'me.ryanhamshire:griefprevention:1.12.2-4.3.0.662:original'
compileOnly 'com.github.bloodmc:GriefDefenderAPI:-SNAPSHOT'
/*
FTB Utilities
*/
compileOnly 'ftb-utilities:FTBUtilities:5.3.0.52'
/*
FTB Library
*/
compileOnly 'ftblib:FTBLib:5.3.0.56'
if(isFat) {
embed('org.spongepowered:mixin:0.8-SNAPSHOT') {
['gson','guava','commons-io','launchwrapper'].each {
exclude module: it
}
}
}else{
compile ('org.spongepowered:mixin:0.8-SNAPSHOT'){
['gson','guava','commons-io'].each {
exclude module: it
}
}
}
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", buildType + "-" + project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
include 'mixins.tiquality.json'
expand 'version':buildType + "-" + project.version, 'mcversion':project.minecraft.version
}
// copy everything else, thats not the mcmod.info or mixins.tiquality.json
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
exclude 'mixins.tiquality.json'
}
}
sourceSets.main.refMap = "mixins.tiquality.refmap.json"
jar {
from (configurations.embed.collect { it.isDirectory() ? it : zipTree(it) }){
/* Embedded mixin */
exclude 'META-INF/MANIFEST.MF'
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
rename 'LICENSE.txt', 'LICENSE-mixin.txt'
}
from ('LICENSE')
manifest.attributes(
'FMLCorePluginContainsFMLMod': 'true',
'ForceLoadAsMod': 'true',
'MixinConfigs': 'mixins.tiquality.json',
'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
'TweakOrder': '0',
)
}
/* Convienience script to quickly install Tiquality in an obfuscated environment. */
build.doLast {
new File(projectDir, version_file).text = version
new File(projectDir, last_file_name).text = jar.archiveName
new File(projectDir, last_file_path).text = jar.archivePath
if(installIntoServer) {
delete fileTree('run_server/mods') {
include 'Tiquality*'
}
copy {
from jar.archivePath
into "run_server/mods"
}
println("Replaced Tiquality in 'run_server/mods'")
}
}