-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
232 lines (194 loc) · 7.46 KB
/
build.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="SmartWFM" default="prod" basedir=".">
<description>SmartWFM ANT build file</description>
<!-- build date -->
<tstamp>
<format property="build.date" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<!-- set properties for build -->
<property description="Build directory" name="build.dir" value="build" />
<property description="Build file name" name="tmp.build.file" value="SmartWFM.js" />
<property description="Build css file name" name="build.css.file" value="SmartWFM.css" />
<!-- perpare build directory -->
<target name="-init" description="Create build directory structure">
<!-- delete previous build directory -->
<delete dir="${build.dir}" />
<!-- recreate build directory -->
<mkdir dir="${build.dir}" />
<echo>Finished</echo>
</target>
<target name="-concat-js" depends="-init" description="Concatenate all js files">
<concat destfile="${build.dir}/tmp-date.js">
var SmartWFMBuildDate = '${build.date}';
</concat>
<concat destfile="${build.dir}/tmp-plupload.js" encoding="UTF-8" outputencoding="UTF-8">
<filelist dir="ux/upload/plupload/js">
<file name="plupload.js" />
<file name="plupload.html4.js" />
<file name="plupload.html5.js" />
</filelist>
</concat>
<concat destfile="${build.dir}/tmp-upload.js" encoding="UTF-8" outputencoding="UTF-8">
<filelist dir="ux/upload/">
<file name="Basic.js" />
<file name="Button.js" />
<file name="plugin/Window.js" />
</filelist>
</concat>
<concat destfile="${build.dir}/tmp-ux.js" encoding="UTF-8" outputencoding="UTF-8">
<fileset dir="ux">
<include name="**/*.js" />
<exclude name="upload/**/*.js" />
</fileset>
</concat>
<concat destfile="${build.dir}/tmp-lib.js" encoding="UTF-8" outputencoding="UTF-8">
<fileset dir="app/lib">
<include name="**/*.js" />
</fileset>
</concat>
<concat destfile="${build.dir}/tmp-model-store-view.js" encoding="UTF-8" outputencoding="UTF-8">
<fileset dir="app">
<include name="model/**/*.js" />
<include name="store/**/*.js" />
<include name="view/**/*.js" />
<exclude name="view/baseActions/ErrorWindow.js view/baseActions/ProgressWindow.js" />
</fileset>
</concat>
<concat destfile="${build.dir}/tmp-controller.js" encoding="UTF-8" outputencoding="UTF-8">
<fileset dir="app/controller">
<include name="**/*.js" />
</fileset>
</concat>
<concat destfile="${build.dir}/${tmp.build.file}" encoding="UTF-8" outputencoding="UTF-8">
<filelist dir=".">
<file name="${build.dir}/tmp-date.js" />
<file name="${build.dir}/tmp-plupload.js" />
<file name="${build.dir}/tmp-ux.js" />
<file name="${build.dir}/tmp-lib.js" />
<file name="${build.dir}/tmp-upload.js" />
<file name="app/config/Icons.js" />
<file name="app/view/baseActions/ErrorWindow.js" />
<file name="app/view/baseActions/ProgressWindow.js" />
<file name="${build.dir}/tmp-model-store-view.js" />
<file name="${build.dir}/tmp-controller.js" />
<file name="app/Application.js" />
</filelist>
</concat>
<delete>
<fileset dir="${build.dir}" includes="tmp-*.js" />
</delete>
<echo>Finished</echo>
</target>
<target name="-concat-css" description="Concatenate all css files">
<concat destfile="${build.dir}/${build.css.file}" encoding="UTF-8" outputencoding="UTF-8">
<fileset dir="resources" includes="*.css" />
</concat>
<echo>Finished</echo>
</target>
<target name="-cleanup" depends="-concat-js" description="Removes unused code">
<echo message="Removing development-only stuff ..."/>
<replaceregexp match="// development-only-begin.*?// development-only-end" replace="" flags="gs" byline="false">
<fileset dir="${build.dir}" includes="${tmp.build.file}" />
</replaceregexp>
<echo message="Removing 'requires' stuff ..."/>
<replaceregexp match="\s*requires:\s*\[.*?\]," replace="" flags="gs" byline="false">
<fileset dir="${build.dir}" includes="${tmp.build.file}" />
</replaceregexp>
<copy file="${build.dir}/${tmp.build.file}" tofile="${build.dir}/SmartWFM.dev.js" />
<echo message="Removing 'console' stuff ..."/>
<replaceregexp match="console\.([^ ]*?) *\(.*?\).*?;" replace="" flags="gs" byline="false">
<fileset dir="${build.dir}" includes="${tmp.build.file}" />
</replaceregexp>
<echo>Finished</echo>
</target>
<target name="-minify-js" depends="-cleanup" description="Minifies js file">
<!--Compress JavaScript-files with YUICompressor -->
<echo message="Compressing JavaScript files ..."/>
<apply executable="java" parallel="false" dest="${build.dir}">
<fileset dir="${build.dir}" includes="${tmp.build.file}"/>
<arg line="-jar"/>
<arg path="tools/yuicompressor-2.4.7.jar"/>
<srcfile/>
<arg line="-o"/>
<mapper type="glob" from="*.js" to="*.min.js"/>
<targetfile/>
</apply>
<delete>
<fileset dir="${build.dir}" includes="${tmp.build.file}" />
</delete>
<echo>Finished</echo>
</target>
<target name="-minify-css" depends="-concat-css" description="Minifies css file">
<!--Compress CSS-files with YUICompressor -->
<echo message="Compressing JavaScript files ..."/>
<apply executable="java" parallel="false" dest="${build.dir}">
<fileset dir="${build.dir}" includes="SmartWFM.css"/>
<arg line="-jar"/>
<arg path="tools/yuicompressor-2.4.7.jar"/>
<arg line="--line-break 0"/>
<srcfile/>
<arg line="-o"/>
<mapper type="glob" from="*.css" to="*.min.css"/>
<targetfile/>
</apply>
<echo>Finished</echo>
</target>
<target name="-copy-needed-files" depends="-cleanup">
<mkdir dir="${build.dir}/extjs" />
<copy file="extjs/ext-all.js" todir="${build.dir}/extjs" />
<copy todir="${build.dir}/extjs/resources">
<fileset dir="extjs/resources"/>
</copy>
<mkdir dir="${build.dir}/resources/themes" />
<copy todir="${build.dir}/resources/themes">
<fileset dir="resources/themes"/>
</copy>
<mkdir dir="${build.dir}/resources/help-overlay" />
<copy todir="${build.dir}/resources/help-overlay">
<fileset dir="resources/help-overlay"/>
</copy>
<mkdir dir="${build.dir}/resources/images" />
<copy todir="${build.dir}/resources/images">
<fileset dir="resources/images"/>
</copy>
<mkdir dir="${build.dir}/app/config" />
<copy todir="${build.dir}/app/config">
<fileset dir="app/config"/>
</copy>
<mkdir dir="${build.dir}/codemirror-2.38" />
<copy todir="${build.dir}/codemirror-2.38">
<fileset dir="codemirror-2.38"/>
</copy>
<mkdir dir="${build.dir}/ckeditor" />
<copy todir="${build.dir}/ckeditor">
<fileset dir="ckeditor">
<exclude name="samples/" />
</fileset>
</copy>
<echo>Finished</echo>
</target>
<target name="-copy-needed-files-dev">
<copy file="extjs/ext-all-dev.js" todir="${build.dir}/extjs" />
<echo>Finished</echo>
</target>
<target name="-create-language-files" description="Concatenate json translation file">
<mkdir dir="${build.dir}/i18n" />
<exec executable="python">
<arg value="I18nConcatenator.py"/>
<arg value="app/i18n"/>
<arg value="${build.dir}/i18n"/>
</exec>
<echo>Finished</echo>
</target>
<target name="dev" depends="-cleanup,-concat-css,-copy-needed-files,-create-language-files,-copy-needed-files-dev">
<copy file="index-dev.html" todir="${build.dir}" />
<echo>Finished</echo>
</target>
<target name="prod" depends="-minify-js,-minify-css,-copy-needed-files,-create-language-files">
<copy file="index.html" todir="${build.dir}" />
<echo>Finished</echo>
</target>
<target name="all" depends="dev,prod">
<echo>Finished</echo>
</target>
</project>