-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.xml
229 lines (190 loc) · 9.07 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="doAll" name="BreezeMap" xmlns:if="ant:if" xmlns:unless="ant:unless">
<!--
This is a general-purpose build file for the BreezeMap project.
It can pull down the latest version of OpenLayers from the OL
site and put it into place in the pilot project tree.
It can build the test projects for the developers of BreezeMap.
It can build a user's project based on the [TODO - complete this...]
Note: this uses additional jars in the same folder as the build file
to enable the use of JavaScript. You may need to call it thus:
ant -lib .
-->
<!-- Is this being called with the specific name of an XML file? -->
<property name="inputXml" value=""/>
<!-- Allow the user to override the number of points allowed in a timeline
if their project prefers more. -->
<property name="maxTimelinePoints" value="100"/>
<!-- We'll use the root directory of the ant file to do all our relative paths. -->
<dirname property="antfile.dir" file="${ant.file}"/>
<property name="proj.dir" value="${antfile.dir}"/>
<property name="abs.proj.dir" location="${proj.dir}"/>
<!-- Use the closure compiler in our utilities folder. -->
<property name="bmClosure" value="${proj.dir}/utilities/closure-compiler.jar"/>
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask" classpath="${bmClosure}"/>
<!-- Normally we suppress warnings, but we may turn them ("verbose") on for testing. -->
<property name="bmClosureWarning" value="quiet"/>
<!-- Normally we stick to simple optimizations, but the user may wish to override
in search of performance. WARNING: setting compilation level to ADVANCED seems
to break it completely. -->
<property name="bmClosureCompilationLevel" value="SIMPLE"/>
<!-- What output conformity we want for our JS. We're fairly forward-looking by default. -->
<property name="bmClosureOutputSpec" value="ECMASCRIPT_NEXT"/>
<condition property="buildingTestsOnly">
<equals arg1="" arg2="${inputXml}"/>
</condition>
<condition property="buildingUserFile">
<not>
<equals arg1="" arg2="${inputXml}"/>
</not>
</condition>
<property name="abs.inputXml" location="${inputXml}"/>
<basename property="userBaseName" file="${abs.inputXml}" suffix=".xml"/>
<property name="userHtmlLocation" value="${proj.dir}/${userBaseName}.html"/>
<condition property="needUserHtml">
<and>
<istrue value="${buildingUserFile}"/>
<not>
<available file="${userHtmlLocation}"/>
</not>
</and>
</condition>
<property name="echo.separator" value="************************************************"/>
<target name="cleanup">
<echo message="${echo.separator}"/>
<echo message="Deleting old stuff."/>
<delete file="${proj.dir}/js/ol_latest.txt"/>
<!-- Don't mess with OL for the moment. -->
<!--<delete dir="${proj.dir}/ol"/>
<mkdir dir="${proj.dir}/ol"/>-->
</target>
<target name="teiToGeoJSON">
<echo message="${echo.separator}"/>
<echo message="Converting TEI to GeoJSON."/>
<java classname="net.sf.saxon.Transform" classpath="${proj.dir}/utilities/saxon-he-10.jar" if:true="${buildingTestsOnly}" fork="true">
<arg value="-s:${proj.dir}/testdata/campus.xml"/>
<arg value="-xsl:${proj.dir}/xsl/tei_to_geojson3.xsl"/>
<arg line="projDir=${proj.dir}"/>
<arg line="maxTimelinePoints=${maxTimelinePoints}"/>
<arg value="--suppressXsltNamespaceCheck:on"/>
</java>
<java classname="net.sf.saxon.Transform" classpath="${proj.dir}/utilities/saxon-he-10.jar" if:true="${buildingTestsOnly}" fork="true">
<arg value="-s:${proj.dir}/testdata/world.xml"/>
<arg value="-xsl:${proj.dir}/xsl/tei_to_geojson3.xsl"/>
<arg line="projDir=${proj.dir}"/>
<arg line="maxTimelinePoints=${maxTimelinePoints}"/>
<arg value="--suppressXsltNamespaceCheck:on"/>
</java>
<java classname="net.sf.saxon.Transform" classpath="${proj.dir}/utilities/saxon-he-10.jar" if:true="${buildingTestsOnly}" fork="true">
<arg value="-s:${proj.dir}/testdata/imageMarkup.xml"/>
<arg value="-xsl:${proj.dir}/xsl/tei_to_geojson3.xsl"/>
<arg line="projDir=${proj.dir}"/>
<arg line="maxTimelinePoints=${maxTimelinePoints}"/>
<arg value="--suppressXsltNamespaceCheck:on"/>
</java>
<java classname="net.sf.saxon.Transform" classpath="${proj.dir}/utilities/saxon-he-10.jar" if:true="${buildingUserFile}" fork="true">
<arg value="-s:${abs.inputXml}"/>
<arg value="-xsl:${proj.dir}/xsl/tei_to_geojson3.xsl"/>
<arg line="projDir=${proj.dir}"/>
<arg line="maxTimelinePoints=${maxTimelinePoints}"/>
<arg value="--suppressXsltNamespaceCheck:on"/>
</java>
</target>
<!-- Note that this no longer works as it did, and it's recommended instead
to do a manual update of the ol.js, ol.js.map, and ol.css files from
the OL site, in a separate branch, before testing and merging back
into dev. -->
<target name="getOL" if:true="${buildingTestsOnly}">
<echo message="${echo.separator}"/>
<echo message="Downloading the latest stable release of OpenLayers."/>
<!-- First get the JSON file with the latest release data in it. -->
<get src="https://api.github.com/repos/openlayers/openlayers/releases/latest" verbose="on"
usetimestamp="true" dest="${proj.dir}/js/ol_latest.json"/>
<java classname="net.sf.saxon.Transform" classpath="${proj.dir}/utilities/saxon-he-10.jar" fork="true">
<arg value="-s:${proj.dir}/xsl/get_ol_version.xsl"/>
<arg value="-xsl:${proj.dir}/xsl/get_ol_version.xsl"/>
<arg line="projDir=${proj.dir}"/>
<arg value="--suppressXsltNamespaceCheck:on"/>
</java>
<loadfile property="olzip" srcFile="${proj.dir}/js/ol_latest.txt"/>
<echo message="Downloading zip file from ${olzip}..."/>
<get src="${olzip}" verbose="on" dest="${proj.dir}/ol/ol_latest.zip"/>
<echo message="Unzipping the files..."/>
<unzip src="${proj.dir}/ol/ol_latest.zip" dest="${proj.dir}/ol">
<patternset>
<include name="**/*.*"/>
</patternset>
<mapper type="flatten"/>
</unzip>
</target>
<!-- <target name="minify">-->
<!-- <echo message="${echo.separator}"/>-->
<!-- <echo message="Minifying our JavaScript."/>-->
<!-- <jscomp compilationLevel="${bmClosureCompilationLevel}" -->
<!-- warning="${bmClosureWarning}" -->
<!-- debug="false" languageOut="${bmClosureOutputSpec}" -->
<!-- output="${proj.dir}/js/hcmc_ol.min.js"-->
<!-- sourceMapFormat="V3"-->
<!-- sourceMapLocationMapping="${proj.dir}/js/hcmc_ol.js|hcmc_ol.js"-->
<!-- sourceMapOutputFile="${proj.dir}/js/hcmc_ol.js.map"-->
<!-- >-->
<!-- <sources dir="${proj.dir}/js">-->
<!-- <file name="out.js"/>-->
<!-- </sources>-->
<!-- </jscomp>-->
<!-- </target>-->
<target name="buildCss">
<echo message="${echo.separator}"/>
<echo message="Building SCSS source to create CSS file in css folder."/>
<exec executable="sass">
<arg value="${proj.dir}/css/hcmc_ol.scss"/>
<arg value="${proj.dir}/css/hcmc_ol.css"/>
<arg value="--source-map"/>
</exec>
</target>
<target name="createTestSite">
<echo message="${echo.separator}"/>
<echo message="Creating test site."/>
<mkdir dir="${proj.dir}/testsite"/>
<delete includeemptydirs="true">
<fileset dir="${proj.dir}/testsite">
<include name="*"/>
<include name="**/*"/>
</fileset>
</delete>
<mkdir dir="${proj.dir}/testsite/js"/>
<copy todir="${proj.dir}/testsite">
<fileset dir="${proj.dir}" includes="fonts/*.*"/>
<fileset dir="${proj.dir}" includes="css/*.css"/>
<fileset dir="${proj.dir}" includes="css/*.css.map"/>
<fileset dir="${proj.dir}" includes="ol/*.*" excludes="ol/ol_latest.zip"/>
<fileset dir="${proj.dir}" includes="*.html"/>
<fileset dir="${proj.dir}/testdata" includes="*/**"/>
<fileset dir="${proj.dir}" includes="images/**"/>
</copy>
<copy todir="${proj.dir}/testsite/js">
<fileset dir="${proj.dir}/js" includes="*.*" excludes="ol_latest.json"/>
</copy>
</target>
<target name="createUserHtml" if:true="${needUserHtml}">
<echo message="${echo.separator}" if:true="${needUserHtml}"/>
<echo message="Creating an HTML file for project ${inputXml}." if:true="${needUserHtml}"/>
<!-- We need a simple transform which can be passed the input XML file
to get some basic data from it, and then transform the template
appropriately. This transformation can be extended progressively
as we provide methods for encoding the initial configuration of
things like drawing tools in the XML file.
-->
</target>
<target name="doAll">
<antcall target="cleanup"/>
<antcall target="buildCss"/>
<antcall target="teiToGeoJSON"/>
<!--<antcall target="getOL"/>-->
<!-- <antcall target="minify"/>-->
<antcall target="createTestSite"/>
<antcall target="createUserHtml"/>
</target>
<target name="temp">
</target>
</project>