Skip to main content
summaryrefslogtreecommitdiffstats
blob: 2b49cf6fbeef1df9994f16b8d981ded55d03ded9 (plain) (blame)
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
<?xml version="1.0"?>
<project name="Xpand documentation" default="build.all">

	<property file="build-docbook.properties" />

	<path id="fop">
		<pathelement location="${tools.dir}/fop/fop.jar" />
		<pathelement location="${tools.dir}/fop/avalon-framework-4.2.0.jar" />
		<pathelement location="${tools.dir}/fop/batik-all-1.6.jar" />
	</path>

	<path id="saxon">
		<pathelement location="${xerces.lib.path}" />
		<pathelement location="${saxon.lib.path}" />
	</path>

	<tstamp>
		<format property="date" pattern="yyyy-MM-dd" />
		<format property="year" pattern="yyyy" />
	</tstamp>

	<taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop" classpathref="fop" />

	<target name="build.all" depends="stage, build.doc.html, build.doc.eclipsehelp, build.doc.pdf, unstage" />

	<target name="build.doc.html" depends="stage.html">
		<delete dir="${html.output.dir}/contents" failonerror="false" />
		<copy todir="${html.output.dir}/contents/images">
			<fileset dir="${images.dir}">
				<include name="**/*" />
			</fileset>
		</copy>
		<copy file="${css.file.path}" todir="${html.output.dir}" />
		<java fork="true" dir="${html.output.dir}" failonerror="true" classname="com.icl.saxon.StyleSheet">
			<classpath refid="saxon" />
			<sysproperty key="javax.xml.parsers.DocumentBuilderFactory" value="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
			<sysproperty key="javax.xml.parsers.SAXParserFactory" value="org.apache.xerces.jaxp.SAXParserFactoryImpl"/>
			<sysproperty key="org.apache.xerces.xni.parser.XMLParserConfiguration" value="org.apache.xerces.parsers.XIncludeParserConfiguration"/>
			<arg value="${build.dir}/index.xml" />
			<arg value="${build.dir}/${html.stylesheet}" />
			<arg value='profile.condition="${document.type}"'>
			</arg>
		</java>
	</target>

	<target name="build.doc.eclipsehelp" depends="stage.eclipse">
		<delete dir="${eclipse.output.dir}/contents" failonerror="false" />
		<copy todir="${eclipse.output.dir}/contents/images">
			<fileset dir="${images.dir}">
				<include name="**/*" />
			</fileset>
		</copy>
		<copy file="${css.file.path}" todir="${eclipse.output.dir}" />
		<java fork="true" dir="${eclipse.output.dir}" failonerror="true" classname="com.icl.saxon.StyleSheet">
			<classpath refid="saxon" />
			<sysproperty key="javax.xml.parsers.DocumentBuilderFactory" value="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
			<sysproperty key="javax.xml.parsers.SAXParserFactory" value="org.apache.xerces.jaxp.SAXParserFactoryImpl"/>
			<sysproperty key="org.apache.xerces.xni.parser.XMLParserConfiguration" value="org.apache.xerces.parsers.XIncludeParserConfiguration"/>
			<arg value="${build.dir}/index.xml" />
			<arg value="${build.dir}/${eclipse.stylesheet}" />
			<arg value="eclipse.plugin.id=${eclipse.plugin.id}" />
			<arg value="eclipse.plugin.name=${eclipse.plugin.name}" />
			<arg value="eclipse.plugin.provider=${eclipse.plugin.provider}" />
			<arg value='profile.condition="${document.type}"'>
			</arg>
		</java>
	</target>

	<target name="build.doc.pdf" depends="stage.pdf">
		<java fork="true" dir="${build.dir}" failonerror="true" classname="com.icl.saxon.StyleSheet">
			<classpath refid="saxon" />
			<sysproperty key="javax.xml.parsers.DocumentBuilderFactory" value="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
			<sysproperty key="javax.xml.parsers.SAXParserFactory" value="org.apache.xerces.jaxp.SAXParserFactoryImpl"/>
			<sysproperty key="org.apache.xerces.xni.parser.XMLParserConfiguration" value="org.apache.xerces.parsers.XIncludeParserConfiguration"/>
			<arg value="-o" />
			<arg value="${build.dir}/${product.name.files}_documentation.fo" />
			<arg value="${build.dir}/index.xml" />
			<arg value="${pdf.stylesheet}" />
			<arg value="draft.mode=no" />
			<arg value="paper.type=A4" />
			<arg value="l10n.gentext.language=en" />
			<arg value='profile.condition="${document.type}"'>
			</arg>
		</java>

		<mkdir dir="${pdf.output.dir}" />

		<fop format="application/pdf" outdir="${pdf.output.dir}" basedir="${build.dir}" messagelevel="debug">
			<fileset dir="${build.dir}">
				<include name="**/*.fo" />
			</fileset>
		</fop>
	</target>

	<target name="stage" depends="unstage">
		<copy todir="${build.dir}">
			<fileset dir="${src.dir}">
				<include name="**/*.xml" />
			</fileset>
		</copy>
		<copy todir="${build.dir}/content">
			<fileset dir="${content.dir}">
				<include name="**/*.xml" />
			</fileset>
		</copy>
		<copy todir="${build.dir}/content/images">
			<fileset dir="${images.dir}">
				<include name="**/*" />
			</fileset>
		</copy>
		<copy file="${tools.basedir}/shared/bookinfo.xml" todir="${build.dir}" />
		<replace file="${build.dir}/index.xml" token="@DOCBOOKVERSION@"
			value="${docbook.version}" casesensitive="true"/>
        <replace file="${build.dir}/index.xml" token="@TITLE@"
            value="${doc.title}" casesensitive="true"/>
		<replace file="${build.dir}/bookinfo.xml" token="@VERSION@"
			value="${product.version}" casesensitive="true"/>
		<replace file="${build.dir}/bookinfo.xml" token="@DATE@"
			value="${date}" casesensitive="true"/>
	</target>

	<target name="stage.pdf" depends="stage">
		<copy file="${pdf.stylesheet.path}" todir="${build.dir}" />
		<replace file="${build.dir}/${pdf.stylesheet}" token="@SHAREDIMAGESDIR@"
			value="${shared.images.dir}" casesensitive="true"/>
		<replace file="${build.dir}/${pdf.stylesheet}" token="@DOCBOOKDIR@"
			value="${docbook.dir}" casesensitive="true" />
		<replace file="${build.dir}/${pdf.stylesheet}" token="@TOOLSDIR@"
			value="${tools.dir}" casesensitive="true"/>
		<replace file="${build.dir}/${pdf.stylesheet}" token="@YEAR@"
			value="${year}" casesensitive="true"/>
	</target>

	<target name="stage.html" depends="stage">
		<copy file="${html.stylesheet.path}" todir="${build.dir}" />
		<replace file="${build.dir}/${html.stylesheet}" token="@DOCBOOKDIR@"
			value="${docbook.dir}" casesensitive="true" />
	</target>

	<target name="stage.eclipse" depends="stage">
		<copy file="${eclipse.stylesheet.path}" todir="${build.dir}" />
		<replace file="${build.dir}/${eclipse.stylesheet}" token="@DOCBOOKDIR@"
			value="${docbook.dir}" casesensitive="true" />
	</target>

	<target name="unstage">
		<delete dir="${build.dir}" />
	</target>

	<target name="clean" depends="unstage">
		<delete dir="${output.dir}" />
	</target>

</project>

Back to the top