forked from tonytomov/jqGrid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
107 lines (87 loc) · 2.87 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
configurations {
jscompiler
}
repositories {
mavenCentral()
}
dependencies {
jscompiler 'com.google.javascript:closure-compiler:r1810'
}
def srcdir = new File('js')
def distdir = new File('dist')
def jqGridFile = new File(distdir, 'jquery.jqGrid.js')
def jqGridMinFile = new File(distdir, 'jquery.jqGrid.min.js')
task init() {
description = "Create distribution directory: $distdir.absolutePath"
outputs.dir distdir
doLast {
if (!distdir.exists()) {
distdir.mkdirs()
}
}
}
task jqgrid(dependsOn: 'init') {
description = "Concatinate all javascript files into one javascript file: $jqGridFile.absolutePath"
def files = fileTree(dir: srcdir, include: '*.js')
inputs.file files
outputs.file jqGridFile
doLast {
ant.concat(destfile: jqGridFile) {
files.each { fileset(file: it) }
}
}
}
task 'jqgrid-min'(dependsOn: 'jqgrid') {
description = "Minimize $jqGridFile.absolutePath to $jqGridMinFile.absolutePath"
inputs.file jqGridFile
outputs.file jqGridMinFile
doLast {
ant.taskdef(name: 'jscompile', classname: 'com.google.javascript.jscomp.ant.CompileTask', classpath: configurations.jscompiler.asPath)
ant.jscompile(output: jqGridMinFile, warning: 'QUIET', debug: logger.debugEnabled) {
ant.sources(dir: jqGridFile.parent) {
ant.file(name: jqGridFile.name)
}
}
}
}
task 'min-files'(dependsOn: 'init') {
def minDir = new File(distdir, 'min')
description = "Minimize all javascript files to $minDir.absolutePath"
def files = fileTree(dir: srcdir, include: '*.js')
inputs.file files
outputs.dir minDir
doLast {
if (!minDir.exists()) {
minDir.mkdirs()
}
ant.taskdef(name: 'jscompile', classname: 'com.google.javascript.jscomp.ant.CompileTask', classpath: configurations.jscompiler.asPath)
files.each { File f ->
ant.jscompile(output: new File(minDir, f.name), warning: 'QUIET', debug: logger.debugEnabled) {
ant.sources(dir: f.parent) {
ant.file(name: f.name)
}
}
}
}
}
task i18n(type: Copy, dependsOn: 'init') {
def i18nDir = new File(distdir, 'i18n')
description = "Copy all i18n files to $i18nDir.absolutePath"
from new File(srcdir, 'i18n')
into i18nDir
include('grid.locale-*.js')
}
task clean() {
description = "Delete distribution directory: $distdir.absolutePath"
doLast {
if (distdir.exists()) {
distdir.deleteDir()
}
}
}
task build(dependsOn: ['jqgrid-min', 'min-files', 'i18n']) {
description = "Build the entire distribution"
}
task wrap(type: Wrapper) {
gradleVersion = '1.0-milestone-8a'
}