-
Notifications
You must be signed in to change notification settings - Fork 33
/
build.gradle
206 lines (171 loc) · 4.96 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
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
name = 'Forge'
url = 'http://files.minecraftforge.net/maven'
}
maven {
name 'OpenMods Third Party'
url 'http://repo.openmods.info/artifactory/simple/thirdparty'
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'net.thesilkminer.gradle.translationchecker:TranslationChecker:1.1'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'java'
// HACK: we want to add those repos to all including projects, but still be available to compile this project directly
rootProject.allprojects {
repositories {
mavenCentral()
jcenter()
maven {
name 'Forge'
url 'http://files.minecraftforge.net/maven'
}
maven {
name 'MinecraftS3'
url 'http://s3.amazonaws.com/Minecraft.Download/libraries'
}
maven {
name "OpenMods"
url "http://repo.openmods.info/artifactory/openmods"
}
maven {
name "OpenMods Extras"
url 'http://repo.openmods.info/artifactory/thirdparty'
}
}
}
/*
repositories {
maven {
name "local"
url ('file:/' + project.file('repo').getAbsolutePath())
}
}
*/
configurations {
shade {
transitive = false
}
compile.extendsFrom shade
}
dependencies {
shade group: 'info.openmods', name: 'calc', version: '0.3'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile "org.mockito:mockito-core:1.10.19"
}
def String git(String... arguments) {
def out = new ByteArrayOutputStream()
exec {
executable = 'git'
args = arguments.toList()
standardOutput = out
}
out.toString().trim()
}
def String gitHash() {
git 'rev-parse', '--short', 'HEAD'
}
def String gitBranch() {
git 'rev-parse', '--abbrev-ref', 'HEAD'
}
def env = System.getenv()
version = mc_ver + "-" + mod_version
def in_jenkins = false
def jenkinsManifest = manifest {
if (env.BUILD_TAG != null) { // If this works, we'll assume we're in Jenkins atleast.
attributes("Jenkins-Build": "true", "Jenkins-Tag": env.BUILD_TAG, "Jenkins-ID": env.BUILD_ID)
in_jenkins = true
} else {
attributes("Jenkins-Build": "false")
}
}
def branch = in_jenkins ? env.GIT_BRANCH.minus("origin/") : gitBranch()
def hash = gitHash()
if (branch != null && !branch.equals("master")) {
version += "-" + branch
}
if (env.BUILD_NUMBER != null) {
version += "-snapshot-" + env.BUILD_NUMBER
}
def gitManifest = manifest {
if (branch != null) {
attributes("Git-Branch": branch, "Git-Hash": hash)
}
}
minecraft {
version = mc_ver + "-" + forge_ver
runDir = "run"
mappings = mcp_mappings
replaceIn "openmods/OpenMods.java"
replaceIn "openmods/core/OpenModsCore.java"
replaceIn "openmods/core/OpenModsCorePlugin.java"
replace '$LIB-VERSION$', mod_version
}
processResources {
inputs.property "version", mod_version
inputs.property "mcversion", project.minecraft.version
// Process mcmod.info
from(sourceSets.main.resources.srcDirs) {
include '**/*.info'
expand 'version':mod_version, 'mc_version':mc_ver
}
// Copy anything else directly
from(sourceSets.main.resources.srcDirs) {
exclude '**/*.info'
}
}
def fmlManifest = manifest {
attributes(
"FMLCorePlugin": "openmods.core.OpenModsCorePlugin",
"FMLCorePluginContainsFMLMod": "true",
)
}
if (project.hasProperty('keyStore')) {
task signJar(type: SignJar, dependsOn: reobfJar) {
keyStore = project.keyStore
alias = project.keyStoreAlias
storePass = project.keyStorePass
keyPass = project.keyStoreKeyPass
inputFile = jar.archivePath
outputFile = jar.archivePath
}
build.dependsOn signJar
}
jar {
manifest {
from jenkinsManifest, gitManifest, fmlManifest
}
configurations.shade.each { dep ->
from(project.zipTree(dep)){
exclude 'META-INF', 'META-INF/**'
}
}
}
javadoc {
if (JavaVersion.current().isJava8Compatible()) {
options.addBooleanOption('Xdoclint:accessibility,html,syntax', true)
}
}
task updateTranslations(type: net.thesilkminer.gradle.plugin.translationchecker.tasks.TranslationCheckTask) {
modId = "openmods"
templateFileName = "en_us.lang"
}
task checkTranslations(type: net.thesilkminer.gradle.plugin.translationchecker.tasks.TranslationCheckTask) {
modId = "openmods"
dryRun = true
templateFileName = "en_us.lang"
}
task wrapper (type: Wrapper) {
gradleVersion = "2.14"
}
task generateOrientationDetails(type: JavaExec, dependsOn: compileJava) {
main = "openmods.geometry.OrientationInfoGenerator"
classpath = sourceSets.main.runtimeClasspath + files(sourceSets.main.output.classesDir)
}