forked from ggbt/SyncUtil2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
164 lines (130 loc) · 5.82 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
<?xml version="1.0" encoding="UTF-8"?>
<!--This file is part of the DITA Open Toolkit project. See the accompanying LICENSE.md file for applicable licenses.-->
<project name="docs" default="all" basedir=".">
<description>Build DITA Open Toolkit Documentation</description>
<property environment="env"/>
<condition property="dita.home" value="${basedir}/..">
<not><isset property="env.DITA_HOME"/></not>
</condition>
<property name="dita.home" location="${env.DITA_HOME}"/>
<condition property="doc.out.dir" value="${dita.home}/doc" else="${basedir}/out">
<available file="${basedir}/../lib/dost.jar" type="file"/>
</condition>
<macrodef name="dita-ot">
<attribute name="transtype"/>
<attribute name="input"/>
<attribute name="output"/>
<element name="properties" optional="yes"/>
<sequential>
<antcall>
<target name="generate-msg-topic"/>
<target name="generate-params-topic"/>
</antcall>
<ant antfile="${dita.home}/build.xml">
<property name="args.input" location="@{input}"/>
<property name="output.dir" location="@{output}"/>
<property name="transtype" value="@{transtype}"/>
<properties/>
</ant>
</sequential>
</macrodef>
<target name="check-dita-home">
<available file="${dita.home}/lib/dost.jar" type="file" property="dita-ot.available"/>
<fail unless="dita-ot.available">${dita.home}/lib/dost.jar not found.
Does ${dita.home} contain a working DITA-OT installation?
Set the $DITA_HOME environment variable or the dita.home Ant property to
point to a working DITA-OT installation:
Either:
$ export DITA_HOME=/path/to/dita-ot
$ ant ...
Or:
$ ant -Ddita.home=/path/to/dita-ot
</fail>
</target>
<target name="init" depends="check-dita-home">
<property name="resource.dir" location="${dita.home}/resources"/>
<property name="ditaval.file" location="${basedir}/platform.ditaval"/>
</target>
<target name="generate-msg-topic" depends="init" description="Regenerate message file">
<property name="message.xsl" location="${basedir}/resources/messages.xsl"/>
<property name="message.input" location="${resource.dir}/messages.xml"/>
<property name="message.outputtopic" location="${basedir}/user-guide/DITA-messages.xml"/>
<!--ant antfile="${dita.home}/integrator.xml" useNativeBaseDir="true"/-->
<xslt in="${message.input}" out="${message.outputtopic}" style="${message.xsl}"/>
</target>
<target name="generate-params-topic" depends="init" description="Regenerate parameters file">
<property name="params.xsl" location="${basedir}/resources/params.xsl"/>
<property name="params.input" location="${resource.dir}/plugins.xml"/>
<property name="params.outputtopic" location="${basedir}/parameters/_all-parameters.dita"/>
<dirname property="params.outputdir" file="${params.outputtopic}"/>
<makeurl property="params.outputdir.uri" file="${params.outputdir}" validate="false"/>
<!--ant antfile="${dita.home}/integrator.xml" useNativeBaseDir="true"/-->
<xslt in="${params.input}" out="${params.outputtopic}" style="${params.xsl}" force="yes">
<param name="output-dir.url" expression="${params.outputdir.uri}"/>
</xslt>
</target>
<target name="generate-platform-filter" depends="init" description="Generate platform filter file">
<condition property="platform" value="windows">
<os family="windows"/>
</condition>
<condition property="platform" value="osx">
<os family="mac"/>
</condition>
<condition property="platform" value="unix">
<os family="unix"/>
</condition>
<echoxml file="${ditaval.file}">
<val>
<prop action="include" att="platform" val="${platform}"/>
<prop action="exclude" att="platform"/>
</val>
</echoxml>
</target>
<target name="filter-platform" depends="generate-platform-filter" description="Filter output by current platform">
<property name="args.filter" location="${ditaval.file}"/>
</target>
<target name="pdf">
<dita-ot transtype="pdf" input="userguide-book.ditamap" output="${doc.out.dir}">
<properties>
<property name="outputFile.base" value="userguide"/>
<property name="processing-mode" value="strict"/>
</properties>
</dita-ot>
</target>
<target name="html">
<dita-ot transtype="html5" input="userguide.ditamap" output="${doc.out.dir}">
<properties>
<property name="args.copycss" value="yes"/>
<property name="args.css" value="dita-ot-doc.css"/>
<property name="args.cssroot" value="resources"/>
<property name="args.csspath" value="css"/>
<property name="args.gen.task.lbl" value="YES"/>
<property name="args.hdr" value="${basedir}/resources/header.xml"/>
<property name="args.xhtml.toc" value="toc"/>
<property name="nav-toc" value="partial"/>
<property name="processing-mode" value="strict"/>
</properties>
</dita-ot>
</target>
<target name="htmlhelp">
<dita-ot transtype="htmlhelp" input="userguide.ditamap" output="${doc.out.dir}/htmlhelp">
<properties>
<property name="args.copycss" value="yes"/>
<property name="args.css" value="dita-ot-doc.css"/>
<property name="args.cssroot" value="resources"/>
<property name="args.csspath" value="css"/>
<property name="args.gen.task.lbl" value="YES"/>
<property name="processing-mode" value="strict"/>
</properties>
</dita-ot>
<move todir="${doc.out.dir}" failonerror="no">
<fileset dir="${doc.out.dir}/htmlhelp" includes="*.chm"/>
</move>
<delete dir="${doc.out.dir}/htmlhelp"/>
</target>
<target name="clean">
<delete dir="${doc.out.dir}"/>
<delete dir="${ditaval.file}" failonerror="false"/>
</target>
<target name="all" depends="pdf, html, htmlhelp"/>
</project>