Skip to content

Commit 0aad040

Browse files
author
dlsmith
committed
Added build file
git-svn-id: file:///tmp/test-svn/trunk@3477 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent 67e38f7 commit 0aad040

File tree

1 file changed

+329
-0
lines changed

1 file changed

+329
-0
lines changed

docs/build.xml

Lines changed: 329 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,329 @@
1+
<!--
2+
$Header$
3+
-->
4+
<!-- *** BUILD FILE HEADER ***
5+
6+
This project file, along with these others, are all quite similar:
7+
drjava: docs/build.xml
8+
drjava: drjava/build.xml
9+
drjava: dynamicjava/build.xml
10+
drjava: eclipse/build.xml
11+
drjava: jedit/build.xml
12+
drjava: platforms/build.xml
13+
javalanglevels: javalanglevels/build.xml
14+
ricejst: ricejst/build.xml
15+
16+
In order to avoid inconsistency, changes made to one should, in general, be reflected in each of the others.
17+
PLEASE DON'T FIX OR UPDATE ONE BUILD SCRIPT WITHOUT MIRRORING THE CHANGES IN THE OTHERS. While this approach
18+
leads to a lot of "repeated code," the advantage is that each module is able in this way to maintain a simple,
19+
understandable build process without external dependencies.
20+
21+
The following should be customized (or, if unneeded, removed) in each build file:
22+
- The name of the project
23+
- The test-classes, test-products, and resources patternsets
24+
- The readable-project-name, jar-filename, src-working-dir, etc. properties
25+
- The list of generated sources
26+
- The list of environment variables
27+
- The list of additional taskdefs
28+
- The help target description
29+
- The build target behavior (specifying the default build process)
30+
- The list of source-generating targets
31+
- The test target behavior (specifying the default test target)
32+
- The list of files removed by "clean"
33+
- The command to export CVS sources in "src-zip"
34+
-->
35+
36+
37+
<project name="docs" default="help">
38+
39+
<!-- Matches non-class-file resources that should be available to the executable.
40+
The search is relative to the src directory. -->
41+
<patternset id="resources">
42+
<include name="**/LICENSE" />
43+
<include name="**/README" />
44+
<include name="**/*.gif" />
45+
<include name="**/*.png" />
46+
<include name="**/*.jpg" />
47+
<include name="**/*.jpeg" />
48+
</patternset>
49+
50+
<!-- Matches documentation files that should be included in the jar. The search is relative
51+
to the docs directory. -->
52+
<patternset id="jar-docs">
53+
<include name="user/**">
54+
<include name="quickstart/**">
55+
</patternset>
56+
57+
<property name="readable-project-name" value="DrJava-Docs" />
58+
<property name="jar-filename" value="docs.jar" />
59+
60+
<property environment="env" />
61+
<property name="java14-home" value="${env.JAVA14_HOME}" />
62+
63+
<!-- By default, delete jar files when cleaning -->
64+
<property name="delete-jars" value="yes" />
65+
66+
<!-- By default, don't append anything extra to the tag -->
67+
<property name="tag-append" value="" />
68+
69+
<!-- Don't use or inherit the CLASSPATH environment variable for anything -->
70+
<property name="build.sysclasspath" value="ignore" />
71+
72+
<fileset id="libs" dir="lib" includes="*.jar" /> <!-- Only include jars that are at the top level (not in buildlib) -->
73+
74+
75+
<!-- ***********
76+
Help Target
77+
*********** -->
78+
79+
<target name="help" description="Print general build script information">
80+
<echo message="--------------------------------------------------------------------" />
81+
<echo message="DrJava Docs Build Scripts" />
82+
<echo message="--------------------------------------------------------------------" />
83+
<echo message="Type 'ant -projecthelp' or 'ant -p' to see the list of targets." />
84+
<echo message="" />
85+
<echo message="For this build file to function properly, the following environment " />
86+
<echo message="variables should be defined:" />
87+
<echo message="PATH: 'cvs' needs to refer to the CVS executable; 'docbook2html' and " />
88+
<echo message=" 'docbook2pdf' should also be available." />
89+
<echo message="" />
90+
<echo message="Ant may also require ANT_HOME to be set."
91+
</target>
92+
93+
94+
<!-- ***************************
95+
Property-resolution Targets
96+
*************************** -->
97+
98+
<target name="assert-docbook2html-present">
99+
<available file="docbook2html" property="docbook2html-present" filepath="${env.PATH}" />
100+
<fail message="The specified target requires docbook2html to be present on the path" unless="docbook2html-present" />
101+
</target>
102+
103+
<target name="assert-docbook2pdf-present">
104+
<available file="docbook2pdf" property="docbook2pdf-present" filepath="${env.PATH}" />
105+
<fail message="The specified target requires docbook2pdf to be present on the path" unless="docbook2pdf-present" />
106+
</target>
107+
108+
<target name="assert-jar-exists">
109+
<available property="jar-exists" file="${ant.project.name}.jar" />
110+
<fail message="Can't find ${ant.project.name}.jar" unless="jar-exists" />
111+
</target>
112+
113+
<target name="resolve-version-tag">
114+
<!-- Get a timestamp based on GMT, rather than local time -->
115+
<tstamp>
116+
<format property="DSTAMP" pattern="yyyyMMdd" timezone="GMT" />
117+
<format property="TSTAMP" pattern="HHmm" timezone="GMT" />
118+
<format property="TODAY" pattern="MMMM dd yyyy" timezone="GMT" />
119+
</tstamp>
120+
<property name="version-tag"
121+
value="${ant.project.name}${tag-append}-${DSTAMP}-${TSTAMP}" />
122+
</target>
123+
124+
125+
<!-- ************
126+
Build Target
127+
************ -->
128+
129+
<target name="build" depends="doc, jar"
130+
description="Shortcut for 'doc jar'">
131+
</target>
132+
133+
134+
<!-- *********************
135+
Documentation Targets
136+
********************* -->
137+
138+
<target name="doc" depends="doc-user, doc-developer, doc-quickstart"
139+
description="Generate all documentation">
140+
</target>
141+
142+
<target name="doc-user">
143+
<echo message="Creating user documentation" />
144+
<antcall target="run-docbook2html" inheritall="false">
145+
<param name="docbook-dir" value="user" />
146+
<param name="docbook-srcfile" value="userdoc.docbook" />
147+
</antcall>
148+
<antcall target="run-docbook2pdf" inheritall="false">
149+
<param name="docbook-dir" value="user" />
150+
<param name="docbook-srcfile" value="userdoc.docbook" />
151+
</antcall>
152+
</target>
153+
154+
<target name="doc-quickstart">
155+
<echo message="Creating quickstart documentation" />
156+
<antcall target="run-docbook2html" inheritall="false">
157+
<param name="docbook-dir" value="quickstart" />
158+
<param name="docbook-srcfile" value="quickstart.docbook" />
159+
</antcall>
160+
<antcall target="run-docbook2pdf" inheritall="false">
161+
<param name="docbook-dir" value="quickstart" />
162+
<param name="docbook-srcfile" value="quickstart.docbook" />
163+
</antcall>
164+
</target>
165+
166+
<target name="doc-developer">
167+
<echo message="Creating developer documentation" />
168+
<antcall target="run-docbook2html" inheritall="false">
169+
<param name="docbook-dir" value="developer" />
170+
<param name="docbook-srcfile" value="devdoc.docbook" />
171+
</antcall>
172+
<antcall target="run-docbook2pdf" inheritall="false">
173+
<param name="docbook-dir" value="developer" />
174+
<param name="docbook-srcfile" value="devdoc.docbook" />
175+
</antcall>
176+
</target>
177+
178+
<target name="run-docbook2html" depends="assert-docbook2html-present">
179+
<apply executable="docbook2html" failonerror="yes" type="file">
180+
<arg value="-o"/>
181+
<arg value="docs/${docbook-dir}"/>
182+
<arg value="-V"/>
183+
<arg value="%use-id-as-filename%"/>
184+
<fileset dir="src/${docbook-dir}">
185+
<include name="${docbook-srcfile}" />
186+
</fileset>
187+
</apply>
188+
</target>
189+
190+
<target name="run-docbook2pdf" depends="assert-docbook2pdf-present">
191+
<apply executable="docbook2pdf" failonerror="yes" type="file">
192+
<arg value="-o"/>
193+
<arg value="docs"/>
194+
<fileset dir="src/${docbook-dir}">
195+
<include name="${docbook-srcfile}" />
196+
</fileset>
197+
</apply>
198+
</target>
199+
200+
<target name="copy-resources">
201+
<copy todir="classes/base">
202+
<fileset dir="src">
203+
<patternset refid="resources" />
204+
</fileset>
205+
</copy>
206+
</target>
207+
208+
209+
<!-- ***********
210+
Jar Targets
211+
*********** -->
212+
213+
<target name="jar" depends="doc, resolve-version-tag"
214+
description="Create the jar file with all docs (generating docs first)">
215+
<jar jarfile="${jar-filename}">
216+
<manifest>
217+
<attribute name="Built-By" value="${user.name}" />
218+
<attribute name="Build-Version" value="${version-tag}" />
219+
</manifest>
220+
<fileset dir="docs">
221+
<patternset refid="test-classes" />
222+
</fileset>
223+
</jar>
224+
</target>
225+
226+
227+
<!-- ************
228+
Clean Target
229+
************ -->
230+
231+
<target name="clean" description="Remove all build products; the result should match the intended CVS contents">
232+
<echo message="Deleting all build products" />
233+
<delete dir="docs" />
234+
235+
<condition property="do-delete-jars">
236+
<istrue value="${delete-jars}" />
237+
</condition>
238+
<delete includeemptydirs="true">
239+
<fileset dir="${basedir}" defaultexcludes="no">
240+
<include name="*.jar" if="do-delete-jars" />
241+
<!-- We could get rid of backups, but "update" ignores them, so they're okay.
242+
(doesn't work if defaultexcludes is "yes") -->
243+
<!-- <include name="**/*~" /> -->
244+
<!-- Get rid of pesky OS helper files (doesn't work if defaultexcludes is "yes") -->
245+
<include name="**/.DS_Store" />
246+
<include name="**/Thumbs.db" />
247+
</fileset>
248+
</delete>
249+
250+
</target>
251+
252+
253+
<!-- ***********
254+
CVS Targets
255+
*********** -->
256+
257+
<target name="update" depends="clean" description="Reconcile source with the CVS archive">
258+
<echo message="Running CVS update ('-q' -- you will only see output for files that don't match)" />
259+
<!-- TODO: Experiment with the 'compression' option -->
260+
<cvs command="update -d -P" quiet="true" />
261+
</target>
262+
263+
<target name="commit" depends="update, build, do-commit, tag"
264+
description="Commit source to the CVS archive (after building)">
265+
<echo message="New version is committed to CVS" />
266+
</target>
267+
268+
<target name="do-commit">
269+
<antcall target="clean" inheritall="false"> <!-- Clean up after the latest build -->
270+
<param name="delete-jars" value="no" />
271+
</antcall>
272+
<input message="Please enter a log message for the commit: "
273+
addproperty="cvs.commit.message" />
274+
<echo message="Running CVS commit"/>
275+
<cvs quiet="true">
276+
<commandline>
277+
<argument value="commit" />
278+
<argument value="-m" />
279+
<argument value="${cvs.commit.message}" />
280+
</commandline>
281+
</cvs>
282+
</target>
283+
284+
<target name="tag" depends="resolve-version-tag">
285+
<echo message="Running CVS tag with version ${version-tag}"/>
286+
<cvs command="tag -c ${version-tag}" reallyquiet="true" />
287+
</target>
288+
289+
290+
<!-- ********************************
291+
Misc Occasionally-Useful Targets
292+
******************************** -->
293+
294+
<patternset id="exclude-binaries">
295+
<exclude name="**/*.jar" />
296+
<exclude name="**/*.class" />
297+
<exclude name="**/DrJava" />
298+
<exclude name="**/*.png" />
299+
<exclude name="**/*.icns" />
300+
<exclude name="**/*.gif" />
301+
<exclude name="**/*.jpg" />
302+
<exclude name="**/*.jpeg" />
303+
</patternset>
304+
305+
<!-- Run a batch find-and-replace on all text files in the project.
306+
Assumes the properties "find" and "replace" have been defined
307+
(e.g. "ant -Dfind=foo -Dreplace=bar find-and-replace"). -->
308+
<target name="find-and-replace">
309+
<replace dir="${basedir}" token="${find}" value="${replace}" summary="yes">
310+
<patternset refid="exclude-binaries" />
311+
</replace>
312+
</target>
313+
314+
<!-- Standardize all newline character sequences. CVS takes care of this
315+
automatically, but sometimes files crop up with the wrong sequence.
316+
Use "cvs update" after running this to see which files were fixed. -->
317+
<target name="fix-newlines">
318+
<!-- If we're in Windows, use \r\n -->
319+
<condition property="newline-code" value="crlf">
320+
<os family="windows" />
321+
</condition>
322+
<!-- Otherwise, use \n -->
323+
<property name="newline-code" value="lf" />
324+
<fixcrlf srcdir="${basedir}" eol="${newline-code}" fixlast="no">
325+
<patternset refid="exclude-binaries" />
326+
</fixcrlf>
327+
</target>
328+
329+
</project>

0 commit comments

Comments
 (0)