Menu

[642ad0]: / docs / build.xml  Maximize  Restore  History

Download this file

472 lines (403 with data), 18.8 kB

  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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
<!-- DrJava Documentation Build Script -->
<!-- This build script is based on the template located at "trunk/misc/build-template.xml"
in the DrJava Subversion repository. In general, changes made to the script should be
reflected in the template as well. -->
<project name="docs" default="help">
<property name="readable-project-name" value="DrJava Documentation" />
<property name="svn-repository" value="https://svn.sourceforge.net/svnroot/drjava" />
<property environment="env" />
<property name="docbook-xsl-home" value="${env.DOCBOOK_XSL_HOME}" />
<!-- By default, clean can fail -->
<property name="clean-can-fail" value="yes" />
<!-- By default, don't append anything extra to the tag -->
<property name="tag-append" value="" />
<!-- Don't use or inherit the CLASSPATH environment variable for anything -->
<property name="build.sysclasspath" value="ignore" />
<fileset id="libs" dir="lib" includes="*.jar" /> <!-- Only include jars that are at the top level (not in buildlib) -->
<!-- ***********
Help Target
*********** -->
<target name="help" description="Print general build script information">
<echo message="--------------------------------------------------------------------" />
<echo message="${readable-project-name} Build Scripts" />
<echo message="--------------------------------------------------------------------" />
<echo message="Type 'ant -projecthelp' or 'ant -p' to see the list of targets." />
<echo message="" />
<echo message="For this build file to function properly, the following environment " />
<echo message="variables should be defined:" />
<echo message="DOCBOOK_XSL_HOME: Location of the DocBook XSL style sheets" />
<echo message="PATH: 'xsltproc' must be available; 'svn' needs to refer to the" />
<echo message=" Subversion client executable" />
<echo message="" />
<echo message="Ant may also require ANT_HOME to be set. Note that the value of " />
<echo message="CLASSPATH will be ignored -- classes on the system classpath will " />
<echo message="not be visible during the build process." />
</target>
<!-- ************
Build Target
************ -->
<target name="build" depends="doc-html, jar"
description="Shortcut for 'doc-html' and 'jar'">
</target>
<!-- ***********
Jar Targets
*********** -->
<target name="jar" depends="doc-html, resolve-version-tag"
description="Create the jar file with distributed docs (generating html docs first)">
<jar jarfile="${ant.project.name}.jar">
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Build-Version" value="${version-tag}" />
</manifest>
<zipfileset dir="docs" prefix="edu/rice/cs/drjava/docs" includes="user/**" />
<zipfileset dir="docs" prefix="edu/rice/cs/drjava/docs" includes="quickstart/**" />
<zipfileset dir="docs" prefix="edu/rice/cs/drjava/docs" includes="javaapi/**" />
</jar>
</target>
<!-- *********************
Documentation Targets
********************* -->
<target name="doc" depends="doc-html, doc-pdf" description="Shortcut for 'doc-html' and 'doc-pdf'">
</target>
<target name="doc-html" description="Generate all html documentation">
<echo message="Creating html documentation" />
<antcall target="generate-html">
<param name="docbook-dir" value="user" />
<param name="docbook-srcfile" value="userdoc" />
</antcall>
<antcall target="generate-html">
<param name="docbook-dir" value="quickstart" />
<param name="docbook-srcfile" value="quickstart" />
</antcall>
<antcall target="generate-html">
<param name="docbook-dir" value="developer" />
<param name="docbook-srcfile" value="devdoc" />
</antcall>
<antcall target="copy-resources" />
</target>
<target name="doc-pdf" description="Generate all pdf documentation">
<echo message="Creating pdf documentation" />
<antcall target="generate-pdf">
<param name="docbook-dir" value="user" />
<param name="docbook-srcfile" value="userdoc" />
</antcall>
<antcall target="generate-pdf">
<param name="docbook-dir" value="quickstart" />
<param name="docbook-srcfile" value="quickstart" />
</antcall>
<antcall target="generate-pdf">
<param name="docbook-dir" value="developer" />
<param name="docbook-srcfile" value="devdoc" />
</antcall>
</target>
<target name="doc-user" description="Generate user documentation (html and pdf)">
<echo message="Creating user documentation" />
<antcall target="generate-html">
<param name="docbook-dir" value="user" />
<param name="docbook-srcfile" value="userdoc" />
</antcall>
<antcall target="generate-pdf">
<param name="docbook-dir" value="user" />
<param name="docbook-srcfile" value="userdoc" />
</antcall>
<antcall target="copy-resources" />
</target>
<target name="doc-quickstart" description="Generate quickstart documentation (html and pdf)">
<echo message="Creating user documentation" />
<antcall target="generate-html">
<param name="docbook-dir" value="quickstart" />
<param name="docbook-srcfile" value="quickstart" />
</antcall>
<antcall target="generate-pdf">
<param name="docbook-dir" value="quickstart" />
<param name="docbook-srcfile" value="quickstart" />
</antcall>
<antcall target="copy-resources" />
</target>
<target name="doc-developer" description="Generate developer documentation (html and pdf)">
<echo message="Creating user documentation" />
<antcall target="generate-html">
<param name="docbook-dir" value="developer" />
<param name="docbook-srcfile" value="devdoc" />
</antcall>
<antcall target="generate-pdf">
<param name="docbook-dir" value="developer" />
<param name="docbook-srcfile" value="devdoc" />
</antcall>
<antcall target="copy-resources" />
</target>
<target name="generate-html" depends="assert-docbook-xsl-exists">
<mkdir dir="docs/${docbook-dir}" />
<exec executable="xsltproc" failonerror="yes" dir="src/${docbook-dir}">
<arg value="--stringparam" />
<!-- ignore image scaling in HTML to avoid bug
[ drjava-Bugs-2892129 ] Squished Images in Included Documentation
according to
http://www.sagehill.net/docbookxsl/ImageSizing.html#DiffImageSizes
and
http://www.sagehill.net/docbookxsl/Parameters.html#ParameterSyntax -->
<arg value="ignore.image.scaling" />
<arg value="1" />
<arg value="-o" />
<arg value="../../docs/${docbook-dir}/" />
<arg file="${docbook-xsl-home}/html/chunk.xsl" />
<arg file="src/${docbook-dir}/${docbook-srcfile}.docbook" />
</exec>
<!-- This should work and be platform-independent, but I can't get it to generate good output:
the built-in Java API version fails; xalan works but the index.html page is blank (no TOC)
<xslt style="${docbook-xsl-home}/html/chunk.xsl"
destdir="docs/${docbook-dir}" basedir="src/${docbook-dir}" includes="${docbook-srcfile}" />
-->
</target>
<target name="generate-pdf" depends="assert-docbook-xsl-exists">
<taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop">
<classpath>
<fileset dir="lib/buildlib">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>
<mkdir dir="fo" />
<mkdir dir="docs" />
<exec executable="xsltproc" failonerror="yes" dir="src/${docbook-dir}">
<arg value="-o" />
<arg value="../../fo/${docbook-srcfile}.fo" />
<arg file="${docbook-xsl-home}/fo/docbook.xsl" />
<arg file="src/${docbook-dir}/${docbook-srcfile}.docbook" />
</exec>
<fop fofile="fo/${docbook-srcfile}.fo" outfile="docs/${docbook-srcfile}.pdf"
basedir="src/${docbook-dir}" />
</target>
<target name="copy-resources">
<copy todir="docs">
<fileset dir="src">
<include name="**/LICENSE" />
<include name="**/README" />
<include name="**/*.gif" />
<include name="**/*.png" />
<include name="**/*.jpg" />
<include name="**/*.jpeg" />
<include name="**/*.properties" />
<include name="**/*.html" />
<!-- Additional resource files should be listed here -->
</fileset>
</copy>
</target>
<!-- *************
Clean Targets
************* -->
<target name="clean" depends="clean-intermediate, clean-products"
description="Remove all build products; the result should match the intended Subversion contents">
</target>
<target name="clean-intermediate" unless="skip-clean">
<echo message="Deleting all intermediate build products" />
<delete dir="fo" failonerror="${clean-can-fail}" />
<delete includeemptydirs="true" failonerror="${clean-can-fail}">
<fileset dir="${basedir}" defaultexcludes="no">
<!-- We could get rid of backups, but "update" ignores them, so they're okay.
(doesn't work if defaultexcludes is "yes") -->
<!-- <include name="**/*~" /> -->
<!-- Get rid of pesky OS helper files (doesn't work if defaultexcludes is "yes") -->
<include name="**/.DS_Store" />
<include name="**/Thumbs.db" />
<!-- Additional files to delete may be listed here -->
</fileset>
</delete>
</target>
<target name="clean-products" unless="skip-clean">
<echo message="Deleting all final build products" />
<delete dir="docs" failonerror="${clean-can-fail}" />
<delete includeemptydirs="true" failonerror="${clean-can-fail}">
<fileset dir="${basedir}" defaultexcludes="no">
<include name="*.jar" />
<include name="*.zip" />
<include name="*.tar.gz" />
<include name="${ant.project.name}-*" />
</fileset>
</delete>
</target>
<!-- ******************
Subversion Targets
****************** -->
<target name="update" depends="clean" description="Reconcile source with the Subversion archive">
<echo message="Running Subversion update" />
<exec executable="svn" failonerror="yes">
<arg value="update" />
</exec>
<exec executable="svn" failonerror="yes">
<arg value="status" />
</exec>
</target>
<target name="commit" depends="update, build"
description="Commit source to the Subversion archive (after building)">
<antcall target="clean-intermediate"> <!-- Clean up after the latest build -->
<param name="clean-can-fail" value="no" />
</antcall>
<exec executable="svn" failonerror="yes">
<arg value="status" />
</exec>
<input message="Please enter a log message for the commit: "
addproperty="svn-commit-message" />
<echo message="Running Subversion commit" />
<exec executable="svn" failonerror="yes">
<arg value="commit" />
<arg value="-m" />
<arg value="${svn-commit-message}" />
</exec>
</target>
<target name="tag" depends="update, resolve-version-tag"
description="Copy the working copy to a new Subversion tag (after updating)">
<echo message="Creating a new Subversion tag with name ${version-tag}"/>
<exec executable="svn" failonerror="yes">
<arg value="copy" />
<arg value="${basedir}" />
<arg value="${svn-repository}/tags/${version-tag}" />
<arg value="-m" />
<arg value="Created tag ${version-tag}" />
</exec>
</target>
<target name="branch" depends="update"
description="Copy the working copy to a new Subversion branch (after updating)">
<echo message="This will create a new branch from your working copy. If there are changes " />
<echo message="in your copy that have not been committed, you may want to do so first, " />
<echo message="so that there's a clear branch point for merging later." />
<input message="Enter a name for the new branch: "
addproperty="svn-branch-name" />
<echo message="Creating a new Subversion branch ${svn-branch-name}" />
<exec executable="svn" failonerror="yes">
<arg value="copy" />
<arg value="${basedir}" />
<arg value="${svn-repository}/branches/${svn-branch-name}" />
<arg value="-m" />
<arg value="Created branch ${svn-branch-name}" />
</exec>
</target>
<!-- ***************
Release Targets
*************** -->
<target name="release-stable" description="Generate all release files tagged with 'stable'">
<antcall target="release">
<param name="tag-append" value="-stable" />
</antcall>
</target>
<target name="release-beta" description="Generate all release files tagged with 'beta'">
<antcall target="release">
<param name="tag-append" value="-beta" />
</antcall>
</target>
<target name="release"
depends="update, build, tag, jar-app, src-zip"
description="Generate all release files (after building)">
<delete dir="${version-tag}" />
</target>
<target name="jar-app" depends="assert-jar-exists, resolve-version-tag">
<echo message="Creating ${version-tag}.jar" />
<copy file="${ant.project.name}.jar" tofile="${version-tag}.jar" />
</target>
<target name="src-zip" depends="resolve-version-tag">
<echo message="Creating ${version-tag}-src.zip" />
<exec executable="svn" failonerror="yes">
<arg value="export" />
<arg value="${svn-repository}/tags/${version-tag}" />
<arg value="${version-tag}/src" />
</exec>
<zip destfile="${version-tag}-src.zip">
<zipfileset dir="${version-tag}/src" prefix="${version-tag}/src" />
</zip>
</target>
<!-- ********************************
Misc Occasionally-Useful Targets
******************************** -->
<patternset id="exclude-binaries">
<exclude name="**/*.jar" />
<exclude name="**/*.class" />
<exclude name="**/DrJava" />
<exclude name="**/*.png" />
<exclude name="**/*.icns" />
<exclude name="**/*.gif" />
<exclude name="**/*.jpg" />
<exclude name="**/*.jpeg" />
<!-- Additional binary types may be added here -->
</patternset>
<!-- Run a batch find-and-replace on all text files in the project.
Assumes the properties "find" and "replace" have been defined
(e.g. "ant -Dfind=foo -Dreplace=bar find-and-replace"). -->
<target name="find-and-replace">
<replace dir="${basedir}" token="${find}" value="${replace}" summary="yes">
<patternset refid="exclude-binaries" />
</replace>
</target>
<!-- Standardize all newline character sequences. Subversion takes care of this
automatically, but sometimes files crop up with the wrong sequence.
Use "svn status" after running this to see which files were fixed. -->
<target name="fix-newlines" description="Standardize newline character sequences in all text files">
<!-- If we're in Windows, use \r\n -->
<condition property="newline-code" value="crlf">
<os family="windows" />
</condition>
<!-- Otherwise, use \n -->
<property name="newline-code" value="lf" />
<fixcrlf srcdir="${basedir}" eol="${newline-code}" fixlast="no">
<patternset refid="exclude-binaries" />
</fixcrlf>
</target>
<!-- ***************************
Property-resolution Targets
*************************** -->
<target name="assert-docbook-xsl-exists">
<available property="docbook-xsl-exists" file="${docbook-xsl-home}/html/chunk.xsl" />
<fail message="${docbook-xsl-home}/html/chunk.xsl does not exist" unless="docbook-xsl-exists" />
</target>
<target name="assert-jar-exists">
<available property="jar-exists" file="${ant.project.name}.jar" />
<fail message="Can't find ${ant.project.name}.jar" unless="jar-exists" />
</target>
<target name="resolve-version-tag">
<!-- Get a timestamp based on GMT, rather than local time -->
<tstamp>
<format property="DSTAMP" pattern="yyyyMMdd" timezone="GMT" />
<format property="TSTAMP" pattern="HHmm" timezone="GMT" />
<format property="TODAY" pattern="MMMM dd yyyy" timezone="GMT" />
</tstamp>
<property name="version-tag"
value="${ant.project.name}${tag-append}-${DSTAMP}-${TSTAMP}" />
</target>
<!-- Sets "already-generated" if "generate-file" is more recent than "generate-sourcefile";
otherwise, the out-of-date target file is deleted (if it exists). Note that, since
properties can only be set once, this should happen underneath an "antcall". -->
<target name="check-generate-file-from-file">
<dependset>
<srcfilelist dir="${basedir}" files="${generate-sourcefile}" />
<targetfilelist dir="${basedir}" files="${generate-file}" />
</dependset>
<available file="${generate-file}" property="already-generated" />
</target>
<!-- Sets "already-generated" if "generate-file" is more recent than everything in
"generate-sourcedir"; otherwise, the out-of-date target file is deleted (if it exists).
Note that, since properties can only be set once, this should happen underneath an "antcall". -->
<target name="check-generate-file-from-dir">
<dependset>
<srcfileset dir="${generate-sourcedir}" />
<targetfilelist dir="${basedir}" files="${generate-file}" />
</dependset>
<available file="${generate-file}" property="already-generated" />
</target>
<!-- Sets "already-generated" if "generate-dir" was created (or modified) more recently
than "generate-sourcefile". Note that, since properties can only be set once, this
should happen underneath an "antcall". -->
<target name="check-generate-dir-from-file">
<uptodate property="already-generated" targetfile="${generate-dir}" srcfile="${generate-sourcefile}" />
</target>
<!-- Sets "already-generated" if "generate-dir" was created (or modified) more recently
than everything in "generate-sourcedir". Note that, since properties can only be
set once, this should happen underneath an "antcall". -->
<target name="check-generate-dir-from-dir">
<!-- Unfortunately, a bug in uptodate prevents this from working properly,
so we just have to equate *existence* with being up to date.
<uptodate property="already-generated" targetfile="${generate-dir}" >
<srcfiles dir="${generate-sourcedir}" />
</uptodate>
-->
<available file="${generate-dir}" property="already-generated" />
</target>
</project>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.