-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
205 lines (178 loc) · 7.34 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
<?xml version="1.0"?>
<!--
This file is part of the DITA Open Toolkit project.
Copyright 2011 Jarno Elovirta
See the accompanying LICENSE file for applicable license.
-->
<project name="org.dita.pdf2.xep">
<target name="transform.fo2pdf.xep.test-use">
<condition property="use.xep.pdf.formatter">
<equals arg1="${pdf.formatter}" arg2="xep"/>
</condition>
</target>
<target name="transform.fo2pdf.xep.init" depends="transform.fo2pdf.xep.test-use" if="use.xep.pdf.formatter">
<!-- Default maximum memory to give to forked Java processes.
Set this higher either in another Ant script or on the
Ant command line using the -D parameter, e.g.:
ant -DmaxJavaMemory=4G
Memory values are integers followed by "M" for megabytes,
"G" for gigabytes.
On 32-bit systems, the largest memory setting will be somewhere
between 1500M and 2000M depending on your system.
64-bit JVMs can use essentially unlimited memory.
For memory-intensive process (very large maps),
2 or 3 gigabytes should be more than sufficient.
This value is used in the @maxmemory attribute the of the Ant
<java> task.
-->
<property name="maxJavaMemory" value="500m"/>
<!-- Determine the Java architecture and set the JVM arguments
appropriately.
Note that the Java architecture is determined by how the
JVM is started, so it is possible for the base Ant
JVM to have been started in 32-bit mode on a 64-bit machine.
The is64bit and is32bit properties are mutually exclusive.
-->
<condition property="is64bit">
<!-- NOTE: The following is not a complete list but should cover
most of the systems Open Toolkit users are likely
to use. Add more values as they become known.
-->
<and>
<or>
<os arch="x86_64"/>
<os arch="amd64"/>
<os arch="ppc64"/>
</or>
<not>
<os family="windows"/>
</not>
</and>
</condition>
<condition property="is32bit">
<isfalse value="${is64bit}"/>
</condition>
<!-- For 64-bit machines, the value -d64 runs the
the JVM in 64-bit mode. This parameter cannot
be specified on 32-bit machines (that is, you cannot
specify -d32 on a 32-bit machine, you get an "unrecognized
option error in that case).
-->
<condition property="jvmArchFlag"
value="-d64"
else="">
<istrue value="${is64bit}"/>
</condition>
<!-- Base JVM argument line to use with any forked Java processes.
Sets the JVM architecture.
Use like so:
<java ...>
<jvmarg line="${baseJVMArgLine}"/>
...
</java>
-->
<property name="baseJVMArgLine" value="${jvmArchFlag} -Xmx${maxJavaMemory}"/>
<condition property="use.xep.pdf.formatter">
<equals arg1="${pdf.formatter}" arg2="xep"/>
</condition>
<condition property="temp.transformation.file" value="${dita.plugin.org.dita.pdf2.xep.dir}/xsl/fo/topic2fo_shell_xep.xsl">
<and>
<not><isset property="args.xsl.pdf"/></not>
<isset property="use.xep.pdf.formatter"/>
</and>
</condition>
<!-- default output format -->
<property name="xep.formatter.output-format" value="PDF"/>
<!-- output file extension -->
<condition property="xsl.formatter.ext" value=".ps">
<and>
<equals arg1="${xep.formatter.output-format}" arg2="PostScript"/>
<not><isset property="xsl.formatter.ext"/></not>
</and>
</condition>
<condition property="xsl.formatter.ext" value=".html">
<and>
<equals arg1="${xep.formatter.output-format}" arg2="XHTML"/>
<not><isset property="xsl.formatter.ext"/></not>
</and>
</condition>
<condition property="xsl.formatter.ext" value=".AT.xml">
<and>
<equals arg1="${xep.formatter.output-format}" arg2="XEP"/>
<not><isset property="xsl.formatter.ext"/></not>
</and>
</condition>
<!--condition property="xsl.formatter.ext" value=".AT.xml">
<and>
<equals arg1="${xep.formatter.output-format}" arg2="AT"/>
<not><isset property="xsl.formatter.ext"/></not>
</and>
</condition-->
<condition property="xsl.formatter.ext" value=".svg">
<and>
<equals arg1="${xep.formatter.output-format}" arg2="SVG"/>
<not><isset property="xsl.formatter.ext"/></not>
</and>
</condition>
<condition property="xsl.formatter.ext" value=".xps">
<and>
<equals arg1="${xep.formatter.output-format}" arg2="XPS"/>
<not><isset property="xsl.formatter.ext"/></not>
</and>
</condition>
<condition property="xsl.formatter.ext" value=".afp">
<and>
<equals arg1="${xep.formatter.output-format}" arg2="AFP"/>
<not><isset property="xsl.formatter.ext"/></not>
</and>
</condition>
<condition property="xsl.formatter.ext" value=".ppml">
<and>
<equals arg1="${xep.formatter.output-format}" arg2="PPML"/>
<not><isset property="xsl.formatter.ext"/></not>
</and>
</condition>
<condition property="xsl.formatter.ext" value=".pdf">
<and>
<equals arg1="${xep.formatter.output-format}" arg2="PDF"/>
<not><isset property="xsl.formatter.ext"/></not>
</and>
</condition>
</target>
<!-- run XEP -->
<target name="transform.fo2pdf.xep" if="use.xep.pdf.formatter">
<property name="xep.dir" value="${dita.plugin.org.dita.pdf2.xep.dir}/lib/xep"/>
<condition property="xep.config.file" value="${custom.xep.config}">
<isset property="custom.xep.config"/>
</condition>
<condition property="xep.config.file" value="${xep.dir}/xep.xml">
<not><isset property="custom.xep.config"/></not>
</condition>
<path id="xep.class.path">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
<fileset dir="${xep.dir}/lib" includes="**/*.jar"/>
<pathelement location="${fo.lib.dir}/fo.jar"/>
<pathelement location="${dita.plugin.org.dita.pdf2.xep.dir}/lib/xep.jar"/>
</path>
<property name="xep.failOnError" value="true"/>
<property name="outputFile" value="${dita.output.dir}/${outputFile.base}${xsl.formatter.ext}"/>
<mkdir dir="${dita.output.dir}"/>
<echo level="info" taskname="xep">Processing ${pdf2.temp.dir}/topic.fo to ${outputFile}</echo>
<java classname="com.idiominc.ws.opentopic.fo.xep.Runner" resultproperty="errCode"
failonerror="${xep.failOnError}" fork="true" maxmemory="${maxJavaMemory}" taskname="xep">
<jvmarg line="${baseJVMArgLine}"/>
<arg value="${pdf2.temp.dir}/topic.fo"/>
<arg value="${outputFile}"/>
<arg value="failOnError=${xep.failOnError}"/>
<arg value="-${xep.formatter.output-format}"/>
<classpath refid="xep.class.path"/>
<sysproperty key="com.renderx.xep.CONFIG" value="${xep.config.file}"/>
<!--Set up catalog resolver with the DITA main catalog file, useful for solving for example SVG image DOCTYPES-->
<sysproperty key="com.renderx.sax.entityresolver" value="org.apache.xml.resolver.tools.CatalogResolver"/>
<sysproperty key="xml.catalog.files" value="${dita.plugin.org.dita.base.dir}/catalog-dita.xml"/>
</java>
<condition property="xepExitedOnError" value="true">
<not><equals arg1="${errCode}" arg2="0"/></not>
</condition>
</target>
</project>