forked from mapstraction/mxn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
96 lines (83 loc) · 2.75 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
<?xml version="1.0"?>
<project name="mapstraction" default="build">
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="tools/ant-contrib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<!-- set global properties for this build -->
<property name="source" location="source"/>
<property name="build.base" location="build"/>
<property name="build.major" value="2"/>
<property name="build.minor" value="0"/>
<target name="build">
<!-- generate build number -->
<buildnumber/>
<tstamp>
<format property="YEAR" pattern="yyyy"/>
</tstamp>
<property name="build.ver" value="${build.major}.${build.minor}.${build.number}"/>
<property name="build.dir" location="${build.base}/${build.ver}"/>
<!-- make our build directory -->
<mkdir dir="${build.dir}"/>
<!-- copy our sources in -->
<echo>--- COPY SOURCES ---</echo>
<copy todir="${build.dir}">
<fileset dir="${source}">
<exclude name="*(provider)*"/>
</fileset>
</copy>
<!-- lint our sources -->
<echo>--- LINT ---</echo>
<for param="file">
<path>
<fileset dir="${build.dir}" includes="*.js"/>
</path>
<sequential>
<java jar="tools/rhino/js.jar" fork="true" failonerror="true">
<arg value="tools/jslint/jslint.js"/>
<arg value="@{file}"/>
</java>
</sequential>
</for>
<!-- document our sources -->
<echo>--- DOC ---</echo>
<java jar="tools/jsdoc-toolkit/jsrun.jar" fork="true" failonerror="true">
<arg value="tools/jsdoc-toolkit/app/run.js"/>
<arg value="${build.dir}/mxn.js"/>
<arg value="${build.dir}/mxn.core.js"/>
<arg value="${build.dir}/mxn.geocoder.js"/>
<arg value="-c=tools/jsdoc-toolkit/mxn.conf"/>
<arg value="-d=${build.dir}/docs"/>
</java>
<!-- minify our sources -->
<echo>--- MIN ---</echo>
<for param="file">
<path>
<fileset dir="${build.dir}" includes="*.js"/>
</path>
<sequential>
<propertyregex override="yes" property="minfile" input="@{file}" regexp=".*[\/\\]([a-z0-9\.]+)\.js" replace="\1-min.js"/>
<java jar="tools/yui-compressor/yuicompressor-2.4.2.jar" args="-o ${build.dir}/${minfile} @{file}" fork="true" failonerror="true"/>
</sequential>
</for>
<!-- prepend our copyright and license notice -->
<echo>--- COPYRIGHT ---</echo>
<for param="file">
<path>
<fileset dir="${build.dir}" includes="*.js"/>
</path>
<sequential>
<concat destfile="${build.dir}/temp.t">
<header file="license.js"/>
<fileset file="@{file}"/>
<filterchain>
<expandproperties/>
</filterchain>
</concat>
<move file="${build.dir}/temp.t" tofile="@{file}" overwrite="true"/>
</sequential>
</for>
<zip destfile="${build.base}/mxn-${build.ver}.zip" basedir="${build.dir}"/>
</target>
</project>