This repository has been archived by the owner on Jul 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
325 lines (291 loc) · 13.5 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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
<?xml version="1.0" encoding="utf-8"?>
<!--
~ The Antville Project
~ http://code.google.com/p/antville
~
~ Copyright 2001-2014 by the Workers of Antville.
~
~ Copyright 2001–2007 Robert Gaggl, Hannes Wallnöfer, Tobi Schäfer,
~ Matthias & Michael Platzer, Christoph Lincke.
~
~ Licensed 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="antville" default="usage" basedir=".">
<target name="help" depends="usage"/>
<target name="usage">
<echo message="Antville Build Instructions"/>
<echo message="==========================="/>
<echo message="Available targets are:"/>
<echo message=" all Generate the Antville and AntClick packages"/>
<echo message=" antclick Generate the AntClick packages"/>
<echo message=" antville Generate the Antville packages"/>
<echo message=" clean Clean up build directory"/>
<echo message=" client Build client-side scripts and styles"/>
<echo message=" docs Generate the API documentation"/>
<echo message=" messages Generate JavaScript message files"/>
<echo message=" patch Apply patch file to Antville installation"/>
<echo message=" pot Extract gettext call strings into POT file"/>
<echo message=" +patch Scaffolds a new patch, ready for implementation"/>
<echo message=" +trail Scaffolds a new trail, ready for implementation"/>
<echo message=" usage Show these build instructions (default)"/>
</target>
<target name="all" depends="antville, antclick"/>
<target name="init">
<tstamp>
<format property="date" pattern="d MMM yyyy" locale="en"/>
</tstamp>
<tstamp>
<format property="file-date" pattern="yyyyMMdd" locale="en"/>
</tstamp>
<property name="name" value="antville"/>
<property name="year" value="1998-${year}"/>
<property name="version" value="1.5"/>
<property name="package.name" value="${name}-${version}"/>
<property name="antville.src" value="https://code.google.com/p/antville"/>
<property name="helma.src" value="https://github.com/p3k/helma.git"/>
<property name="apps.src" value="https://github.com/p3k/helma-apps.git"/>
<property name="jala.src" value="https://github.com/p3k/helma-jala.git"/>
<property name="uikit.dir" location="./node_modules/uikit"/>
<property name="build.dir" location="${basedir}/build"/>
<property file="${build.dir}/build.properties"/>
<property name="helma.dir" location="/opt/helma"/>
<property name="extra.dir" location="${build.dir}/extra"/>
<property name="dist.dir" location="${build.dir}/dist"/>
<property name="work.dir" location="${build.dir}/work"/>
<property name="source.dir" location="${work.dir}/src"/>
<property name="export.dir" location="${work.dir}/export"/>
<property name="modules.dir" location="${export.dir}/helma/modules"/>
<property name="antville.dir" location="${export.dir}/antville"/>
<property name="hopkit.dir" location="${helma.dir}/modules/jala/util/HopKit"/>
<property name="trails.dir" location="${antville.dir}/trails"/>
<property name="docs.title" value="Antville&#32;${version}&#32;API&#32;Reference"/>
<property name="docs.infiles" location="${basedir}/code"/>
<property name="docs.outfiles" location="${basedir}/docs"/>
<property name="i18n.scan" value="code compat extra"/>
<property name="i18n.destination" location="${basedir}/i18n"/>
<property name="i18n.poDirectory" location="${i18n.destination}"/>
<property name="i18n.template" location="${i18n.destination}/antville.pot"/>
<property name="i18n.namespace" value=""/>
</target>
<target name="export" depends="init">
<mkdir dir="${source.dir}"/>
<exec dir="${source.dir}" executable="git">
<arg line="clone ${antville.src}"/>
</exec>
<exec dir="${source.dir}/antville" executable="git">
<arg line="checkout-index -f -a --prefix=${antville.dir}/"/>
</exec>
<delete includeemptydirs="true">
<fileset dir="${antville.dir}" includes="build.xml build/** docs/** i18n/*.po*"/>
</delete>
<exec dir="${source.dir}/antville" executable="git" outputproperty="hash">
<arg line="rev-parse --short HEAD"/>
</exec>
<replace file="${antville.dir}/code/Root/Root.js" value="${version}">
<replacetoken><![CDATA[<v>0</v>]]></replacetoken>
</replace>
<replace file="${antville.dir}/code/Root/Root.js" value="${hash}">
<replacetoken><![CDATA[<h>0</h>]]></replacetoken>
</replace>
<replace file="${antville.dir}/code/Root/Root.js" value="${date}">
<replacetoken><![CDATA[<d/>]]></replacetoken>
</replace>
</target>
<target name="ville" depends="antville"/>
<target name="click" depends="antclick"/>
<target name="antville" depends="export">
<antcall target="make-tar">
<param name="filename" value="${package.name}"/>
<param name="path" value="${antville.dir}"/>
</antcall>
<antcall target="make-zip">
<param name="filename" value="${package.name}"/>
<param name="path" value="${antville.dir}"/>
</antcall>
</target>
<target name="antclick" depends="export">
<!-- Export the Helma and Jala repositories to a temporary directory -->
<exec dir="${source.dir}" executable="git">
<arg line="clone ${helma.src}"/>
</exec>
<exec dir="${source.dir}" executable="git">
<arg line="clone ${jala.src}"/>
</exec>
<!-- Checkout each repostory index to the export directory -->
<mkdir dir="${export.dir}"/>
<exec dir="${source.dir}/helma" executable="git">
<arg line="checkout-index -f -a --prefix=${export.dir}/helma/"/>
</exec>
<exec dir="${source.dir}/helma-jala" executable="git">
<arg line="checkout-index -f -a --prefix=${export.dir}/helma/modules/jala/"/>
</exec>
<!-- Copy exported files to final destinations -->
<copy todir="${work.dir}">
<fileset dir="${export.dir}/helma" includes="lib/** licenses/**"/>
</copy>
<copy todir="${work.dir}/apps/antville">
<fileset dir="${antville.dir}"/>
</copy>
<copy todir="${work.dir}/modules">
<fileset dir="${modules.dir}" includes="core/** helma/** jala/**"/>
</copy>
<!-- Copy extra files to final destinations -->
<copy file="${export.dir}/helma/license.txt" tofile="${work.dir}/licenses/helma.txt"/>
<copy todir="${work.dir}">
<fileset dir="${extra.dir}" includes="start.bat apps.properties server.properties launcher.jar"/>
</copy>
<exec dir="${extra.dir}" executable="cp">
<arg line="-p start.sh ${work.dir}"/>
</exec>
<copy file="${extra.dir}/helma.jar" todir="${work.dir}/lib"/>
<copy file="${extra.dir}/h2-1.3.155.jar" todir="${work.dir}/lib/ext"/>
<copy file="${extra.dir}/h2.txt" todir="${work.dir}/licenses"/>
<copy todir="${build.dir}/work/db">
<fileset dir="${extra.dir}" includes="antville.h2.db"/>
</copy>
<copy todir="${work.dir}/licenses">
<fileset dir="${antville.dir}/legal" includes="**"/>
</copy>
<copy file="${modules.dir}/jala/licenses/jala.txt" todir="${work.dir}/licenses"/>
<!-- Delete unnecessary files -->
<delete>
<fileset dir="${work.dir}/modules/helma" includes="*.jar Search.js Ssh.js Chart.js"/>
</delete>
<delete includeemptydirs="true">
<fileset dir="${work.dir}/modules/jala" includes="build.properties docs/** lib/** licenses/** tests/** util/**"/>
</delete>
<delete dir="${work.dir}/apps/antville/legal"/>
<delete dir="${source.dir}"/>
<delete dir="${export.dir}"/>
<!-- Create the packages -->
<antcall target="make-zip">
<param name="filename" value="antclick-${version}"/>
<param name="path" value="${work.dir}"/>
</antcall>
<antcall target="make-tar">
<param name="filename" value="antclick-${version}"/>
<param name="path" value="${work.dir}"/>
</antcall>
</target>
<target name="client" depends="init">
<copy todir="static/fonts">
<fileset dir="node_modules/uikit-bower/fonts" includes="**"/>
</copy>
<mkdir dir="static/scripts"/>
<exec executable="node_modules/.bin/browserify" output="static/scripts/main.min.js">
<arg line="build/client/main.js -d -p [minifyify --map main.min.map.json --output static/scripts/main.min.map.json]"/>
</exec>
<exec executable="node_modules/.bin/browserify" output="static/scripts/cm.min.js">
<arg line="build/client/cm.js -d -p [minifyify --map cm.min.map.json --output static/scripts/cm.min.map.json]"/>
</exec>
<mkdir dir="static/styles"/>
<exec executable="node_modules/.bin/lessc" output="static/styles/main.min.css">
<arg line="-x build/client/main.less"/>
</exec>
</target>
<target name="docs" depends="init">
<exec dir="${build.dir}/jsdoc/toolkit" executable="${build.dir}/jsdoc/jsrunwrapper.sh">
<arg line='-D="title:${docs.title}" -q -r=2 -p -t=../templates/codeview
-d=${docs.outfiles} ${docs.infiles}'/>
</exec>
</target>
<target name="pot" depends="init">
<java dir="${helma.dir}" classpath="${helma.dir}/launcher.jar" classname="helma.main.launcher.Commandline"
fork="true">
<!-- Root.extractMessages is currently located in Global/i18n.js -->
<arg value="antville.extractMessages"/>
<arg value="${build.dir}/MessageParser.js"/>
<arg value="${i18n.scan}"/>
<arg value="${i18n.template}"/>
</java>
</target>
<target name="messages" depends="init">
<java dir="${helma.dir}" classpath="${helma.dir}/lib/rhino.jar"
classname="org.mozilla.javascript.tools.shell.Main">
<arg value="${build.dir}/PoParser.js"/>
<arg value="${i18n.poDirectory}"/>
<arg value="${i18n.destination}"/>
<arg value="${i18n.namespace}"/>
</java>
</target>
<target name="make-tar" depends="init">
<mkdir dir="${dist.dir}"/>
<fixcrlf srcdir="${path}" eol="lf" eof="remove" includes="**/*.txt,
**/*.properties, **/*.hac, **/*.js, **/*.skin, **/.xml, **/.sh"/>
<tar tarfile="${dist.dir}/${filename}.tar" basedir="${path}" excludes="**">
<tarfileset prefix="${filename}" dir="${path}" mode="755">
<include name="**/*.sh"/>
</tarfileset>
<tarfileset prefix="${filename}" dir="${path}">
<include name="**"/>
<exclude name="**/*.sh"/>
</tarfileset>
</tar>
<bzip2 zipfile="${dist.dir}/${filename}.tbz" src="${dist.dir}/${filename}.tar"/>
<delete file="${dist.dir}/${filename}.tar"/>
</target>
<target name="make-zip" depends="init">
<mkdir dir="${dist.dir}"/>
<fixcrlf srcdir="${path}" eol="crlf" includes="**/*.txt, **/*.properties, **/*.hac, **/*.js, **/*.skin, **/*.xml, **/.bat"/>
<zip zipfile="${dist.dir}/${filename}.zip">
<zipfileset dir="${path}" prefix="${filename}" includes="**"/>
</zip>
</target>
<target name="patch" depends="init">
<input message="Please enter the patch ID: " addproperty="patch.id"/>
<loadfile property="patch" srcFile="${basedir}/extra/updater/patch-${patch.id}.js"/>
<echo message="${patch}"/>
<input message="Apply the displayed patch? " validargs="y,n" addproperty="patch.confirm"/>
<condition property="patch.abort">
<equals arg1="${patch.confirm}" arg2="n" casesensitive="false" trim="true"/>
</condition>
<fail if="patch.abort">Build aborted by user.</fail>
<java dir="${helma.dir}" classpath="${helma.dir}/launcher.jar" classname="helma.main.launcher.Commandline" fork="true">
<arg value="antville.patch"/>
<arg value="${patch}"/>
</java>
</target>
<target name="+patch" depends="init">
<property name="patch.dir" value="extra/updater"/>
<echo file="${patch.dir}/patch-${file-date}.js">// Apply with enabled updater repository using `ant patch -Dpatch.id=${file-date}`${line.separator}<!--
-->var sql = new Sql();
</echo>
</target>
<target name="+trail" depends="init">
<property name="trail.dir" value="trails/${trail.name}/${trail.title}"/>
<input message="Please enter the name of the trail: " addproperty="trail.name"/>
<script language="javascript"><![CDATA[
name = project.getProperty('trail.name');
firstLetter = name.substr(0, 1).toUpperCase();
title = firstLetter + name.substr(1);
project.setProperty('trail.title', title);
]]></script>
<mkdir dir="${trail.dir}"/>
<echo file="${trail.dir}/${trail.title}.properties" append="true">#sites = collection(Site)</echo>
<echo file="${trail.dir}/${trail.title}.js" append="true">${trail.title}.prototype.main_action = function () {${line.separator}<!--
--> //res.debug(this.sites.count());${line.separator}<!--
-->};${line.separator}</echo>
<mkdir dir="${trail.dir}/../Trails"/>
<echo file="${trail.dir}/../Trails/Trails.properties" append="true">${trail.name} = mountpoint(${trail.title})${line.separator}</echo>
</target>
<target name="clean" depends="init">
<delete dir="${work.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="file-exists" unless="file.exists">
<available property="file.exists" file="${file}"/>
</target>
<target name="debug" depends="init">
<!-- For debugging and testing purposes -->
</target>
</project>