forked from jquery-validation/jquery-validation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·98 lines (83 loc) · 3.24 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
<?xml version="1.0" encoding="iso-8859-1"?>
<project name="jquery-validation" default="release" basedir=".">
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="build/ant-contrib-0.6.jar"/>
</classpath>
</taskdef>
<property file="ant.properties" />
<loadfile failonerror="no" srcFile="version.txt" property="release.version">
<filterchain><striplinebreaks/></filterchain>
</loadfile>
<property name="release.filename" value="jquery-validation-${release.version}" />
<property name="dist.dir" value="dist/${release.filename}/" />
<property description="Google Closure" name="closure-jar" value="build/google-compiler-20110320.jar" />
<target name="release" depends="clean, copy, minify, replace-version, prepend-header, zip" description="Release builder">
</target>
<target name="replace-version">
<replaceregexp match="@VERSION" replace="${release.version}" flags="g" byline="true">
<fileset dir="${dist.dir}/" includes="*.js"/>
</replaceregexp>
<echo message="Replaced all @VERSION to ${release.version}." />
</target>
<target name="prepend-header">
<copy todir="${dist.dir}/headers/">
<fileset dir="${dist.dir}/" includes="*.js" excludes="*.min.js" />
</copy>
<replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s">
<fileset dir="${dist.dir}/headers/" includes="*.js"/>
</replaceregexp>
<for param="file">
<path><fileset dir="${dist.dir}/" includes="*.min.js" /></path>
<sequential>
<propertyregex override="yes" property="target" input="@{file}" regexp=".*[\\/](.+)\.min\.js$" replace="\1"/>
<concat destfile="${dist.dir}/headered/${target}.min.js">
<header file="${dist.dir}/headers/${target}.js" />
<fileset file="@{file}" />
</concat>
</sequential>
</for>
<copy todir="${dist.dir}" overwrite="true">
<fileset dir="${dist.dir}/headered/" includes="*.js" />
</copy>
<delete dir="${dist.dir}/headers/" />
<delete dir="${dist.dir}/headered/" />
</target>
<target description="Zip the package" name="zip">
<zip destfile="${dist.dir}/../${release.filename}.zip">
<zipfileset dir="dist/" />
</zip>
</target>
<target name="minify">
<echo message="Building minified" />
<apply executable="java" parallel="false">
<fileset dir="${dist.dir}" includes="*.js" />
<arg line="-jar" />
<arg path="${closure-jar}" />
<arg value="--warning_level" />
<arg value="QUIET" />
<arg value="--js_output_file" />
<targetfile />
<arg value="--js" />
<mapper type="glob" from="*.js" to="${dist.dir}/*.min.js" />
</apply>
</target>
<target description="Copy needed folders" name="copy">
<echo message="Copying files" />
<mkdir dir="${dist.dir}" />
<copy overwrite="true" todir="${dist.dir}/">
<fileset dir="." excludes="**/.*, .*/, dist/, build/, build.xml" />
</copy>
</target>
<target name="clean">
<delete dir="${dist.dir}" />
<delete file="${dist.dir}/../${release.filename}.zip" />
</target>
<target name="whitespace">
<replaceregexp match="[\t ]+$" replace="" flags="g" byline="true">
<fileset dir="${src.dir}" includes="*.js"/>
<fileset dir="${src.dir}/i18n/" includes="*.js"/>
</replaceregexp>
<echo message="All trailing spaces removed." />
</target>
</project>