-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
125 lines (104 loc) · 2.73 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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.eriwen:gradle-js-plugin:1.8.0'
classpath 'com.eriwen:gradle-css-plugin:1.8.0'
}
}
/*
* Gets the version name from the latest Git tag
*/
def getVersionName = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
return stdout.toString().trim()
}
// Invoke the plugin
apply plugin: 'js'
apply plugin: 'css'
def srcDir = "${projectDir}/src"
def jsSrcDir = "${srcDir}/webui/js/"
def webDir = "${projectDir}/web"
def distDir = "${projectDir}/dist"
def treesDir = "${srcDir}/definitions/output_min"
task hello {
doLast {
currentTime = new java.util.Date()
java.text.SimpleDateFormat f = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss z")
f.setTimeZone(TimeZone.getTimeZone("UTC"))
javascript.print.each {File file ->
println file
}
}
}
task dist(dependsOn: ['copyWebDir', 'copyScripts', 'copyTreeDefinitions']) {
}
task copyWebDir(type: Copy) {
from "${webDir}"
into "${distDir}/eq2aa"
include '**/*'
}
task copyScripts(type: Copy) {
from "${jsSrcDir}"
into "${distDir}/eq2aa/js"
include '*.js'
}
task copyTreeDefinitions(type: Copy) {
from "${treesDir}"
into "${distDir}/eq2aa/js/trees"
include "*.json"
}
task clean(type: Delete) {
delete "build", "dist"
}
task deployTest(dependsOn: dist) {
}
javascript.common = files(
"util/utils.js",
"util/shims.js",
"Constants.js",
"GameVersions.js"
) + fileTree(jsSrcDir) {
include "io/**/*.js"
include "lib/**/*.js"
include "model/**/*.js"
include "ui/**/*.js"
}
javascript.main = javascript.common + files(
"XmlBuilder.js",
"Main.js",
"eq2aa_entry.js"
)
javascript.print = javascript.common + files(
"print_entry.js"
)
task combinejs(type: com.eriwen.gradle.js.tasks.CombineJsTask) {
source = []
dest = file("${buildDir}/all.js")
}
task minifyjs(type: com.eriwen.gradle.js.tasks.MinifyJsTask) {
source = combinejs
dest = file("${buildDir}/all-min.js")
closure {
warningLevel = 'QUIET'
}
}
task gzipjs(type: com.eriwen.gradle.js.tasks.GzipJsTask) {
source = minifyjs
dest = file("${buildDir}/all-min.js")
}
task jshintjs(type: com.eriwen.gradle.js.tasks.JsHintTask) {
source = fileTree(dir: jsSrcDir, include: '**/*.js')
dest = file("${buildDir}/jshint.out")
jshint.options = [
trailing: "true",
immed: "true",
newcap: "true",
eqeqeq: "true"
]
}