| 1 | <html lang="en-us"> |
| 2 | |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Language" content="en-us"> |
| 5 | <title>Antclipse Task</title> |
| 6 | </head> |
| 7 | |
| 8 | <body> |
| 9 | |
| 10 | <h2>Antclipse Task</h2> |
| 11 | <p>Creator: Adrian Spinei (<a href="mailto:[email protected]">[email protected]</a>)</p> |
| 12 | <h3>Description</h3> |
| 13 | <p>UNSTABLE CODE, some parameters are supposed to change</p> |
| 14 | <p>This task creates classpaths or filesets based on your current .classpath file generated by Eclipse</p> |
| 15 | <p>Classpath creation is simple, it just produces a classpath that you can subsequently retrieve by its refid. |
| 16 | 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 |
| 17 | output file. Which is not necessarily bad, since the content of each directory usually serves a different purpose. Now, in order to avoit conflicting |
| 18 | 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 |
| 19 | <b>bin/classes</b> and the idcontainer is default, the task will create a fileset with refid "<b>antclipse-bin/classes</b>". The fileset will include all the files contained in |
| 20 | your output directory, but without the trailing path bin/classes (as you usually strip it when creating the distribution jar).</p> |
| 21 | <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>. |
| 22 | 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>" |
| 23 | 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> |
| 24 | |
| 25 | <h3>Parameters</h3> |
| 26 | <table border="1" cellpadding="2" cellspacing="0"> |
| 27 | <tr> |
| 28 | <td>Attribute</td> |
| 29 | <td>Description</td> |
| 30 | |
| 31 | <td>Required</td> |
| 32 | </tr> |
| 33 | <tr> |
| 34 | <td><em>produce</em></td> |
| 35 | <td>This parameter tells the task wether to produce a "classpath" or a "fileset" (multiple filesets, as a matter of fact).</td> |
| 36 | <td>Yes</td> |
| 37 | </tr> |
| 38 | |
| 39 | <tr> |
| 40 | <td><em>idcontainer</em></td> |
| 41 | <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> |
| 42 | <td>No</td> |
| 43 | </tr> |
| 44 | <tr> |
| 45 | <td><em>includelibs</em></td> |
| 46 | |
| 47 | <td>Boolean, whether to include or not the project libraries. Default is true.</td> |
| 48 | <td>No</td> |
| 49 | </tr> |
| 50 | <tr> |
| 51 | <td><em>includesource</em></td> |
| 52 | <td>Boolean, whether to include or not the project source directories. Default is false.</td> |
| 53 | <td>No</td> |
| 54 | |
| 55 | </tr> |
| 56 | <tr> |
| 57 | <td><em>includeoutput</em></td> |
| 58 | <td>Boolean, whether to include or not the project output directories. Default is false.</td> |
| 59 | <td>No</td> |
| 60 | </tr> |
| 61 | <tr> |
| 62 | |
| 63 | <td><em>verbose</em></td> |
| 64 | <td>Boolean, telling the app to throw some info during each step. Default is false.</td> |
| 65 | <td>No</td> |
| 66 | </tr> |
| 67 | <tr> |
| 68 | <td><em>includes</em></td> |
| 69 | <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> |
| 70 | |
| 71 | <td>No</td> |
| 72 | </tr> |
| 73 | <tr> |
| 74 | <td><em>excludes</em></td> |
| 75 | <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> |
| 76 | <td>No</td> |
| 77 | </tr> |
| 78 | |
| 79 | </table> |
| 80 | |
| 81 | <h3>Parameters specified as nested elements</h3> |
| 82 | <p>None at the moment.</p> |
| 83 | |
| 84 | <h3>TODOS</h3> |
| 85 | <ul> |
| 86 | <li>make "includes" and "excludes" to work on the source and output filesets</li> |
| 87 | <li>maybe find an elegant solution to this multiple fileset/directories issues</li> |
| 88 | <li>work with files referenced in other projects</li> |
| 89 | </ul> |
| 90 | |
| 91 | <h3>Example</h3> |
| 92 | |
| 93 | <p>This is a pretty self-explanatory Ant script, just follow the comments.</p> |
| 94 | |
| 95 | <pre> |
| 96 | <span style='color:#7f0055; '><?</span><span style='color:#7f0055; '>xml</span> <span style='color:#7f0055; '>version</span>="1.0"<span style='color:#7f0055; '>?></span> |
| 97 | <span style='color:#7f0055; '><</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> |
| 98 | <span style='color:#7f0055; '><</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> |
| 99 | <span style='color:#7f0055; '><</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> |
| 100 | <span style='color:#3f7f59; '><!--</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> |
| 101 | <span style='color:#7f0055; '><</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> |
| 102 | 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> |
| 103 | <span style='color:#7f0055; '></</span><span style='color:#7f0055; font-weight:bold; '>target</span><span style='color:#7f0055; '>></span> |
| 104 | <span style='color:#7f0055; '><</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> |
| 105 | <span style='color:#3f7f59; '><!--</span><span style='color:#3f7f59; '> creates a fileset for each source directory, called ecl2-*source-dir-name*/ </span><span style='color:#3f7f59; '>--></span> |
| 106 | <span style='color:#7f0055; '><</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> |
| 107 | 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> |
| 108 | <span style='color:#7f0055; '></</span><span style='color:#7f0055; font-weight:bold; '>target</span><span style='color:#7f0055; '>></span> |
| 109 | <span style='color:#7f0055; '><</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> |
| 110 | <span style='color:#3f7f59; '><!--</span><span style='color:#3f7f59; '> creates a fileset sontaining all your project libs called ecl3/ </span><span style='color:#3f7f59; '>--></span> |
| 111 | <span style='color:#7f0055; '><</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> |
| 112 | <span style='color:#7f0055; '></</span><span style='color:#7f0055; font-weight:bold; '>target</span><span style='color:#7f0055; '>></span> |
| 113 | <span style='color:#7f0055; '><</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> |
| 114 | <span style='color:#3f7f59; '><!--</span><span style='color:#3f7f59; '> creates a fileset sontaining all your project libs called ecl3/ </span><span style='color:#3f7f59; '>--></span> |
| 115 | <span style='color:#7f0055; '><</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> |
| 116 | <span style='color:#7f0055; '></</span><span style='color:#7f0055; font-weight:bold; '>target</span><span style='color:#7f0055; '>></span> |
| 117 | <span style='color:#7f0055; '><</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> |
| 118 | <span style='color:#7f0055; '><</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> |
| 119 | <span style='color:#7f0055; '><</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> |
| 120 | <span style='color:#3f7f59; '><!--</span><span style='color:#3f7f59; '> makes a jar file with the content of the output directory </span><span style='color:#3f7f59; '>--></span> |
| 121 | <span style='color:#7f0055; '><</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; '><</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; '></</span><span style='color:#7f0055; font-weight:bold; '>zip</span><span style='color:#7f0055; '>></span> |
| 122 | <span style='color:#3f7f59; '><!--</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> |
| 123 | <span style='color:#7f0055; '><</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; '><</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; '></</span><span style='color:#7f0055; font-weight:bold; '>zip</span><span style='color:#7f0055; '>></span> |
| 124 | <span style='color:#3f7f59; '><!--</span><span style='color:#3f7f59; '> makes a big zip file with all your project libraries </span><span style='color:#3f7f59; '>--></span> |
| 125 | <span style='color:#7f0055; '><</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; '><</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; '></</span><span style='color:#7f0055; font-weight:bold; '>zip</span><span style='color:#7f0055; '>></span> |
| 126 | <span style='color:#3f7f59; '><!--</span><span style='color:#3f7f59; '> imports the classpath into a property then echoes the property </span><span style='color:#3f7f59; '>--></span> |
| 127 | <span style='color:#7f0055; '><</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> |
| 128 | <span style='color:#7f0055; '><</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; '></</span><span style='color:#7f0055; font-weight:bold; '>echo</span><span style='color:#7f0055; '>></span> |
| 129 | <span style='color:#7f0055; '></</span><span style='color:#7f0055; font-weight:bold; '>target</span><span style='color:#7f0055; '>></span> |
| 130 | <span style='color:#7f0055; '></</span><span style='color:#7f0055; font-weight:bold; '>project</span><span style='color:#7f0055; '>></span> |
| 131 | </pre> |
| 132 | |
| 133 | <hr> |
| 134 | <p align="center">Copyright © 2002-2003 Ant-Contrib Project. All |
| 135 | rights Reserved.</p> |
| 136 | |
| 137 | </body> |
| 138 | </html> |
| 139 |