-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
161 lines (140 loc) · 4.61 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
import org.apache.tools.ant.filters.ReplaceTokens
// This sets us up for building a forge project - you need all of these
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url "http://techshroom.github.io/downloads/maven"
}
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
classpath group: 'com.techshroom', name: 'Aversion', version: '1.0.1-SNAPSHOT'
}
}
apply plugin: 'forge'
apply plugin: 'aversion-apt'
apply plugin: 'aversion-maven'
apply plugin: 'aversion-util'
util {
javaVersion = '1.8'
}
idea.project.languageLevel = util.javaVersion
group = "com.techshroom"
archivesBaseName = "ChainLink"
ext.configFile = file "build.properties"
configFile.withReader {
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}
// Mod Version + Build metadata
version = "${config.mod.version}+${config.mc.version}"
repositories {
maven {
name 'snapshots'
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
name 'spongepowered'
url 'https://repo.spongepowered.org/maven/'
}
}
dependencies {
compile "com.techshroom:TSModCore:${project.config.mc.version}.0"
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.0.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.0.2'
compile group: 'net.sf.jopt-simple', name: 'jopt-simple', version: '4.7'
compile group: 'com.google.code.gson', name: 'gson', version: '2.3'
compile group: 'org.spongepowered', name: 'mixin', version: '0.4.6-SNAPSHOT'
addAPTReqWComp group: 'com.google.guava', name: 'guava', version: '18.0'
addAPT group: 'com.google.auto.factory', name: 'auto-factory', version: '1.0-SNAPSHOT'
addAPT group: 'com.google.auto.service', name: 'auto-service', version: '1.0-SNAPSHOT'
addAPT group: 'com.google.auto.value', name: 'auto-value', version: '1.2-SNAPSHOT'
addAPTReq name: 'aopalliance'
addAPTReq name: 'asm'
addAPTReq name: 'auto-value'
addAPTReq name: 'auto-common'
addAPTReq name: 'cglib'
addAPTReq name: 'commons-collections'
addAPTReq name: 'commons-lang'
addAPTReq name: 'dagger'
addAPTReq name: 'javawriter'
addAPTReq name: 'javax.inject'
addAPTReq name: 'velocity'
testCompile 'junit:junit:4.11'
}
minecraft {
version = config.mc.version + "-" + config.forge.version
if (file('../run').exists()) {
runDir = "../run"
} else {
runDir = "run"
}
}
ext.replaceTokens = [
'VERSION': config.mod.version,
'MC_VERSION': config.mc.version,
'FORGE_VERSION': config.forge.version,
'ID': config.mod.id,
'NAME': config.mod.name
];
task updateVersion(type: Copy) {
from(sourceSets.main.java.srcDirs)
into 'build/sources/java'
filter(ReplaceTokens, tokens: project.replaceTokens)
}
compileJava.dependsOn updateVersion
processResources {
//redo task if any of these properties change
inputs.property "version", project.version
inputs.property "mc.version", config.mc.version
// Replace properties in all files
from(sourceSets.main.resources.srcDirs) {
include '**.info'
filter(ReplaceTokens, tokens: project.replaceTokens)
}
// Copy everything else
from(sourceSets.main.resources.srcDirs) {
include 'assets/**/*.*'
}
}
// mix dat all in
ext {
mixinSrg = new File(project.buildDir, 'tmp/mixins/mixins.srg')
mixinRefMap = new File(project.buildDir, "tmp/mixins/mixins.chainlink.refmap.json")
}
compileJava {
options.compilerArgs += [
'-Xlint:-processing',
"-AoutSrgFile=${project.mixinSrg.canonicalPath}",
"-AoutRefMapFile=${project.mixinRefMap.canonicalPath}",
"-AreobfSrgFile=${project.file('build/srgs/mcp-srg.srg').canonicalPath}"
]
}
// Copy the current srgs to the build dir so the user doesn't have to go hunting for them
task copySrgs(type: Copy, dependsOn: 'genSrgs') {
from project.plugins.getPlugin('forge').delayedFile('{SRG_DIR}')
include '**/*.srg'
into 'build/srgs'
}
setupDecompWorkspace.dependsOn copySrgs
setupDevWorkspace.dependsOn copySrgs
compileJava.dependsOn copySrgs
// Configure reobfuscation for mixins
reobf.doFirst {
if (project.mixinSrg.exists()) {
addExtraSrgFile project.mixinSrg
}
}
jar {
from project.mixinRefMap
}