forked from jquerytools/jquerytools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
113 lines (83 loc) · 2.71 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
<project name="jQuery.Tools" default="min">
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<property name="version" value="1.2.5"/>
<property name="build" value="build/${version}"/>
<property name="file" value="none"/>
<!-- replace @VERSION and @DATE tags -->
<target name="sources">
<!-- copy sources to build directory -->
<mkdir dir="${build}"/>
<copy todir="${build}">
<fileset dir="src"/>
</copy>
<!-- jQuery library -->
<copy todir="${build}">
<fileset dir="lib" includes="*.js"/>
</copy>
<!-- loop trough them -->
<for param="file">
<path>
<fileset dir="${build}" includes="*/*.js" excludes="*/*.min.js"/>
</path>
<sequential>
<!-- version number -->
<replaceregexp match="@VERSION" replace="${version}" byline="true" file="@{file}" />
<!-- last modified (via <git log> command) -->
<propertyregex property="source" input="@{file}" override="yes" replace="\1"
regexp=".+/\d.\d.\d/(.*)\.js"/>
<exec executable="git" outputproperty="git.log" >
<arg line="log -1 src/${source}.js"/>
</exec>
<propertyregex property="date" input="${git.log}" select="\1">
<regexp pattern="Date:(.+)"/>
</propertyregex>
<replaceregexp match="@DATE" replace="${date}" file="@{file}" />
</sequential>
</for>
</target>
<!-- minify with Closure Compiler (default mode) -->
<target name="min" depends="sources">
<!-- do the hard work -->
<apply
executable="java"
parallel="false"
verbose="true"
dest="${build}">
<fileset dir="${build}" includes="*/*.js" excludes="*/*.min.js"/>
<arg line="-jar"/>
<arg path="lib/compiler.jar"/>
<arg line="--js"/>
<srcfile/>
<arg line="--js_output_file"/>
<mapper type="glob" from="*.js" to="*.min.js"/>
<targetfile/>
</apply>
</target>
<!-- lint (http://www.jslint.com/lint.html) -->
<target name="lint">
<if>
<equals arg1="${file}" arg2="none" />
<!-- loop trough all files -->
<then>
<for param="file">
<path>
<fileset dir="src" includes="**/*.js"/>
</path>
<sequential>
<java jar="lib/rhino.jar" fork="true">
<arg value="lib/jslint.js" />
<arg value="@{file}" />
</java>
</sequential>
</for>
</then>
<!-- ant lint -Dfile=validator/validator.js -->
<else>
<java jar="lib/rhino.jar" fork="true">
<arg value="lib/jslint.js" />
<arg value="src/${file}" />
</java>
</else>
</if>
</target>
</project>