| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!DOCTYPE html |
| 3 |
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 4 |
<html xml:lang="en-us" lang="en-us"> |
| 5 |
<head> |
| 6 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| 7 |
<meta name="copyright" content="(C) Copyright 2005"/> |
| 8 |
<meta name="DC.rights.owner" content="(C) Copyright 2005"/> |
| 9 |
<meta name="DC.Type" content="concept"/> |
| 10 |
<meta name="DC.Title" content="Writing Ant Build Files DITA-OT"/> |
| 11 |
<meta name="abstract" content="Learning how buildfiles tell Ant what and how to compile."/> |
| 12 |
<meta name="description" content="Learning how buildfiles tell Ant what and how to compile."/> |
| 13 |
<meta name="DC.Relation" scheme="URI" content="../../quickstartguide/chapters/chapter2.html"/> |
| 14 |
<meta name="DC.Relation" scheme="URI" content="about_ant.html"/> |
| 15 |
<meta name="DC.Relation" scheme="URI" content="../../readme/dita-ot_ant_properties.html"/> |
| 16 |
<meta name="DC.Format" content="XHTML"/> |
| 17 |
<meta name="DC.Identifier" content="about_DITAOT-build-files"/> |
| 18 |
<meta name="DC.Language" content="en-us"/> |
| 19 |
<link rel="stylesheet" type="text/css" href="../../css/commonltr.css"/> |
| 20 |
<title>Writing Ant Build Files DITA-OT</title> |
| 21 |
</head> |
| 22 |
<body id="about_DITAOT-build-files"> |
| 23 |
|
| 24 |
|
| 25 |
<h1 class="title topictitle1">Writing Ant Build Files DITA-OT</h1> |
| 26 |
|
| 27 |
|
| 28 |
<div class="body conbody"><p class="shortdesc">Learning how buildfiles tell Ant what and how to compile. |
| 29 |
</p> |
| 30 |
|
| 31 |
<div class="section"><h2 class="title sectiontitle">Customize the Default Ant Script</h2> <p class="p">The sample Ant build scripts provided by the DITA-OT |
| 32 |
may not be adequate to meet the needs of your documentation project. |
| 33 |
This topic describes how to customize the default scripts and write |
| 34 |
your own.</p> |
| 35 |
<p class="p">The |
| 36 |
DITA Open Toolkit contains sample build files for both the DITA-OT |
| 37 |
and sample documentation. Writers new to the toolkit use the <samp class="ph codeph">sample_all.xml</samp> Ant |
| 38 |
build script to create all the sample documents that come with DITA-OT. |
| 39 |
The toolkit also contains build scripts for individual ouput types, |
| 40 |
such as <samp class="ph codeph">sample_pdf.xml</samp>. You can modify just one |
| 41 |
or two Ant properties in these scripts for your own documentation. |
| 42 |
</p> |
| 43 |
<p class="p">Here is the Ant project definition from <samp class="ph codeph">template_pdf.xml</samp>. </p> |
| 44 |
|
| 45 |
<pre class="pre codeblock"><project name="@PROJECT.NAME@_pdf" default="@DELIVERABLE.NAME@2pdf" basedir="."> |
| 46 |
|
| 47 |
<property name="dita.dir" location="${basedir}${file.separator}..${file.separator}.."/> |
| 48 |
|
| 49 |
<target name="@DELIVERABLE.NAME@2pdf"> |
| 50 |
<ant antfile="${dita.dir}${file.separator}build.xml"> |
| 51 |
<property name="args.input" location="@DITA.INPUT@"/> |
| 52 |
<property name="output.dir" location="@OUTPUT.DIR@"/> |
| 53 |
<property name="transtype" value="pdf"/> |
| 54 |
</ant> |
| 55 |
</target> |
| 56 |
|
| 57 |
</project></pre> |
| 58 |
|
| 59 |
<div class="p">You simply change the values of |
| 60 |
the following properties to match the values used in your project: |
| 61 |
<ul class="ul"> |
| 62 |
<li class="li">Project name: The root element in an Ant build file.</li> |
| 63 |
|
| 64 |
<li class="li">Target name: Must be one of the supported DITA-OT transtypes.</li> |
| 65 |
|
| 66 |
</ul> |
| 67 |
However, the toolkit's scripts assume that your input files |
| 68 |
are located in same directory structure used by the DITA-OT samples. |
| 69 |
</div> |
| 70 |
</div> |
| 71 |
|
| 72 |
<div class="section"><h2 class="title sectiontitle">Write Your Own Ant Script</h2> |
| 73 |
|
| 74 |
<p class="p">The default build script may not meet the needs of your project for a range of reasons:</p> |
| 75 |
|
| 76 |
<ul class="ul"> |
| 77 |
<li class="li">You want to add additional Ant properties not used in the sample template, such XSL and |
| 78 |
DTD properties to assist your debugging efforts.</li> |
| 79 |
|
| 80 |
<li class="li">Your content files may not have the same directory structure as the samples.</li> |
| 81 |
|
| 82 |
<li class="li">You want to place the output files in a different directory.</li> |
| 83 |
|
| 84 |
</ul> |
| 85 |
|
| 86 |
<p class="p">You need to cutomize or write your own build file for these use cases. For example, each |
| 87 |
target for this guide's build script uses a separate value for |
| 88 |
<samp class="ph codeph">dita.temp.dir</samp> to assist debugging for a specific output types. </p> |
| 89 |
|
| 90 |
<p class="p">Here is an example Ant script that can be used to produce this document: </p> |
| 91 |
|
| 92 |
<pre class="pre codeblock"><project name="antquickstartguide" default="dita2pdf" basedir="."> |
| 93 |
|
| 94 |
<property environment = "env"/> |
| 95 |
<property name="DITA_DIR" value="${env.DITA_DIR}"/> |
| 96 |
<property name="args.logdir" value="../logs"/> |
| 97 |
<property name="dita.input.valfile" value="../QSG.ditaval"/> |
| 98 |
|
| 99 |
<property name="dita.extname" value=".dita"/> |
| 100 |
<property name="args.fo.img.ext" value=".gif"/> |
| 101 |
|
| 102 |
<property name="output.dir" location="../output"/> |
| 103 |
<property name="outdir" location ="../output"/> |
| 104 |
<property name="clean.temp" value="no"/> |
| 105 |
|
| 106 |
<property name="args.indexshow" value="no"/> |
| 107 |
|
| 108 |
<target name="dita2pdf"> |
| 109 |
<ant antfile="${DITA_DIR}/build.xml"> |
| 110 |
<property name="transtype" value="pdf"/> |
| 111 |
<property name="args.input" value="../quickstartguide.ditamap"/> |
| 112 |
<property name="dita.temp.dir" value="${outdir}/temp_pdf"/> |
| 113 |
<property name="output.dir" value="${outdir}/pdf"/> |
| 114 |
<property name="outer.control" value="quiet"/> |
| 115 |
<property name="clean.temp" value="yes"/> |
| 116 |
</ant> |
| 117 |
</target> |
| 118 |
|
| 119 |
</project></pre> |
| 120 |
|
| 121 |
<p class="p"><a class="xref" href="../../readme/dita-ot_ant_properties.html" title="Reference list of DITA-specific Ant properties.">Ant argument properties for DITA-OT</a> contains a list of the most basic |
| 122 |
Ant properties used by DITA-OT. Use these properties to customize your document's build |
| 123 |
script for your needs.</p> |
| 124 |
|
| 125 |
|
| 126 |
</div> |
| 127 |
|
| 128 |
</div> |
| 129 |
|
| 130 |
<div class="related-links"> |
| 131 |
<div class="familylinks"> |
| 132 |
<div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../../quickstartguide/chapters/chapter2.html" title="Learn how to run DITA-OT to generate published output documents.">Running DITA Open Toolkit</a></div> |
| 133 |
</div> |
| 134 |
<div class="relinfo relconcepts"><strong>Related concepts</strong><br/> |
| 135 |
<div><a class="link" href="about_ant.html" title="Learning about the blurred line between code and documentation and why technical writers need to learn Ant.">What is Ant?</a></div> |
| 136 |
</div> |
| 137 |
<div class="relinfo relref"><strong>Related reference</strong><br/> |
| 138 |
<div><a class="link" href="../../readme/dita-ot_ant_properties.html" title="Reference list of DITA-specific Ant properties.">Ant argument properties for DITA-OT</a></div> |
| 139 |
</div> |
| 140 |
</div> |
| 141 |
|
| 142 |
</body> |
| 143 |
</html> |