Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > 19826efc07ba2a4745cb9bf8f6723e88 > files > 6

ant-contrib-1.0-0.14.b3.mga5.noarch.rpm

<html lang="en-us">

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Antclipse Task</title>
</head>

<body>

<h2>Antclipse Task</h2>
<p>Creator: Adrian Spinei (<a href="mailto:aspinei@myrealbox.com">aspinei@myrealbox.com</a>)</p>
<h3>Description</h3>
<p>UNSTABLE CODE, some parameters are supposed to change</p>
<p>This task creates classpaths or filesets based on your current .classpath file generated by Eclipse</p>
<p>Classpath creation is simple, it just produces a classpath that you can subsequently retrieve by its refid.
The filesets are a little trickier, because the task is producing a fileset per directory in the case of sources and another separate fileset for the
output file. Which is not necessarily bad, since the content of each directory usually serves a different purpose. Now, in order to avoit conflicting
refids each fileset has a name composed by the idcontainer, followed by a dash and postfixed by the path. Supposing that your output path is
<b>bin/classes</b> and the idcontainer is default, the task will create a fileset with refid &quot;<b>antclipse-bin/classes</b>&quot;. The fileset will include all the files contained in
your output directory, but without the trailing path bin/classes (as you usually strip it when creating the distribution jar).</p>
<p>If you have two source directories, called src and test, you'll be provided with two filesets, with refids like <b>antclipse-src<b> and </b>antclipse-test</b>.
However, you don't have to code manually the path since some properties are created as a "byproduct" each time you execute the task. Their name is "<b>idref</b>"
postfixed by "<b>outpath</b>" and "<b>srcpath</b>" (in the case of the source, you'll find the location of the first source directory).</p>

<h3>Parameters</h3>
<table  border="1" cellpadding="2" cellspacing="0">
  <tr>
    <td>Attribute</td>
    <td>Description</td>

    <td>Required</td>
  </tr>
  <tr>
    <td><em>produce</em></td>
    <td>This parameter tells the task wether to produce a "classpath" or a "fileset" (multiple filesets, as a matter of fact).</td>
    <td>Yes</td>
  </tr>

  <tr>
    <td><em>idcontainer</em></td>
    <td>The refid which will serve to identify the deliverables. When multiple filesets are produces, their refid is a concatenation between this value and something else (usually obtained from a path). Default "antclipse"</td>
    <td>No</td>
  </tr>
  <tr>
    <td><em>includelibs</em></td>

    <td>Boolean, whether to include or not the project libraries. Default is true.</td>
    <td>No</td>
  </tr>
  <tr>
    <td><em>includesource</em></td>
    <td>Boolean, whether to include or not the project source directories. Default is false.</td>
    <td>No</td>

  </tr>
  <tr>
    <td><em>includeoutput</em></td>
    <td>Boolean, whether to include or not the project output directories. Default is false.</td>
    <td>No</td>
  </tr>
  <tr>

    <td><em>verbose</em></td>
    <td>Boolean, telling the app to throw some info during each step. Default is false.</td>
    <td>No</td>
  </tr>
  <tr>
    <td><em>includes</em></td>
    <td>A regexp for files to include. It is taken into account only when producing a classpath, doesn't work on source or output files. It is a real regexp, not a "*" expression.</td>

    <td>No</td>
  </tr>
  <tr>
    <td><em>excludes</em></td>
    <td>A regexp for files to exclude. It is taken into account only when producing a classpath, doesn't work on source or output files. It is a real regexp, not a "*" expression.</td>
    <td>No</td>
  </tr>

</table>

<h3>Parameters specified as nested elements</h3>
<p>None at the moment.</p>

<h3>TODOS</h3>
<ul>
<li>make "includes" and "excludes" to work on the source and output filesets</li>
<li>maybe find an elegant solution to this multiple fileset/directories issues</li>
<li>work with files referenced in other projects</li>
</ul>

<h3>Example</h3>

<p>This is a pretty self-explanatory Ant script, just follow the comments.</p>

<pre>
<span style='color:#7f0055; '>&lt;?</span><span style='color:#7f0055; '>xml</span> <span style='color:#7f0055; '>version</span>="1.0"<span style='color:#7f0055; '>?></span>
<span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>project</span> default=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>compile</span><span style='color:#2a00ff; '>"</span> name=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>test</span><span style='color:#2a00ff; '>"</span> basedir=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>.</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>></span>
<span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>taskdef</span> name=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>antclipse</span><span style='color:#2a00ff; '>"</span> classname=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>net.sf.antcontrib.antclipse.ClassPathTask</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>/></span>
<span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>target</span> name=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>make.fs.output</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>></span>
	<span style='color:#3f7f59; '>&lt;!--</span><span style='color:#3f7f59; '> creates a fileset including all the files from the output directory, called ecl1-bin if your binary directory is bin/ </span><span style='color:#3f7f59; '>--></span>
	<span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; '>antclipse</span> produce=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>fileset</span><span style='color:#2a00ff; '>"</span> idcontainer=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>ecl1</span><span style='color:#2a00ff; '>"</span> includeoutput=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>true</span><span style='color:#2a00ff; '>"</span> includesource=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>false</span><span style='color:#2a00ff; '>"</span>
	includelibs=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>false</span><span style='color:#2a00ff; '>"</span> verbose=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>true</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>/></span>
<span style='color:#7f0055; '>&lt;/</span><span style='color:#7f0055; font-weight:bold; '>target</span><span style='color:#7f0055; '>></span>
<span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>target</span> name=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>make.fs.sources</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>></span>
	<span style='color:#3f7f59; '>&lt;!--</span><span style='color:#3f7f59; '> creates a fileset for each source directory, called ecl2-*source-dir-name*/ </span><span style='color:#3f7f59; '>--></span>
	<span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; '>antclipse</span> produce=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>fileset</span><span style='color:#2a00ff; '>"</span> idcontainer=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>ecl2</span><span style='color:#2a00ff; '>"</span> includeoutput=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>false</span><span style='color:#2a00ff; '>"</span> includesource=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>true</span><span style='color:#2a00ff; '>"</span>
	includelibs=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>false</span><span style='color:#2a00ff; '>"</span> verbose=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>true</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>/></span>
<span style='color:#7f0055; '>&lt;/</span><span style='color:#7f0055; font-weight:bold; '>target</span><span style='color:#7f0055; '>></span>
<span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>target</span> name=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>make.fs.libs</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>></span>
	<span style='color:#3f7f59; '>&lt;!--</span><span style='color:#3f7f59; '> creates a fileset sontaining all your project libs called ecl3/ </span><span style='color:#3f7f59; '>--></span>
	<span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; '>antclipse</span> produce=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>fileset</span><span style='color:#2a00ff; '>"</span> idcontainer=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>ecl3</span><span style='color:#2a00ff; '>"</span> verbose=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>true</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>/></span>
<span style='color:#7f0055; '>&lt;/</span><span style='color:#7f0055; font-weight:bold; '>target</span><span style='color:#7f0055; '>></span>
<span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>target</span> name=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>make.cp</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>></span>
	<span style='color:#3f7f59; '>&lt;!--</span><span style='color:#3f7f59; '> creates a fileset sontaining all your project libs called ecl3/ </span><span style='color:#3f7f59; '>--></span>
	<span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; '>antclipse</span> produce=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>classpath</span><span style='color:#2a00ff; '>"</span> idcontainer=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>eclp</span><span style='color:#2a00ff; '>"</span> verbose=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>true</span><span style='color:#2a00ff; '>"</span> includeoutput=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>true</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>/></span>
<span style='color:#7f0055; '>&lt;/</span><span style='color:#7f0055; font-weight:bold; '>target</span><span style='color:#7f0055; '>></span>
<span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>target</span> name=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>compile</span><span style='color:#2a00ff; '>"</span> depends=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>make.fs.libs, make.fs.output, make.fs.sources, make.cp</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>></span>
    <span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>echo</span> message=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>The output path is $</span><span style='color:#2a00ff; '>{ecl1outpath}</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>/></span>
    <span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>echo</span> message=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>The source path is $</span><span style='color:#2a00ff; '>{ecl2srcpath}</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>/></span>
    <span style='color:#3f7f59; '>&lt;!--</span><span style='color:#3f7f59; '> makes a jar file with the content of the output directory </span><span style='color:#3f7f59; '>--></span>
	<span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>zip</span> destfile=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>out.jar</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>></span><span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>fileset</span> refid=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>ecl1-${</span><span style='color:#2a00ff; '>ecl1outpath}</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>/></span><span style='color:#7f0055; '>&lt;/</span><span style='color:#7f0055; font-weight:bold; '>zip</span><span style='color:#7f0055; '>></span>
	<span style='color:#3f7f59; '>&lt;!--</span><span style='color:#3f7f59; '> makes a zip file with all your sources (supposing you have only source directory) </span><span style='color:#3f7f59; '>--></span>
	 <span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>zip</span> destfile=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>src.zip</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>></span><span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>fileset</span> refid=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>ecl2-${</span><span style='color:#2a00ff; '>ecl2srcpath}</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>/></span><span style='color:#7f0055; '>&lt;/</span><span style='color:#7f0055; font-weight:bold; '>zip</span><span style='color:#7f0055; '>></span>
	<span style='color:#3f7f59; '>&lt;!--</span><span style='color:#3f7f59; '> makes a big zip file with all your project libraries </span><span style='color:#3f7f59; '>--></span>
	 <span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>zip</span> destfile=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>libs.zip</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>></span><span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>fileset</span> refid=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>ecl3</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>/></span><span style='color:#7f0055; '>&lt;/</span><span style='color:#7f0055; font-weight:bold; '>zip</span><span style='color:#7f0055; '>></span>
	 <span style='color:#3f7f59; '>&lt;!--</span><span style='color:#3f7f59; '> imports the classpath into a property then echoes the property </span><span style='color:#3f7f59; '>--></span>
	 <span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>property</span> name=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>cpcontent</span><span style='color:#2a00ff; '>"</span> refid=<span style='color:#2a00ff; '>"</span><span style='color:#2a00ff; '>eclp</span><span style='color:#2a00ff; '>"</span><span style='color:#7f0055; '>/></span>
	<span style='color:#7f0055; '>&lt;</span><span style='color:#7f0055; font-weight:bold; '>echo</span><span style='color:#7f0055; '>></span>The newly created classpath is ${cpcontent}<span style='color:#7f0055; '>&lt;/</span><span style='color:#7f0055; font-weight:bold; '>echo</span><span style='color:#7f0055; '>></span>
<span style='color:#7f0055; '>&lt;/</span><span style='color:#7f0055; font-weight:bold; '>target</span><span style='color:#7f0055; '>></span>
<span style='color:#7f0055; '>&lt;/</span><span style='color:#7f0055; font-weight:bold; '>project</span><span style='color:#7f0055; '>></span>
</pre>

<hr>
    <p align="center">Copyright &copy; 2002-2003 Ant-Contrib Project. All
    rights Reserved.</p>

</body>
</html>