-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
281 lines (252 loc) · 10.2 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
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
274
275
276
277
278
279
280
281
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2012, Mttang Inc. All rights reserved.
@author : aNd1coder
@update : $Id: build.xml 19340 2012-05-22 03:10:31Z guiyonghong $
@overview : MUI front-end compiler platform and autotools
@reference : http://www.programmer.com.cn/5770/
-->
<project name="MUI.Build" default="init" basedir=".">
<description description="Mttang front end user interface library"/>
<!-- all properties are in build.properties -->
<property file="build.properties"/>
<property name="www.dir" location="E:\workspaces\Mttang\www\mui"/>
<property name="api.dir" location="${www.dir}\docs\api\"/>
<!-- path to the svnant libraries.-->
<path id="project.classpath">
<pathelement location="${svnjavahl.jar}"/>
<pathelement location="${svnant.jar}"/>
<pathelement location="${svnClientAdapter.jar}"/>
<pathelement location="${svnkit.jar}"/>
<pathelement location="${svntask.jar}"/>
</path>
<taskdef resource="svntask.properties" classpathref="project.classpath"/>
<!-- current date -->
<tstamp>
<format property="now.date" pattern="yyyy-MM-dd" locale="zh"/>
</tstamp>
<!-- usage::::::project overview:::::: -->
<target name="usage" depends="init" description="project overview">
<echo message="[info]----------- ${name} ${version} [${year}] -----------"/>
<echo message="${name} build file"/>
<echo message="--------------------------------------"/>
<echo message=""/>
<echo message="available project diretories are:"/>
<echo message=""/>
<echo message="src ---> css and js source file"/>
<echo message="build ---> compressor(,CSSLint,JSLint,google compiler,concat) the css and js"/>
<echo message="support ---> the third-party tool"/>
<echo message="docs ---> generates the api documentation"/>
<echo message=""/>
<echo message="available targets are:"/>
<echo message=""/>
<echo message="${ant.home}"/>
</target>
<!--jslint :::http://mattsnider.com/build/running-jslint-with-your-ant-build/:::-->
<target name="jslint">
<echo message="JSLinting ${src.dir}/js/*.js"/>
<apply executable="java" parallel="false">
<fileset dir="${src.dir}/js/" includes="*.js"/>
<arg line="-jar"/>
<arg path="${rhino.jar}"/>
<arg path="${jslint.js}"/>
</apply>
</target>
<!--subversion task-->
<target name="update" description="checkout full MUI project">
<svn username="${svnant.repository.user}" password="${svnant.repository.passwd}">
<checkout url="${svnant.repository.url}" revision="HEAD" destPath="."/>
</svn>
</target>
<!--add-->
<target name="svn.add">
<svn>
<add dir="${src.dir}"/>
<add dir="${docs.dir}"/>
<add dir="${www.dir}"/>
</svn>
</target>
<!--update-->
<target name="svn.update">
<svn>
<update dir="${basedir}" recurse="true"/>
<update dir="${www.dir}" recurse="true"/>
</svn>
</target>
<!--commit-->
<target name="svn.commit">
<svn>
<!--<delete>
<fileset dir="workingcopy/deleteTest">
<include name="**/*.del"/>
</fileset>
</delete>-->
<commit message="commit base directory files" dir="${basedir}"/>
<commit message="commit www directory files" dir="${www.dir}"/>
</svn>
</target>
<!--delete-->
<target name="svn.delete">
<svn>
<delete>
<fileset dir="">
<include name=""/>
</fileset>
</delete>
</svn>
</target>
<target name="svn.cleanup">
<svn>
</svn>
</target>
<!--update the js and css file's version in html-->
<target name="svn.info">
<svn username="${svnant.repository.user}" password="${svnant.repository.passwd}">
<status urlProperty="http://axxxx/xxxx/xxxxxx/xxxx" path="." revisionProperty="svn.revision"/>
</svn>
<echo>lastChangedRevisionProperty ${svn.revision}</echo>
</target>
<!--build document-->
<target name="jsdoc">
<echo message="${api.dir}"/>
<exec executable="java" failonerror="true">
<arg value="-jar"/>
<arg path="${jsrun.jar}"/>
<arg path="${jsdoc.home}/app/run.js"/>
<arg value="-d=${api.dir}"/>
<arg value="-t=${jsdoc.home}/templates/codeview"/>
<arg value="-r"/>
<arg value="-q"/>
<arg path="${src.dir}/js/"/>
</exec>
<delete dir="${api.dir}/css/"/>
<delete dir="${api.dir}/javascript/"/>
<antcall target="svn.commit"/>
</target>
<!-- init -->
<target name="init" depends="clean" description="do all the project init task">
<antcall target="svn.update"/>
</target>
<!--copy source file to build directory-->
<target name="copy" depends="init" description="copy source files to build directory">
<echo message="copy all ${src.dir} files to :${build.dir}"/>
<copy todir="${build.dir}/src/" overwrite="true">
<fileset dir="${src.dir}/css/"/>
<fileset dir="${src.dir}/js/"/>
</copy>
</target>
<!--css minify-->
<target name="css.minify" depends="copy" description="minify all css files">
<echo message="minify ${src.dir}/css/ all .css files------[start]"/>
<mkdir dir="${build.dir}/css/"/>
<apply executable="java" verbose="true" dest="${build.dir}/css/" parallel="false" failonerror="true">
<fileset dir="${src.dir}/css/" includes="*.css"/>
<arg line="-jar"/>
<arg path="${yuicompressor.jar}"/>
<arg line="--charset ${inputencoding}"/>
<arg value="--type"/>
<arg value="css"/>
<arg line="-o"/>
<targetfile/>
<mapper type="glob" from="*.css" to="*-min.css"/>
</apply>
<echo message="minify ${src.dir}/css/ all .css files------[end]"/>
</target>
<!--js minify-->
<target name="js.minify" depends="copy" description="minify all js files">
<echo message="minify ${src.dir}/js/ all .js files------[start]"/>
<mkdir dir="${build.dir}/js/"/>
<apply executable="java" verbose="true" dest="${build.dir}/js/" parallel="false" failonerror="true">
<fileset dir="${src.dir}/js/" includes="*.js"/>
<arg line="-jar"/>
<arg path="${yuicompressor.jar}"/>
<arg line="--charset ${inputencoding}"/>
<arg value="--type"/>
<arg value="js"/>
<arg line="-o"/>
<targetfile/>
<mapper type="glob" from="*.js" to="*-min.js"/>
</apply>
<echo message="minify ${src.dir}/js/ all .js files------[end]"/>
</target>
<!--js closure compiler-->
<target name="js.compiler" depends="copy" description="closure compiler all js files">
<echo message="closure compiler ${src.dir}/js/ all .js files------[start]"/>
<mkdir dir="${build.dir}/js/"/>
<apply executable="java" verbose="true" dest="${build.dir}/js/" parallel="false" failonerror="true">
<fileset dir="${src.dir}/js/" includes="*.js"/>
<arg line="-jar"/>
<arg path="${combiner.jar}"/>
<arg line="--charset ${encoding}"/>
<arg value="--warning_level"/>
<arg value="QUIET"/>
<arg value="--js"/>
<srcfile/>
<arg value="--js_output_file"/>
<targetfile/>
<mapper type="regexp" from="^(.*)\.js$" to="\1-min.js"/>
</apply>
<echo message="closure compiler ${src.dir}/js/ all .js files------[end]"/>
</target>
<!--css and js minify-->
<target name="all.minify" depends="css.minify,js.minify" description="minify all css and javascript files">
<delete dir="${build.dir}/src"/>
<echo message="compress ${src.dir} all .css and .js files------[done]"/>
</target>
<!--js dependency combiner-->
<target name="jscombiner" depends="init" description="js dependency combiner">
<mkdir dir="${build.dir}/pkg"/>
<apply executable="java" parallel="true" failonerror="true">
<fileset dir="${src.dir}/js" includes="*.js"/>
<arg line="-jar"/>
<arg path="${combiner.jar}"/>
<arg line="–-charset ${inputencoding}"/>
<arg line="-o ${build.dir}/pkg/mui-pkg.min.js"/>
<srcfile/>
</apply>
</target>
<!--deploy to the remote server
<ftp server="ftp.yourserver.com" remotedir="/_demo"
userid="your_username"
password="your_password"
depends="yes"
verbose="yes"
binary="no"/>
-->
<!--native2ascii-->
<target name="native2ascii">
<native2ascii
encoding="${encoding}"
src="${src.dir}"
dest="${build.dir}"
includes="**/*-pkg-min.js"
>
<mapper type="regexp" from="^(.*)\.js$" to="\1-ascii.js"/>
</native2ascii>
</target>
<!--concat-->
<concat destfile="${build.dir}/pkg/ui-widgets-pkg.js" encoding="${encoding}" outputencoding="${encoding}"
overwrite="true">
<header filtering="no" trimleading="yes"></header>
<filelist dir="${src.dir}/js/"/>
<!--<path location="x"/>-->
<!--<path location="y"/>-->
<!--delete BOM characters-->
<filterchain>
<deletecharacters chars=""/>
</filterchain>
</concat>
<!--clean dir-->
<target name="clean" description="clean all temp directory">
<delete dir="${build.dir}"/>
</target>
<!--build all task-->
<target name="build" description="build all task">
</target>
<!-- import common build file
<import file="build.xml"/>
<subant target="所有的构建目标" inheritall="子构建同父构建属性独立">
<fileset dir="所有构建文件来源" includes="**/build.xml"/>
</subant>
-->
</project>