This repository has been archived by the owner on May 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build-javascript.xml
144 lines (127 loc) · 6.57 KB
/
build-javascript.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
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="Compress JavaScript" default="compress" basedir=".">
<!-- ============================================================================ -->
<!--
This ant file creates compressed versions of Validator's JavaScript
files using the Dojo compressor.
See http://dojotoolkit.org/docs/compressor_system.html for further information.
$Id: build-javascript.xml 1229415 2012-01-09 23:11:33Z sebb $
-->
<!-- ============================================================================ -->
<property file="build-javascript.properties"/>
<property name="build.dir" value="target"/>
<property name="dist.dir" value="${build.dir}"/>
<property name="output.dir" value="${build.dir}/classes"/>
<property name="source.dir" value="src/javascript"/>
<property name="javascript.input" value="${source.dir}/org/apache/commons/validator/javascript"/>
<property name="javascript.output" value="${output.dir}/org/apache/commons/validator/javascript"/>
<property name="compressor.lib" value="lib"/>
<property name="customrhino.version" value="0.4.3"/>
<property name="download.location" value="http://repo1.maven.org/maven2/org/dojotoolkit/custom_rhino/${customrhino.version}"/>
<property name="download.jar" value="custom_rhino-${customrhino.version}.jar"/>
<property name="final.name" value="commons-validator"/>
<!-- ======================================================================== -->
<!-- Get the JavaScript Compressor -->
<!-- ======================================================================== -->
<target name="compress">
<available file="${compressor.jar}" property="compressor.found"/>
<antcall target="compressor-specified" />
<antcall target="download-compressor-check" />
</target>
<target name="compressor-specified" if="compressor.found">
<antcall target="compress-files" />
</target>
<!-- Download the Compressor jar (unless its already been done) -->
<target name="download-compressor-check" unless="compressor.found">
<mkdir dir="${compressor.lib}" />
<property name="compressor.jar" value="${compressor.lib}/${download.jar}"/>
<available file="${compressor.jar}" property="download.done"/>
<antcall target="download-compressor" />
<antcall target="compress-files" />
</target>
<!-- Download the Compressor jar -->
<target name="download-compressor" unless="download.done">
<echo message="Downloading JavaScript Compressor...."/>
<get dest="${compressor.jar}"
usetimestamp="true" ignoreerrors="true"
src="${download.location}/${download.jar}"/>
</target>
<!-- ======================================================================== -->
<!-- Compress Files -->
<!-- ======================================================================== -->
<target name="compress-files">
<echo message="Compressing JavaScript files using ${compressor.jar}"/>
<mkdir dir="${dist.dir}" />
<mkdir dir="${javascript.output}" />
<concat destfile="${dist.dir}/${final.name}.js">
<fileset dir="${javascript.input}" includes="*.js"/>
</concat>
<echo message="Compressing ${final.name}.js"/>
<java jar="${compressor.jar}" fork="true" output="${dist.dir}/${final.name}-compress.js">
<arg value="-c"/>
<arg value="${dist.dir}/${final.name}.js"/>
</java>
<antcall target="compress-file">
<param name="jsfilename" value="validateByte"/>
</antcall>
<antcall target="compress-file">
<param name="jsfilename" value="validateCreditCard"/>
</antcall>
<antcall target="compress-file">
<param name="jsfilename" value="validateDate"/>
</antcall>
<antcall target="compress-file">
<param name="jsfilename" value="validateEmail"/>
</antcall>
<antcall target="compress-file">
<param name="jsfilename" value="validateFloat"/>
</antcall>
<antcall target="compress-file">
<param name="jsfilename" value="validateFloatRange"/>
</antcall>
<antcall target="compress-file">
<param name="jsfilename" value="validateInteger"/>
</antcall>
<antcall target="compress-file">
<param name="jsfilename" value="validateIntRange"/>
</antcall>
<antcall target="compress-file">
<param name="jsfilename" value="validateMask"/>
</antcall>
<antcall target="compress-file">
<param name="jsfilename" value="validateMaxLength"/>
</antcall>
<antcall target="compress-file">
<param name="jsfilename" value="validateMinLength"/>
</antcall>
<antcall target="compress-file">
<param name="jsfilename" value="validateRequired"/>
</antcall>
<antcall target="compress-file">
<param name="jsfilename" value="validateShort"/>
</antcall>
<antcall target="compress-file">
<param name="jsfilename" value="validateUtilities"/>
</antcall>
</target>
<target name="compress-file">
<echo message="Compressing ${jsfilename}.js"/>
<java jar="${compressor.jar}" fork="true" output="${javascript.output}/${jsfilename}-compress.js">
<arg value="-c"/>
<arg value="${javascript.input}/${jsfilename}.js"/>
</java>
</target>
</project>