VirtualBox

source: vbox/trunk/src/libs/dita-ot-1.8.5/docsrc/readme/creating-an-ant-build-script.dita@ 99012

Last change on this file since 99012 was 98584, checked in by vboxsync, 2 years ago

Docs: bugref:10302. Setting svn properties of DITA-OT library.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.9 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
3<task id="creating-an-ant-build-script">
4 <title>Creating an Ant build script</title>
5 <shortdesc>Instead of typing the DITA-OT parameters at the command prompt, you might want to
6 create an Ant build script that contains all of the parameters.</shortdesc>
7 <taskbody>
8 <steps>
9 <step>
10 <cmd>Create an XML file that contains the following content:</cmd>
11 <info>
12 <codeblock>&lt;?xml version="1.0" encoding="UTF-8" ?>
13&lt;project name="@project-name@" default="@default-target@" basedir=".">
14
15 &lt;property name="dita.dir" location="@path-to-DITA-OT@"/>
16
17 &lt;target name="@target-name@">
18 &lt;ant antfile="${dita.dir}${file.separator}build.xml">
19 &lt;property name="args.input" value="@DITA-input@"/>
20 &lt;property name="transtype" value="xhtml"/>
21 &lt;/ant>
22 &lt;/target>
23
24&lt;/project></codeblock>
25 </info>
26 <info>You will replace the placeholder content (indicated by the @ signs) with
27 content applicable to your environment.</info>
28 </step>
29 <step>
30 <cmd>Specify project information:</cmd>
31 <substeps>
32 <substep>
33 <cmd>Set the value of the @name attribute to X.<draft-comment
34 author="Kristen James Eberlein" time="11 August 2012">What does X
35 need to be? Does it really matter? I tend to set this attribute to
36 the string that I use for the name of the Ant
37 script.</draft-comment></cmd>
38 </substep>
39 <substep>
40 <cmd>Set the value of the @default attribute to the name of a target in the
41 build script.</cmd>
42 <info>If the build script is invoked without specifying a target, this
43 target will be run.</info>
44 </substep>
45 </substeps>
46 </step>
47 <step>
48 <cmd>Set the value of the <parmname>dita.dir</parmname> property to the location of
49 the DITA-OT.</cmd>
50 <info>This can be a fully qualified path, or you can specify it relative to the
51 location of the Ant build script that you are writing. </info>
52 </step>
53 <step>
54 <cmd>Create the Ant target:</cmd>
55 <substeps>
56 <substep>
57 <cmd>Set the value of the @name attribute.</cmd>
58 </substep>
59 <substep>
60 <cmd>Specify the value for the <parmname>args.input</parmname>
61 property.</cmd>
62 </substep>
63 <substep>
64 <cmd>Specify the value of the <parmname>transtype</parmname> property.</cmd>
65 </substep>
66 </substeps>
67 </step>
68 <step>
69 <cmd>Save the build script.</cmd>
70 </step>
71 </steps>
72 <example>
73 <p>The following Ant build script generates CHM and PDF output for the
74 <filepath>userguide.ditamap</filepath>
75 file.<codeblock>&lt;?xml version="1.0" encoding="UTF-8" ?>
76&lt;project name="Toolkit-documentation" default="all" basedir=".">
77
78 &lt;property name="dita.dir" location="C:\DITA-OT1.6.M5"/>
79
80 &lt;target name="all" description="build CHM and PDF" depends="chm,pdf"/>
81
82 &lt;target name="chm" description="build CHM">
83 &lt;ant antfile="${dita.dir}\build.xml">
84 &lt;property name="args.input" value="C:\dita-ot\src\main\doc\userguide.ditamap"/>
85 &lt;property name="args.gen.task.lbl" value="YES"/>
86 &lt;property name="output.dir" value="C:\kje\temp\out"/>
87 &lt;property name="transtype" value="htmlhelp"/>
88 &lt;/ant>
89 &lt;/target>
90
91 &lt;target name="pdf" description="build PDF">
92 &lt;ant antfile="${dita.dir}\build.xml">
93 &lt;property name="args.input" value="C:\dita-ot\src\main\doc\userguide.ditamap"/>
94 &lt;property name="args.gen.task.lbl" value="YES"/>
95 &lt;property name="args.rellinks" value="nofamily"/>
96 &lt;property name="output.dir" value="C:\kje\temp\out"/>
97 &lt;property name="transtype" value="pdf"/>
98 &lt;/ant>
99 &lt;/target>
100
101&lt;/project></codeblock></p>
102 <p>In addition to the mandatory parameters (<parmname>args.input</parmname> and
103 <parmname>transtype</parmname>), the chm and pdf targets each specify some
104 optional parameters:<ul>
105 <li>The <parmname>args.gen.task.lbl</parmname> property is set to YES, which
106 ensures that headings are automatically generated for the sections of task
107 topics.</li>
108 <li>The <parmname>output.dir</parmname> property specifies where the DITA OT
109 writes the output of the transformations.</li>
110 </ul></p>
111 <p>The pdf target also specifies that related links should be generated in the PDF, but
112 only those links that are created by relationship tables and &lt;link> elements.</p>
113 <p>Finally, the all target simply specifies that both the chm and pdf target should be
114 run.</p>
115 </example>
116 <postreq>Another resource for learning about Ant scripts are the files in the
117 <filepath>samples/ant_samples</filepath> directory. This directory contains the Ant
118 build files used by the demo build, as well as templates that you can use to create Ant
119 scripts.</postreq>
120 </taskbody>
121</task>
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette