• Views
  • Iteration Report
  • My Iteration Report
  •  
OMERO.clients
  • Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • Last Change
  • Annotate
  • Revision Log

root/tags/OMERO.insight_3_Beta1/build/lib.xml

Revision 3660, 22.9 kB (checked in by jburel, 2 years ago)

added external dependencies

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2
3<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 * Library of custom Ant tasks.
5 *
6 * DEPENDENCIES
7 * This section lists all the libraries that need to be available to Ant in
8 * order to run the various targets of our build.  These are both the libs
9 * listed in the 'EXTERNAL DEPENDENCIES' sections of the tasks defined within
10 * this file and other additional libs required by some Ant optional tasks
11 * used within child build files.  Here's the list then (files are kept under
12 * the tools directory):
13 *
14 *  + junit-3.8.1.jar: The JUnit Testing Framework
15 *        (http://www.junit.org/).  Version: 3.8.1.
16 *  + xalan-2.6.0.jar: The Xalan-J XSLT library from Apache
17 *        (http://xml.apache.org/xalan-j/).  Version: 2_6_0.
18 *  + jarbundler-1.4.jar: The Jar Bunlder utility to make Mac OS X application
19 *        bundles (http://www.loomcom.com/jarbundler/).  Version: 1.4.
20 *  + bsf-2.3.0-rc1.jar: The Bean Scripting Framework from Jakarta
21 *        (http://jakarta.apache.org/bsf/).  Version: 2.3.0-rc1.
22 *  + rhino-1_5R3.jar: The Rhino JavaScript engine from Mozilla
23 *        (http://www.mozilla.org/rhino/).  Version: 1_5R3.
24 *        (NOTE: Later versions don't work with BSF 2.3.0.)
25 *  + fop-0.20.5.jar: The Formatting Objects Processor (FOP) from the Apache
26 *        XML Project (http://xml.apache.org/fop/).  Version: 0.20.5.
27 *  + avalon-framework-cvs-20020806.jar: The Apache Avalon Framework, bunlded
28 *        with the FOP distribution.  Version: unknown.
29 *  + batik.jar: The Apache Batik SVG Toolkit, bundled wiht the FOP
30 *        distribution.  Version: unknown.
31 *  + xerces-2.6.2.jar: The Apache Xerces Parser
32 *                                      (http://xerces.apache.org/xerces-j/). Version: 2.6.2.
33 *  + xerces-xml-apis-2.6.2.jar. The Apache Xerces Parser
34 *                                      (http://xerces.apache.org/xerces-j/). Version: 2.6.2.
35~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
36<antlib>
37 
38  <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39   * TASK NAME: checkdef
40   *
41   * DESCRIPTION:
42   * Verifies that a given property or reference has been set.
43   * This task checks whether the project contains a definition for the
44   * specified property or reference and makes sure its value is not the
45   * empty string.  If the check fails, the build is failed as well.
46   *
47   * PARAMETERS:
48   *  Attibute  Description                                       Required
49   *  prop      The name of the property to check.                  No
50   *  ref       The name of the reference to check.                 No
51   *
52   * EXTERNAL DEPENDENCIES:
53   *  + bsf-2.3.0-rc1.jar: The Bean Scripting Framework from Jakarta
54   *        (http://jakarta.apache.org/bsf/).  Version: 2.3.0-rc1.
55   *  + rhino-1_5R3.jar: The Rhino JavaScript engine from Mozilla
56   *        (http://www.mozilla.org/rhino/).  Version: 1_5R3.
57   *        (NOTE: Later versions don't work with BSF 2.3.0.)
58  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> 
59  <scriptdef name="checkdef" language="javascript">
60    <attribute name="prop" /> 
61    <attribute name="ref" />
62    <![CDATA[
63   
64      function check(name, value)
65      {
66        if (value != null && (""+value).length != 0) return;
67        throw new Packages.org.apache.tools.ant.BuildException(
68                                                    name+" has not been set.");
69      }
70   
71      var prop = attributes.get("prop"),
72          ref = attributes.get("ref");
73      if (prop != null) check(prop, project.getProperty(prop));
74      if (ref != null) check(ref, project.getReference(ref));
75       
76    ]]> 
77  </scriptdef>
78 
79  <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80   * TASK NAME: checkdup
81   *
82   * DESCRIPTION:
83   * Verifies that no file in @dir has the same name and relative path as
84   * existing files in @targetdir.  As an example consider the files
85   * @dir/some/path/foo.bar and @targetdir/some/path/foo.bar.  This task
86   * works on the entire directory trees.  If the check fails, the build
87   * is failed too.
88   *
89   * PARAMETERS:
90   *  Attibute  Description                                       Required
91   *  dir       The origin directory.                               Yes
92   *  targetdir The directory to compare.                           Yes
93   *
94   * EXTERNAL DEPENDENCIES:
95   *  + bsf-2.3.0-rc1.jar: The Bean Scripting Framework from Jakarta
96   *        (http://jakarta.apache.org/bsf/).  Version: 2.3.0-rc1.
97   *  + rhino-1_5R3.jar: The Rhino JavaScript engine from Mozilla
98   *        (http://www.mozilla.org/rhino/).  Version: 1_5R3.
99   *        (NOTE: Later versions don't work with BSF 2.3.0.)
100  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> 
101  <scriptdef name="checkdup" language="javascript">
102    <attribute name="dir" /> 
103    <attribute name="targetdir" />
104    <![CDATA[
105       
106      var dir = attributes.get("dir"),
107          targetdir = attributes.get("targetdir");   
108      if (dir == null)
109        throw new Packages.org.apache.tools.ant.BuildException(
110                                                  "Undefined dir attribute.");
111      if (targetdir == null)
112        throw new Packages.org.apache.tools.ant.BuildException(
113                                            "Undefined targetdir attribute.");
114
115      var fileset = new Packages.org.apache.tools.ant.types.FileSet(),
116          present = new Packages.org.apache.tools.ant.types.selectors.
117                    PresentSelector(),
118          matchedFiles = ""; 
119      fileset.setProject(project);
120      fileset.setDir(new java.io.File(dir));
121      fileset.addPresent(present);
122      present.setTargetdir(new java.io.File(targetdir));
123 
124      matchedFiles = fileset.toString();
125      if (matchedFiles.length() != 0)
126        throw new Packages.org.apache.tools.ant.BuildException(
127        "Files were found in "+dir+" that have the same name and relative "+
128        "path as existing files in "+targetdir+":\n"+matchedFiles);
129
130    ]]> 
131  </scriptdef>
132 
133  <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134   * TASK NAME: fop
135   *
136   * DESCRIPTION:
137   * Third-party task to create a PDF from an XSL-FO document.
138   * The FOP task comes from http://xml.apache.org/fop/.  See their docs for
139   * parameters and usage.
140   *
141   * EXTERNAL DEPENDENCIES:
142   *  + fop-0.20.5.jar: The FOP jar.  Version: 0.20.5.
143   *  + avalon-framework-cvs-20020806.jar: The Apache Avalon Framework, bundled
144   *        with the FOP distribution.  Version: unknown.
145   *  + batik.jar: The Apache Batik SVG Toolkit, bundled wiht the FOP
146   *        distribution.  Version: unknown.
147   *  + xerces-2.6.2.jar: The Apache Xerces Parser
148   *                                    (http://xerces.apache.org/xerces-j/). Version: 2.6.2.
149   *  + xerces-xml-apis-2.6.2.jar. The Apache Xerces Parser
150   *                                    (http://xerces.apache.org/xerces-j/). Version: 2.6.2.
151  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
152  <taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop" /> 
153 
154  <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
155   * TASK NAME: makexdoc
156   *
157   * DESCRIPTION:
158   * Transforms one XML doc into PDF and multi-page HTML.
159   * This task takes a 'doc.xml' file (in our XML doc format) in a given source
160   * directory and turns it into an AurigaDoc XML doc file.  Then the AurigaDoc
161   * stylesheets are applied to obtain PDF and multi-page HTML docs.
162   * All the generated files are output in the specified destination directory,
163   * which is created new if it doesn't exist already.  The name of the PDF file
164   * is set to 'doc.pdf'.
165   *
166   * NOTE: This task *doesn't* copy the HTML resources (css, images, index
167   * pages, navigation menu) in the destination directory, it only generates
168   * the HTML files.
169   * Moreover the source directory is *assumed* to contain a 'doc.xml' file.
170   * If this doesn't hold true, the task will fail the build when invoked.
171   *
172   * PARAMETERS:
173   *  Attibute  Description                                       Required
174   *  srcdir    A directory containing a 'doc.xml' file in our      Yes
175   *            XML doc format.                               
176   *  destdir   The directory where to output all doc files.        Yes
177   *  auriga    Pathname of the stylesheet to convert the           Yes
178   *            'doc.xml' file into an AurigaDoc file.
179   *  fo        Pathname of the AurigaDoc stylesheet to generate    Yes
180   *            the intermediate XSL-FO file from which we obtain
181   *            the PDF.
182   *  pdfstyle  URL of the XML file that maps the CSS file (used    Yes
183   *            for HTML) into something the AurigaDoc XSL-FO
184   *            stylesheet can digest.  This way, PDF files will
185   *            retain (to some extent) the same HTML style.
186   *  mhtml     Pathname of the AurigaDoc stylesheet to generate    Yes
187   *            the multi-page HTML document.
188   *
189   * EXTERNAL DEPENDENCIES: See fop task.
190  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> 
191  <macrodef name="makexdoc">
192    <attribute name="srcdir" />
193    <attribute name="destdir" />
194    <attribute name="auriga" /> 
195    <attribute name="fo" />
196    <attribute name="pdfstyle" />
197    <attribute name="mhtml" /> 
198    <sequential>
199
200      <!-- Convert our 'doc.xml' file into an AurigaDoc file. -->
201      <xslt style="@{auriga}" in="@{srcdir}/doc.xml" out="@{destdir}/auriga.doc"> 
202        <outputproperty name="method" value="xml" /> 
203      </xslt>
204     
205      <!-- Do PDF. --> 
206      <xslt style="@{fo}" in="@{destdir}/auriga.doc" out="@{destdir}/doc.fo"> 
207        <outputproperty name="method" value="xml" /> 
208        <param name="css-file" expression="@{pdfstyle}" /> 
209      </xslt> 
210      <fop format="application/pdf" 
211           basedir="@{destdir}" 
212           fofile="@{destdir}/doc.fo"
213           outfile="@{destdir}/doc.pdf"
214           messagelevel="warn" /> 
215      <delete file="@{destdir}/doc.fo" />  <!-- Get rid of tmp file. -->
216
217      <!-- Do multi-page HTML. --> 
218      <xslt style="@{mhtml}" 
219            in="@{destdir}/auriga.doc" 
220            out="@{destdir}/index.htm"> 
221        <outputproperty name="method" value="html" />
222        <param name="abs-out-dir" expression="@{destdir}/" />
223        <param name="index-file" expression="index.htm" /> 
224      </xslt>
225     
226      <!-- Done, but get rid of tmp 'auriga.doc' in destdir. -->
227      <delete file="@{destdir}/auriga.doc" />
228    </sequential>
229  </macrodef> 
230 
231  <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
232   * TASK NAME: xdocimg
233   *
234   * DESCRIPTION:
235   * Copies the contents of srcdir/images to destdir/images.
236   *
237   * NOTE: The srcdir should be an xdoc dir (that is, one that contains a
238   * 'doc.xml' file) and is *assumed* to have an 'images' sub-directory.
239   *
240   * PARAMETERS:
241   *  Attibute  Description                                       Required
242   *  srcdir    The origin xdoc directory.                          Yes
243   *  destdir   The destination directory where the xdoc will       Yes
244   *            be output.                         
245   *
246   * EXTERNAL DEPENDENCIES: None.
247  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> 
248  <macrodef name="xdocimg">
249          <attribute name="srcdir" />
250          <attribute name="destdir" />
251          <sequential>   
252      <copy todir="@{destdir}/images" includeemptydirs="no">
253        <fileset dir="@{srcdir}/images" />
254      </copy> 
255          </sequential>
256        </macrodef> 
257 
258  <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
259   * TASK NAME: xdocres
260   *
261   * DESCRIPTION:
262   * Copies all non-image resources needed to complete an xdoc-generated
263   * HTML doc to the specified destdir.
264   *
265   * NOTE: The srcdir should be an xdoc dir (that is, one that contains a
266   * 'doc.xml' file).  If 'doc.xml' is not found, the build will be failed.
267   *
268   * PARAMETERS:
269   *  Attibute  Description                                       Required
270   *  srcdir    The origin xdoc directory.                          Yes
271   *  destdir   The destination directory where the xdoc will       Yes
272   *            be output.                         
273   *  navdir    The directory containing the index pages and the    Yes
274   *            menu code to add to the generated HTML files.
275   *  cssfile   The CSS stylesheet to link to the generated HTML    Yes
276   *            files.
277   *
278   * EXTERNAL DEPENDENCIES: None.
279  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> 
280  <macrodef name="xdocres">
281    <attribute name="srcdir" />
282    <attribute name="destdir" />
283    <attribute name="navdir" /> 
284    <attribute name="cssfile" /> 
285    <sequential>
286      <copy todir="@{destdir}/menu" file="@{srcdir}/doc.xml" />
287      <copy todir="@{destdir}/menu" file="@{navdir}/nav-menu.jar" />
288      <copy todir="@{destdir}">
289        <fileset dir="@{navdir}/html" />
290      </copy> 
291      <copy todir="@{destdir}/styles" file="@{cssfile}" /> 
292    </sequential>
293  </macrodef>   
294 
295  <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
296   * TASK NAME: xdoc
297   *
298   * DESCRIPTION:
299   * Generates PDF and HTML/DHTML docs from every xdoc directory found in the
300   * specified base source directory.
301   * This task scans the base source directory tree looking for directories
302   * containing a 'doc.xml' file.  Each of those directories is taken to be an
303   * xdoc directory, that is one containing an XML/HTML set of files that have
304   * to be transformed into PDF and HTML.  This task then runs the
305   * makexdoc, xdocimg, and xdocres tasks on each xdoc directory to produce a
306   * complete documentation set under the specified base destination directory.
307   * Relative directory structure is preserved; for example the output documents
308   * generated from srcdir/an/xdoc/dir would be put under destdir/an/xdoc/dir.
309   *
310   * PARAMETERS:
311   *  Attibute  Description                                       Required
312   *  srcdir    The base source directory.                          Yes                               
313   *  destdir   The base output directory.                          Yes
314   *  auriga    Pathname of the stylesheet to convert the           Yes
315   *            'doc.xml' file into an AurigaDoc file.
316   *  fo        Pathname of the AurigaDoc stylesheet to generate    Yes
317   *            the intermediate XSL-FO file from which we obtain
318   *            the PDF.
319   *  pdfstyle  Pathname of the XML file that maps the CSS file     Yes
320   *            (used for HTML) into something the AurigaDoc
321   *            XSL-FO stylesheet can digest.  This way, PDF files
322   *            will retain (to some extent) the same HTML style.
323   *            If an xdoc directory contains a 'style.xml' file,
324   *            then that file will be used instead.
325   *  mhtml     Pathname of the AurigaDoc stylesheet to generate    Yes
326   *            the multi-page HTML document.
327   *  navdir    The directory containing the index pages and the    Yes
328   *            menu code to add to the generated HTML files.
329   *  cssfile   The CSS stylesheet to link to the generated HTML/   Yes
330   *            DHTML files.  If an xdoc directory contains a
331   *            'style.css' file, then that file will be used
332   *            instead.
333   *
334   * EXTERNAL DEPENDENCIES:
335   *  + bsf-2.3.0-rc1.jar: The Bean Scripting Framework from Jakarta
336   *        (http://jakarta.apache.org/bsf/).  Version: 2.3.0-rc1.
337   *  + rhino-1_5R3.jar: The Rhino JavaScript engine from Mozilla
338   *        (http://www.mozilla.org/rhino/).  Version: 1_5R3.
339   *        (NOTE: Later versions don't work with BSF 2.3.0.)
340  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> 
341  <scriptdef name="xdoc" language="javascript">
342          <attribute name="srcdir" />
343          <attribute name="destdir" />
344          <attribute name="auriga" /> 
345          <attribute name="fo" />
346          <attribute name="pdfstyle" />
347          <attribute name="mhtml" /> 
348    <attribute name="navdir" /> 
349    <attribute name="cssfile" /> 
350    <![CDATA[
351
352      //Utility to convert a file pathname to a URL string.   
353      function fileToURL(file)
354      {
355        try {
356          var f = new java.io.File(file);       
357          return f.toURL().toString();
358        } catch (exc) {
359          throw new Packages.org.apache.tools.ant.BuildException(
360                                      "Can't convert file to URL: "+file+".");
361        }
362      }
363
364      //Sets the specified attributes in the task's RuntimeConfigurable.
365      //(Because the tasks we use are defined through macrodefs, we don't
366      //get explicit methods like setSrcDir/setAuriga/etc. and so we have
367      //to use generic attributes.)
368      function configureTask(taskCfg, attrNames)
369      {
370        for (var i = 0, value = ""; i < attrNames.length; ++i) {
371          value = attributes.get(attrNames[i]);
372          if (value == null)
373            throw new Packages.org.apache.tools.ant.BuildException(
374                                   "Undefined "+attrNames[i]+" attribute.");
375          taskCfg.setAttribute(attrNames[i], value);
376        }
377      }
378 
379      //Knows how to generate a complete set of docs (PDF, HTML, etc.) from
380      //a source xdoc dir. (That is, one containing a 'doc.xml' file.)
381      //Every instance works on a specific source/destination dir and,
382      //optionally, on custom pdf/css style files if found in the source dir;
383      //all other input attributes (auriga, fo, etc.) stay the same across
384      //different instances.  The run method generates all the docs.  Keep in
385      //mind that before calling run(), the source directory has to be set to
386      //the absolute path of an xdoc dir.  Also the destination dir has to be
387      //set to the absolute path of the dir where to output the docs.
388      function XDoc()
389      {
390        this.task = project.createTask("makexdoc");
391        var taskCfg = this.task.getRuntimeConfigurableWrapper();
392        var attrNames = ["srcdir", "destdir", "auriga", "fo", "pdfstyle",
393                          "mhtml"];
394        configureTask(taskCfg, attrNames);
395        //Re-set the pdfstyle attribute, as we get a pathname in.
396        taskCfg.setAttribute("pdfstyle", fileToURL(attributes.get("pdfstyle")));       
397       
398        this.imgTask = project.createTask("xdocimg");
399        taskCfg = this.imgTask.getRuntimeConfigurableWrapper();
400        attrNames = ["srcdir", "destdir"];
401        configureTask(taskCfg, attrNames);
402 
403                          this.resTask = project.createTask("xdocres");
404                          taskCfg = this.resTask.getRuntimeConfigurableWrapper();
405                          attrNames = ["srcdir", "destdir", "navdir", "cssfile"];
406                          configureTask(taskCfg, attrNames);
407       
408        this.srcDir = null;
409      }
410                  XDoc.prototype.setSrcDir = function (dir)  //Must be an absolute path.
411                  {
412                    var taskCfg = this.task.getRuntimeConfigurableWrapper();
413                    taskCfg.setAttribute("srcdir", dir);
414                    taskCfg = this.imgTask.getRuntimeConfigurableWrapper();
415                    taskCfg.setAttribute("srcdir", dir);
416        taskCfg = this.resTask.getRuntimeConfigurableWrapper();
417        taskCfg.setAttribute("srcdir", dir);
418        this.srcDir = dir;
419                  }
420      XDoc.prototype.setDestDir = function (dir)  //Must be an absolute path.
421      {
422        var taskCfg = this.task.getRuntimeConfigurableWrapper();
423        taskCfg.setAttribute("destdir", dir);
424        taskCfg = this.imgTask.getRuntimeConfigurableWrapper();
425        taskCfg.setAttribute("destdir", dir);
426        taskCfg = this.resTask.getRuntimeConfigurableWrapper();
427        taskCfg.setAttribute("destdir", dir); 
428      }
429      XDoc.prototype.setPDFStyle = function (file)  //Must be an absolute path.
430      {
431        var taskCfg = this.task.getRuntimeConfigurableWrapper();
432        taskCfg.setAttribute("pdfstyle", fileToURL(file));
433      }
434      XDoc.prototype.setCSSFile = function (file)  //Must be an absolute path.
435      {
436        var taskCfg = this.resTask.getRuntimeConfigurableWrapper();
437        taskCfg.setAttribute("cssfile", file);   
438      }
439      XDoc.prototype.run = function ()
440      {   
441   
442        //Run xdocres to copy resources in destdir.  If srcdir contains a
443        //custom 'style.css' file, then use it.  Otherwise default to the
444        //one specified by the cssfile input attribute.
445        var customCSSFile = new java.io.File(this.srcDir, "style.css");
446        if (customCSSFile.exists() && customCSSFile.isFile())
447          this.setCSSFile(customCSSFile.toString());
448        this.resTask.perform(); 
449       
450        //If there's an images dir, then run the xdocimg task to copy all
451        //images in destdir.
452        var imagesDir = new java.io.File(this.srcDir, "images");
453        if (imagesDir.exists() && imagesDir.isDirectory())
454          this.imgTask.perform();
455
456        //Run makexdoc on srcdir and destdir.  If srcdir contains a custom
457        //'style.xml' file, then use it.  Otherwise default to the one
458        //specified by the pdfstyle input attribute.
459        var customPDFStyle = new java.io.File(this.srcDir, "style.xml");
460        if (customPDFStyle.exists() && customPDFStyle.isFile())
461          this.setPDFStyle(customPDFStyle.toString());
462        this.task.perform();
463      } 
464 
465      //Finds all xdoc dirs within the specified base dir.
466      //Returned paths will be relative to the base dir.  If the base dir
467      //is a xdoc dir too (that is, contains a 'doc.xml' file), then one
468      //of the returned paths will be the empty string.
469      function getXdocDirs(baseDir)
470      {
471        var scanner = new Packages.org.apache.tools.ant.DirectoryScanner();
472        scanner.setBasedir(baseDir);
473        scanner.setIncludes(["**/doc.xml"]);
474        scanner.scan();
475        var xdocFiles = scanner.getIncludedFiles();
476        var dirs = new Array(xdocFiles.length);
477        for (var i = 0, str=""; i < xdocFiles.length; ++i) {
478          str = ""+xdocFiles[i];
479          dirs[i] = str.substring(0, str.length-8); 
480          //The above will strip "/doc.xml" out of dir[i]. 
481          //If dir[i]="doc.xml", then "" is returned.
482        }
483        return dirs;
484      } 
485 
486      //Run an XDoc for each xdoc dir found in the base source dir.
487      var baseSrcDir = attributes.get("srcdir"),
488          baseDestDir = attributes.get("destdir");
489      var matchingDirs = getXdocDirs(baseSrcDir), xdoc = null,
490          sep = ""+java.io.File.separator;
491      for (var i = 0; i < matchingDirs.length; ++i) {
492        xdoc = new XDoc();
493        xdoc.setSrcDir(baseSrcDir+sep+matchingDirs[i]);
494        xdoc.setDestDir(baseDestDir+sep+matchingDirs[i]);
495        xdoc.run();
496      }
497     
498    ]]> 
499  </scriptdef>
500 
501  <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
502   * TASK NAME: jarbundler
503   *
504   * DESCRIPTION:
505   * Third-party task to create a Mac OS X distribution bundle.
506   * The Jar Bundler task comes from http://www.loomcom.com/jarbundler/. 
507   * See their docs for parameters and usage.
508   *
509   * EXTERNAL DEPENDENCIES:
510   *  + jarbundler-1.4.jar: The Jar Bundler jar.  Version: 1.4.
511  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> 
512  <taskdef name="jarbundler"
513           classname="com.loomcom.ant.tasks.jarbundler.JarBundler" />
514
515</antlib>
Note: See TracBrowser for help on using the browser.

Download in other formats:

  • Plain Text
  • Original Format

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/