-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathbuild.xml
More file actions
338 lines (278 loc) · 12.2 KB
/
build.xml
File metadata and controls
338 lines (278 loc) · 12.2 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
<!--
$Header$
-->
<!-- *** BUILD FILE HEADER ***
This project file, along with these others, are all quite similar:
drjava: docs/build.xml
drjava: drjava/build.xml
drjava: dynamicjava/build.xml
drjava: eclipse/build.xml
drjava: jedit/build.xml
drjava: platforms/build.xml
javalanglevels: javalanglevels/build.xml
ricejst: ricejst/build.xml
In order to avoid inconsistency, changes made to one should, in general, be reflected in each of the others.
PLEASE DON'T FIX OR UPDATE ONE BUILD SCRIPT WITHOUT MIRRORING THE CHANGES IN THE OTHERS. While this approach
leads to a lot of "repeated code," the advantage is that each module is able in this way to maintain a simple,
understandable build process without external dependencies.
The following should be customized (or, if unneeded, removed) in each build file:
- The name of the project
- The test-classes, test-products, and resources patternsets
- The readable-project-name, jar-filename, src-working-dir, etc. properties
- The list of generated sources
- The list of environment variables
- The list of additional taskdefs
- The help target description
- The build target behavior (specifying the default build process)
- The list of source-generating targets
- The test target behavior (specifying the default test target)
- The list of files removed by "clean"
- The command to export CVS sources in "src-zip"
-->
<project name="docs" default="help">
<!-- Matches non-class-file resources that should be available to the executable.
The search is relative to the src directory. -->
<patternset id="resources">
<include name="**/LICENSE" />
<include name="**/README" />
<include name="**/*.gif" />
<include name="**/*.png" />
<include name="**/*.jpg" />
<include name="**/*.jpeg" />
</patternset>
<!-- Matches documentation files that should be included in the jar. The search is relative
to the docs directory. -->
<patternset id="jar-docs">
<include name="user/**" />
<include name="quickstart/**" />
</patternset>
<property name="readable-project-name" value="DrJava-Docs" />
<property name="jar-filename" value="docs.jar" />
<property environment="env" />
<property name="java14-home" value="${env.JAVA14_HOME}" />
<!-- By default, delete jar files when cleaning -->
<property name="delete-jars" 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="DrJava Docs 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="PATH: 'cvs' needs to refer to the CVS executable; 'docbook2html' and " />
<echo message=" 'docbook2pdf' should also be available." />
<echo message="" />
<echo message="Ant may also require ANT_HOME to be set." />
</target>
<!-- ***************************
Property-resolution Targets
*************************** -->
<target name="assert-docbook2html-present">
<available file="docbook2html" property="docbook2html-present" filepath="${env.PATH}" />
<fail message="The specified target requires docbook2html to be present on the path" unless="docbook2html-present" />
</target>
<target name="assert-docbook2pdf-present">
<available file="docbook2pdf" property="docbook2pdf-present" filepath="${env.PATH}" />
<fail message="The specified target requires docbook2pdf to be present on the path" unless="docbook2pdf-present" />
</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>
<!-- ************
Build Target
************ -->
<target name="build" depends="doc-html, jar"
description="Shortcut for 'doc-html jar'">
</target>
<!-- *********************
Documentation Targets
********************* -->
<target name="doc" depends="doc-html doc-pdf"
description="Shortcut for 'doc-html doc-pdf'">
</target>
<target name="doc-html" description="Generate all html documentation">
<echo message="Creating user documentation" />
<antcall target="run-docbook2html" inheritall="false">
<param name="docbook-dir" value="user" />
<param name="docbook-srcfile" value="userdoc.docbook" />
</antcall>
<echo message="Creating quickstart documentation" />
<antcall target="run-docbook2html" inheritall="false">
<param name="docbook-dir" value="quickstart" />
<param name="docbook-srcfile" value="quickstart.docbook" />
</antcall>
<echo message="Creating developer documentation" />
<antcall target="run-docbook2html" inheritall="false">
<param name="docbook-dir" value="developer" />
<param name="docbook-srcfile" value="devdoc.docbook" />
</antcall>
</target>
<target name="doc-pdf" description="Generate all pdf documentation">
<echo message="Creating user documentation" />
<antcall target="run-docbook2pdf" inheritall="false">
<param name="docbook-dir" value="user" />
<param name="docbook-srcfile" value="userdoc.docbook" />
</antcall>
<echo message="Creating quickstart documentation" />
<antcall target="run-docbook2pdf" inheritall="false">
<param name="docbook-dir" value="quickstart" />
<param name="docbook-srcfile" value="quickstart.docbook" />
</antcall>
<echo message="Creating developer documentation" />
<antcall target="run-docbook2pdf" inheritall="false">
<param name="docbook-dir" value="developer" />
<param name="docbook-srcfile" value="devdoc.docbook" />
</antcall>
</target>
<target name="run-docbook2html" depends="assert-docbook2html-present">
<mkdir dir="docs/${docbook-dir}" />
<apply executable="docbook2html" failonerror="yes" type="file">
<arg value="-o" />
<arg value="docs/${docbook-dir}" />
<arg value="-V" />
<arg value="%use-id-as-filename%" />
<fileset dir="src/${docbook-dir}">
<include name="${docbook-srcfile}" />
</fileset>
</apply>
</target>
<target name="run-docbook2pdf" depends="assert-docbook2pdf-present">
<mkdir dir="docs/${docbook-dir}" />
<apply executable="docbook2pdf" failonerror="yes" type="file">
<arg value="-o" />
<arg value="docs" />
<fileset dir="src/${docbook-dir}">
<include name="${docbook-srcfile}" />
</fileset>
</apply>
</target>
<target name="copy-resources">
<copy todir="classes/base">
<fileset dir="src">
<patternset refid="resources" />
</fileset>
</copy>
</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="${jar-filename}">
<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">
<patternset refid="jar-docs" />
</zipfileset>
</jar>
</target>
<!-- ************
Clean Target
************ -->
<target name="clean" description="Remove all build products; the result should match the intended CVS contents">
<echo message="Deleting all build products" />
<delete dir="docs" />
<condition property="do-delete-jars">
<istrue value="${delete-jars}" />
</condition>
<delete includeemptydirs="true">
<fileset dir="${basedir}" defaultexcludes="no">
<include name="*.jar" if="do-delete-jars" />
<!-- 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" />
</fileset>
</delete>
</target>
<!-- ***********
CVS Targets
*********** -->
<target name="update" depends="clean" description="Reconcile source with the CVS archive">
<echo message="Running CVS update ('-q' -- you will only see output for files that don't match)" />
<!-- TODO: Experiment with the 'compression' option -->
<cvs command="update -d -P" quiet="true" />
</target>
<target name="commit" depends="update, build, do-commit, tag"
description="Commit source to the CVS archive (after building)">
<echo message="New version is committed to CVS" />
</target>
<target name="do-commit">
<antcall target="clean" inheritall="false"> <!-- Clean up after the latest build -->
<param name="delete-jars" value="no" />
</antcall>
<input message="Please enter a log message for the commit: "
addproperty="cvs.commit.message" />
<echo message="Running CVS commit"/>
<cvs quiet="true">
<commandline>
<argument value="commit" />
<argument value="-m" />
<argument value="${cvs.commit.message}" />
</commandline>
</cvs>
</target>
<target name="tag" depends="resolve-version-tag">
<echo message="Running CVS tag with version ${version-tag}"/>
<cvs command="tag -c ${version-tag}" reallyquiet="true" />
</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" />
</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. CVS takes care of this
automatically, but sometimes files crop up with the wrong sequence.
Use "cvs update" after running this to see which files were fixed. -->
<target name="fix-newlines">
<!-- 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>
</project>