-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle
More file actions
273 lines (219 loc) · 6.63 KB
/
Copy pathbuild.gradle
File metadata and controls
273 lines (219 loc) · 6.63 KB
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
import net.thesilkminer.gradle.plugin.translationchecker.tasks.TranslationCheckTask
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
name = 'Forge'
url = 'http://files.minecraftforge.net/maven'
}
maven {
name 'OpenMods Third Party'
url 'http://repo.openmods.info/artifactory/simple/thirdparty'
}
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '2.2-SNAPSHOT'
classpath group: 'net.thesilkminer.gradle.translationchecker', name: 'TranslationChecker', version: '1.1'
classpath group: 'com.autoscout24.gradle', name: 'gradle-todo-plugin', version: '1.0'
}
}
plugins {
id 'com.github.hierynomus.license' version '0.14.0'
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'com.autoscout24.gradle.todo'
apply plugin: 'findbugs'
apply plugin: 'checkstyle'
idea {
module {
inheritOutputDirs = true
}
}
// noinspection GrUnresolvedAccess
license {
// noinspection GrUnresolvedAccess
header file('LICENSE')
// noinspection GrUnresolvedAccess
include '**/*.java'
// noinspection GrUnresolvedAccess
strictCheck true
// noinspection GrUnresolvedAccess
ignoreFailures false
// noinspection GrUnresolvedAccess
mapping {
java='SLASHSTAR_STYLE'
}
}
todo {
todoPattern = '\\/(\\/|\\*)(( )|())[\\\\t\\\\s]*(TODO|FIXME)(.*)'
}
findbugs {
ignoreFailures = true
}
checkstyle {
toolVersion = '8.2'
configFile = new File(new File(rootDir, 'etc'), 'checkstyle.xml')
}
tasks.withType(FindBugs) {
reports {
// FindBugs only supports one report, ffs
xml.enabled = false
html.enabled = true
html.stylesheet project.resources.text.fromFile('etc/findbugs.xsl')
html.destination rootProject.file('build/reports/findbugs.html')
}
}
tasks.withType(Checkstyle) {
reports {
xml.enabled = true
xml.destination rootProject.file('build/reports/checkstyle.xml')
html.enabled = true
html.stylesheet project.resources.text.fromFile('etc/checkstyle.xsl')
html.destination rootProject.file('build/reports/checkstyle.html')
}
}
sourceCompatibility = 1.6
targetCompatibility = 1.6
repositories {
mavenCentral()
jcenter()
maven {
name "IGW"
url "http://maven.k-4u.nl/"
}
}
dependencies {
// OpenModsLib
compile project(":OpenModsLib")
// IGW-Mod
compile group: 'igwmod', name: 'IGW-Mod-1.9.4', version: '1.3.0-5', classifier: 'userdev' // Don't ask why we're using 1.9.4. Just don't
}
//================================================
// Jar data
// Grab system env
ext.env = System.getenv()
version = mc_version + "-" + openmods_igw_version
ext.in_jenkins = false
if (env.BUILD_TAG != null) {
// If this works, we'll assume we're in Jenkins at least.
in_jenkins = true
}
def branch = null
def hash = null
def proc1 = "git rev-parse --short HEAD".execute()
proc1.in.eachLine { line -> //noinspection GrReassignedInClosureLocalVar
hash = line }
proc1.err.eachLine { line -> println line }
proc1.waitFor()
if (!in_jenkins) {
def proc2 = "git rev-parse --abbrev-ref HEAD".execute()
proc2.in.eachLine { line -> //noinspection GrReassignedInClosureLocalVar
branch = line }
proc2.err.eachLine { line -> println line }
proc2.waitFor()
} else { // In Jenkins
branch = env.GIT_BRANCH.minus("origin/")
}
// If not on master, add branch to jar name
if (branch != null && !(branch.equals("master") || branch.equals(current_dev_branch))) {
version += "-" + branch
} else {
//version += "-" + hash
}
// Version tag for jar file name
if (env.BUILD_NUMBER != null) {
//noinspection GroovyAssignabilityCheck
version += "-snapshot-" + env.BUILD_NUMBER
}
// Jar Data END
//================================================
ext.jenkinsManifest = manifest {
if (in_jenkins) {
attributes("Jenkins-Build": "true", "Jenkins-Tag": env.BUILD_TAG, "Jenkins-ID": env.BUILD_ID)
} else {
attributes("Jenkins-Build": "false")
}
}
ext.gitManifest = manifest {
if (env.GIT_BRANCH != null) {
attributes("Git-Branch": branch, "Git-Hash": hash)
} else {
attributes("Git-Branch": 'Not in a Git Branch', "Git-Hash": 'unavailable')
}
}
ext.coremodManifest = manifest {}
minecraft {
version = mc_version + "-" + forge_version
runDir = "run"
mappings = mcp_mappings
replaceIn 'openmods/igw/impl/utils/Constants.java'
replace '$VERSION$', openmods_igw_version
replace '$LIB-VERSION$', project(':OpenModsLib').mod_version
replace '$NEXT-LIB-VERSION$', project(':OpenModsLib').next_mod_version
}
processResources {
inputs.property 'version', openmods_igw_version
inputs.property 'mc_version', mc_version
// Process *.info
from(sourceSets.main.resources.srcDirs) {
include '**/*.info'
expand 'version': openmods_igw_version, 'mc_version': mc_version
}
// Copy anything else directly
from(sourceSets.main.resources.srcDirs) {
exclude '**/*.info'
}
}
// Merge Jenkins and Git manifests to form final manifest in final release jar
jar {
manifest {
//noinspection GroovyAssignabilityCheck
from jenkinsManifest, gitManifest, coremodManifest
}
exclude "optifine/**"
}
ext.sourcesPath = new File(new File(new File(buildDir, "sources"), "main"), "java")
// API jar
task apiJar(type: Jar) {
baseName 'OpenMods-IGW-API'
version openmods_igw_api_version
//noinspection GroovyAssignabilityCheck
from sourceSets.main.output
include 'openmods/igw/api/**'
classifier = 'api'
manifest {
//noinspection GroovyAssignabilityCheck
from jenkinsManifest, gitManifest
}
}
// API Src Jar
task apiSrcJar(type: Jar) {
baseName 'OpenMods-IGW-API'
version openmods_igw_api_version
classifier 'sources'
from sourcesPath
include 'openmods/igw/api/**'
manifest {
//noinspection GroovyAssignabilityCheck
from jenkinsManifest, gitManifest
}
}
//noinspection GrUnresolvedAccess,GroovyAssignabilityCheck
compileJava.dependsOn licenseMain
//noinspection GrUnresolvedAccess,GroovyAssignabilityCheck
licenseMain.dependsOn licenseFormatMain
//noinspection GrUnresolvedAccess,GroovyAssignabilityCheck
compileJava.dependsOn checkTodo
build.dependsOn check
artifacts {
archives apiJar
archives apiSrcJar
}
task checkTranslations(type: TranslationCheckTask) {
modId = 'openmods-igw'
}
build.dependsOn checkTranslations
task wrapper(type: Wrapper) {
gradleVersion = "3.5-rc-2"
}