-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
168 lines (149 loc) · 5.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
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
<?xml version="1.0"?>
<!-- Apache Ant build. If Ant is installed, running 'ant' in this directory should execute the build. -->
<!-- What does it do? Runs jslint on javascript, compresses javascript and CSS, and makes a ZIP archive ready to install in WordPress. -->
<!-- Source can be installed 'raw', not from a build archive, and should work using uncompressed resources. -->
<project name="geo-mashup" 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="."/>
<property name="build.base" location="build"/>
<exec executable="bash" outputproperty="version">
<arg value="-c"/>
<arg value="grep 'Version:' geo-mashup.php | sed -E 's/^.*Version: (.*)$/\1/'"/>
</exec>
<target name="test">
<exec executable="phpunit" failonerror="true" />
</target>
<target name="build" depends="test">
<!-- generate build number -->
<buildnumber/>
<tstamp>
<format property="YEAR" pattern="yyyy"/>
</tstamp>
<property name="build.ver" value="${version}.${build.number}"/>
<property name="build.ver.dir" location="${build.base}/${build.ver}"/>
<property name="build.dir" location="${build.ver.dir}"/>
<!-- make our build directory -->
<mkdir dir="${build.dir}"/>
<!-- copy our sources in -->
<echo>--- COPY SOURCES ---</echo>
<copy todir="${build.dir}">
<fileset dir="${source}">
<include name="**"/>
<exclude name="release-checklist.txt"/>
<exclude name="build/**"/>
<exclude name="build.*"/>
<exclude name="tools/**"/>
<exclude name="tests/**"/>
</fileset>
</copy>
<!-- lint our javascripts -->
<echo>--- LINT ---</echo>
<for param="file">
<path>
<fileset dir="${build.dir}/js" includes="**/*.js">
<exclude name="*datepicker.js"/>
<exclude name="*markerclusterer.js"/>
<exclude name="*ClusterMarker.js"/>
<exclude name="*mapiconmaker.js"/>
<exclude name="*qunit.js"/>
<exclude name="*qunit-close-enough.js"/>
<exclude name="*modernizr.js"/>
<exclude name="mxn/*"/>
<exclude name="leaflet/*"/>
</fileset>
</path>
<sequential>
<echo>Linting @{file}</echo>
<java jar="tools/jslint/jslint4java-2.0.1.jar" fork="true" failonerror="true">
<arg value="--white"/>
<arg value="--sloppy"/>
<arg value="--vars"/>
<arg value="@{file}"/>
</java>
</sequential>
</for>
<echo>--- POT ---</echo>
<exec executable="php">
<arg line="tools/wp-i18n-tools/makepot.php wp-plugin ${build.dir} ${build.dir}/lang/geo-mashup.pot geo-mashup"/>
</exec>
<!-- minify our sources -->
<echo>--- MIN ---</echo>
<for param="file">
<path>
<fileset dir="${build.dir}/js" includes="**/*.js"/>
</path>
<sequential>
<propertyregex override="yes" property="minfile" input="@{file}" regexp="(.*)\.js" replace="\1.min.js"/>
<java jar="tools/yui-compressor/yuicompressor-2.4.2.jar" fork="true" failonerror="true">
<arg value="-o"/>
<arg value="${minfile}"/>
<arg value="@{file}"/>
</java>
</sequential>
</for>
<for param="file">
<path>
<fileset dir="${build.dir}/css" includes="**/*.css"/>
</path>
<sequential>
<propertyregex override="yes" property="minfile" input="@{file}" regexp="(.*)\.css" replace="\1.min.css"/>
<java jar="tools/yui-compressor/yuicompressor-2.4.2.jar" fork="true" failonerror="true">
<arg value="-o"/>
<arg value="${minfile}"/>
<arg value="@{file}"/>
</java>
</sequential>
</for>
<echo>--- MXN LICENSE ---</echo>
<for param="file">
<path>
<fileset dir="${build.dir}/js/mxn" includes="*.js">
<exclude name="*.js"/>
<exclude name="license.js"/>
</fileset>
</path>
<sequential>
<concat destfile="${build.dir}/js/mxn/temp.t">
<header file="${build.dir}/js/mxn/license.js"/>
<fileset file="@{file}"/>
<filterchain>
<expandproperties/>
</filterchain>
</concat>
<move file="${build.dir}/js/mxn/temp.t" tofile="@{file}" overwrite="true"/>
</sequential>
</for>
<zip destfile="${build.base}/geo-mashup-${build.ver}.zip">
<zipfileset dir="${build.ver.dir}" prefix="geo-mashup"/>
</zip>
</target>
<target name="jsdoc">
<!-- document our sources -->
<echo>--- JSDOC ---</echo>
<property name="docs.dir" location="${build.base}/jsdocs-${version}"/>
<java jar="tools/jsdoc-toolkit/jsrun.jar" fork="true" failonerror="true">
<arg value="tools/jsdoc-toolkit/app/run.js"/>
<arg value="${source}/js/geo-mashup.js"/>
<arg value="${source}/js/geo-mashup-google.js"/>
<arg value="${source}/js/geo-mashup-mxn.js"/>
<arg value="${source}/js/geo-mashup-markerclusterer.js"/>
<arg value="${source}/js/taxonomy.js"/>
<arg value="${source}/js/location-editor.js"/>
<arg value="-t=tools/jsdoc-toolkit/templates/jsdoc"/>
<arg value="-d=${docs.dir}"/>
</java>
</target>
<target name="phpdoc">
<!-- document our sources -->
<echo>--- PHPDOC ---</echo>
<property name="docs.dir" location="${build.base}/phpdocs-${version}"/>
<exec executable="phpdoc">
<arg line='-d ${source} -i "tests/*,tools/*,build/*" -t ${docs.dir}'/>
</exec>
</target>
</project>