You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

actionlist.html 20 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. <html>
  2. <head><title>Ant1.9 Action List</title></head>
  3. <body bgcolor="#ffffff">
  4. <center>
  5. <h1>Ant1.9 Action List</h1>
  6. <h2>Precursor to Ant2</h2>
  7. <i>Peter Donald [<a href="mailto:peter at apache.org">peter at apache.org</a>]</i>
  8. </center>
  9. <div align="center">
  10. <table width="80%"><tr><td>
  11. <blockquote>
  12. <p>
  13. This document aims to contain a list of actions that people can take
  14. to produce Ant1.9. Ant1.9 is a refactoring of the Ant1.x line and a jump
  15. point for Ant2. Some changes will be backported to Ant1.x over time when
  16. they have proven themselves while other changes may only become available
  17. via Ant2.0. Ant1.9 is our melting pot where we can experiment and refactor
  18. without a thought to backwards compatability but only to the "right" way
  19. of doing things.
  20. </p>
  21. </blockquote></td></tr>
  22. </table>
  23. </div>
  24. <h2>Introduction</h2>
  25. <blockquote>
  26. <p>
  27. This document will list a bunch of actions that will guide us in the evolution
  28. of Ant1.x and provide a solid basis on which to launch Ant2.0. Feel free to add to
  29. this list of actions as our vision of Ant2 solidifies. Associated with each action
  30. is a list of victims who have "volunteered" to have a go at the action and a status.
  31. The status just tells us where they are at while the victim column will tell us exactly
  32. who is doing what. It is fine for a group of people to work on a single area.
  33. </p>
  34. <br />
  35. <br />
  36. <br />
  37. <div align="center">
  38. <table cellspacing="2" cellpadding="5" width="80%">
  39. <tr>
  40. <td bgcolor="#eeeeee" align="center">Action</td>
  41. <td bgcolor="#eeeeee" align="center">Victims</td>
  42. <td bgcolor="#eeeeee" align="center">Status</td>
  43. </tr>
  44. <tr>
  45. <td><a href="#vfs">Create a Virtual Filesystem layer</a></td>
  46. <td>None</td>
  47. <td>Not Started</td>
  48. </tr>
  49. <tr>
  50. <td><a href="#naming">Formalize a naming scheme for task attributes/elements</a></td>
  51. <td>None</td>
  52. <td>Not Started</td>
  53. </tr>
  54. <tr>
  55. <td><a href="#selector">Design and implement s Selector API for Filesets and other Itemsets</a></td>
  56. <td>None</td>
  57. <td>Not Started</td>
  58. </tr>
  59. <tr>
  60. <td><a href="#coloring">Develope the infrastructure for coloring (or "environmental" dependency analysis)</a></td>
  61. <td>None</td>
  62. <td>Not Started</td>
  63. </tr>
  64. <tr>
  65. <td><a href="#structural">Develope the infrastructure for structural dependency analysis</a></td>
  66. <td>None</td>
  67. <td>Not Started</td>
  68. </tr>
  69. <tr>
  70. <td><a href="#exec">Refactor the Exec infrastructure into JavaBeans</a></td>
  71. <td>Peter Donald</td>
  72. <td>80%</td>
  73. </tr>
  74. <tr>
  75. <td><a href="#java">Refactor the Java infrastructure into JavaBeans</a></td>
  76. <td>None</td>
  77. <td>Not Started</td>
  78. </tr>
  79. <tr>
  80. <td><a href="#facade">Design and implement a generic solution for creating Task facades</a></td>
  81. <td>None</td>
  82. <td>Not Started</td>
  83. </tr>
  84. <tr>
  85. <td><a href="#packaging">Sketch out a basic way of separating all the tasks into type libraries</a></td>
  86. <td>None</td>
  87. <td>Not Started</td>
  88. </tr>
  89. <tr>
  90. <td><a href="#mapperext">Design and implement an API that allows mapping of file attributes during copy/move/etc tasks</a></td>
  91. <td>None</td>
  92. <td>Not Started</td>
  93. </tr>
  94. <tr>
  95. <td><a href="#filters">Design and implement an API so that Filters could be implemented as FilteredOutputStreams</a></td>
  96. <td>None</td>
  97. <td>Not Started</td>
  98. </tr>
  99. <tr>
  100. <td><a href="#catalog">Design and implement a XML "catalog" so the snippets of XML can be injected based on URI rather than relative location</a></td>
  101. <td>None</td>
  102. <td>Not Started</td>
  103. </tr>
  104. <tr>
  105. <td><a href="#i18n">Look at the feasability of i18n'ing tasks and the runtime</a></td>
  106. <td>None</td>
  107. <td>Not Started</td>
  108. </tr>
  109. <tr>
  110. <td><a href="#doco">Write a document describing the way that tasks should be written in context of Ant2</a></td>
  111. <td>Peter Donald<br />(peter at apache.org)</td>
  112. <td>Not Started</td>
  113. </tr>
  114. <tr>
  115. <td><a href="#embeddor">Design an API to embed Ant into other applications</a></td>
  116. <td>None</td>
  117. <td>Not Started</td>
  118. </tr>
  119. <tr>
  120. <td><a href="#info">Design a TypeInfo system similar to BeanInfo to describe Tasks</a></td>
  121. <td>None</td>
  122. <td>Not Started</td>
  123. </tr>
  124. <tr>
  125. <td><a href="#antdoc">Design Antdoc to generate manual from .java files</a></td>
  126. <td>None</td>
  127. <td>Not Started</td>
  128. </tr>
  129. </table>
  130. </div>
  131. </blockquote>
  132. <h3>Virtual File System</h3>
  133. <a name="vfs" />
  134. <blockquote>
  135. <p>
  136. There has long been a recognition that it would be nice if ant supported some
  137. notion of a virtual filesystem layer. This layer would allow you to treat
  138. resources located and retrieved from different mechanisms in a uniform way.
  139. For instance it would allow the copy task to copy from a http server, a cvs server,
  140. a ftp server or the local filesystem using a uniform mechanism. So instead of
  141. having separate tasks to operate on each different resource type we would use
  142. just one task that plugged into multiple filesystems.
  143. </p>
  144. <p>
  145. When we are talking about a virtual filesystem or VFS, one of the concerns we must
  146. address is how to "name" the resource. In most cases a URL or URI style access will
  147. be sufficient but in other cases we may need to consider other options. So
  148. "cvs://localhost:/home/cvs/jakarta-avalon/README.txt?version=1.1",
  149. "ftp://some.server.com/dir/file.zip" and "file://C/WINDOWS/Desktop/MyFile.txt"
  150. are all examples of referring to different resources.
  151. </p>
  152. <p>
  153. Another concern that must be addressed is capabilities of both the resources and
  154. the filesystem. For instance it is possible to both read and write to resources
  155. using the "file" protocol but only possible to write resources using "mailto".
  156. The act of copying a file to a "mailto" url would actuall post the files as
  157. resources while copying to a "file" would duplicate the resource somewhere on
  158. the local filesystem.
  159. </p>
  160. <p>
  161. So we need to determine a list of capabilities. Some examples would be "read",
  162. "write", "list" (can you list dirs), "type" (can you get mime type),
  163. "access permissions" (can you tell if resource has permissions),
  164. "modify permissions" (can you modify permissions) etc. Some of these capabilities
  165. can be associated with the particular reosurces, while others may need to be
  166. associated with a whole filesystem/protocol (ie there is no standard mechanism
  167. to perform "list" on general "http" URLs). Thus a list of all these capabilities
  168. and mapping to various protocols will need to be established.
  169. </p>
  170. <p>
  171. Next we need to determine if we are going to support the notion of "mounting"
  172. URLs. For instance if we need to copy files from a FTP server do we allways
  173. need to specify the full URL - no matter how convoluted it is (ie
  174. "ftp://fred:secret@some.server.com:28763/home/fred/project2/dir/file.zip")
  175. or can we mount this on a VFS and access it via that shorter url. ie We could
  176. mount "ftp://fred:secret@some.server.com:28763/home/fred/" onto "vfs:/home"
  177. and then just access the resources via "vfs:/home/project2/dir/file.zip".
  178. This would make dealing with large urls easier and more uniform.
  179. </p>
  180. <p>
  181. So after we have decided what our options are we need to actually go about
  182. implementing the solution. It may be the case that existing VFS solutions
  183. could be reused with minor changes and thus we could save ourselves a lot of
  184. work. Candidates would be the Netbeans VFS, Suns XFile API or other
  185. available directory APIs (like JNDI). If none of them suit then we will need
  186. to write our own layer.
  187. </p>
  188. </blockquote>
  189. <h3>Naming</h3>
  190. <a name="naming" />
  191. <blockquote>
  192. <p>
  193. Currently Ant has a mixture of tasks from various stages it's evolution, with different
  194. authors and each utilizing different naming patterns. Some tasks use names such as
  195. "src" and "dest" while others use "file" and "tofile". It would be preferrable if
  196. consistent naming patterns were used. It is recomended that we come up with a "best
  197. practices" document to document our recomended naming patterns.
  198. </p>
  199. <p>
  200. Before we can come up with such a document we need to identify common patterns through
  201. out the tasks. Several tasks have the notion of transforming input from a "source"
  202. to a "destination". So we should have consistent naming schemes for these attributes and
  203. elements. Analysis of existing tasks will likely bring out other similar patterns. Once
  204. we have identified and documented these similarities then we can establish conventions.
  205. </p>
  206. </blockquote>
  207. <h3>Selector API</h3>
  208. <a name="selector" />
  209. <blockquote>
  210. <p>
  211. Currently our filesets allow us to select a set of files based on name patterns.
  212. For instance we could create a set of all the files that end with ".java". However
  213. there are cases when you wish to select files based on their other attributes, such as
  214. if they are read only or if they are older than a specified date etc.
  215. </p>
  216. <p>
  217. The selector API is one such mechanism to do this. The selector API will allow you to
  218. build file sets based on criteria other than name. Some possible criteria would be
  219. </p>
  220. <ul>
  221. <li>Is the file readable?</li>
  222. <li>Is the file writeable?</li>
  223. <li>What date was the file modified on?</li>
  224. <li>What size is the file?</li>
  225. <li>Does the contents contain the string "magic"?</li>
  226. </ul>
  227. <p>
  228. If we end up supporting a VFS then we could expand the number of selectors
  229. considerably. A mock representation that has been proposed before is the following.
  230. Of course this is subject to change as soon as someone wants to tackle this action ;)
  231. </p>
  232. <pre>
  233. &lt;include&gt;
  234. &lt;selector type="name" value="**/*.java"/&gt;
  235. &lt;selector type="permission" value="r"/&gt;
  236. &lt;!-- could optionally be directory/or some other system specific features --&gt;
  237. &lt;selector type="type" value="file"/&gt;
  238. &lt;selector type="modify-time"
  239. operation="greater-than"
  240. value="29th Feb 2003"/&gt;
  241. &lt;/include&gt;
  242. </pre>
  243. </blockquote>
  244. <h3>Coloring API</h3>
  245. <a name="coloring" />
  246. <blockquote>
  247. <p>
  248. When you execute a task such as "javac" there is two types of dependency information
  249. that is important to analyze before we determine if we need to recompile a file. Say
  250. we are compiling <code>Foo.java</code>, it may depend on the <code>Bar.java</code>
  251. file. We call this "structural" dependency information - the structure of the source file
  252. determines what other files it depend upon. However there is also "environmental"
  253. dependency information. For instance if the <code>Foo.java</code> file was compiled with
  254. <code>debug="true"</code> last run and this time needs to be compiled with
  255. <code>debug="false"</code> then it is out of date and needs to be recompiled. We call this
  256. "environmental" dependency information "coloring".
  257. </p>
  258. <p>
  259. So we need to create an infrastructure that allows tasks to manage "coloring". So a task
  260. should be able to add coloring information for each resource processed. When the task
  261. comes to process the resource again it will detect if the coloring has changed and if it
  262. has will force a recompile.
  263. </p>
  264. <p>
  265. An API for such a bean has yet to be established but an example API would be.
  266. </p>
  267. <pre>
  268. ColoringManager cm = ...;
  269. cm.addColor( "debug", "true" );
  270. cm.addColor( "optimize", "false" );
  271. cm.setFileSet( myFileSet );
  272. File[] files = cm.getOutOfDate();
  273. </pre>
  274. </blockquote>
  275. <h3>Structural Dependency Utils</h3>
  276. <a name="structural" />
  277. <blockquote>
  278. <p>
  279. In the present ant, it is required that each task manage dependency separately.
  280. This makes it a lot of work to implement even simple dependency checking. To this
  281. day many of the core tasks do not implement it correctly. I am specifically
  282. talking about "structural" dependency information. The main reason is that it is
  283. painful to implement.
  284. </p>
  285. <p>
  286. Some tasks do no dependency checking and will recompile/transform/etc everytime.
  287. Others may perform a simple dependency checking (ie if source file is newer than
  288. destination file then recompile). Ideally a dependency system would actually
  289. calculate the dependencies correctly. So we need to have some mechanism to determine
  290. that <code>foo.c</code> actually depends upon <code>foo.h</code>, <code>bar.h</code>
  291. and <code>baz.h</code>. As this information is particular to each different task
  292. we need to allow tasks to implement this behaviour. Possibly by supplying an interface
  293. of the form;
  294. </p>
  295. <pre>
  296. public interface DependencyGenerator
  297. {
  298. File[] generateDependencies( File file );
  299. }
  300. </pre>
  301. <p>
  302. Generating the dependency information is a costly operation and thus we do not want to
  303. be doing it everytime you run ant. We want to generate it on the initial build and then
  304. persist somewhere. Everytime a file is out of date, it's dependency information would
  305. be regenerated and stored in the dependency cache. Ideally this cache would also store the
  306. above mentioned coloring information. So the entry for <code>foo.c</code> may declare that
  307. it is dependent upon <code>foo.h</code>, <code>bar.h</code> and <code>baz.h</code>, aswell
  308. as being compiled with -O2 flag. If any of the dependencies have changed or are out of date
  309. then foo.c would need to be recompiled.
  310. </p>
  311. <p>
  312. A possible API would be
  313. </p>
  314. <pre>
  315. DependencyManager dm = ...;
  316. dm.setFileSet( myFileSet );
  317. dm.setDependencyCache( myDependencyCacheFile );
  318. File[] files = cm.getOutOfDate();
  319. </pre>
  320. </blockquote>
  321. <h3>Refactor &lt;exec&gt; infrastructure into Beans</h3>
  322. <a name="exec" />
  323. <blockquote>
  324. <p>
  325. Exec and its related classes have currently evolved through several iterations and thus
  326. it is not as cleanly designed and as reusable as it could be. Someone needs to pull apart
  327. exec and analyze which parts can be turned into JavaBeans and decouple them from the Ant
  328. infrastructure. Once that is done it will make these beans much easier to reuse from other
  329. tasks without relying on gaining access to the other task instance.
  330. </p>
  331. </blockquote>
  332. <h3>Refactor &lt;java&gt; infrastructure into Beans</h3>
  333. <a name="java" />
  334. <blockquote>
  335. <p>
  336. Much like Exec should be decoupled from Ant runtime, so should classes to implement java
  337. task for the same benefits.
  338. </p>
  339. </blockquote>
  340. <h3>Generic Task Facades</h3>
  341. <a name="facade" />
  342. <blockquote>
  343. <p>
  344. Currently we have a few tasks that have multiple implementations. For instance Javac task
  345. can actually call jikes, jvc, classic javac or modern javac. Similar things will be seen
  346. with the jspc task and the cc task (if it ever gets written). We need to examine this
  347. pattern and see if there is a way to generalize this and make it easier to write such tasks.
  348. </p>
  349. </blockquote>
  350. <h3>Task Packaging</h3>
  351. <a name="packaging" />
  352. <blockquote>
  353. <p>
  354. We have already decided that we are going to package Ant tasks in separate jars and
  355. have some sort of descriptor that to describe the contents of the jar. However we have
  356. not yet decided how we will break up the tasks. Do we break up the tasks up into
  357. related tasks or into groups that ar elikely to be used together or what? A possible
  358. breakdown would be
  359. </p>
  360. <ul>
  361. <li>jdk tasks: javac, javadoc, rmic etc</li>
  362. <li>text tasks: regex replace, fixcrlf etc</li>
  363. <li>unix tasks: chmod, etc</li>
  364. <li>file tasks: copy, move, etc</li>
  365. </ul>
  366. </blockquote>
  367. <h3>Mapping File Attributes during transformation</h3>
  368. <a name="mapperext" />
  369. <blockquote>
  370. <p>
  371. When we are copying files from one location to another it is currently possible
  372. to rename them using a mapper. So we could rename <code>Foo.java</code> to
  373. <code>Foo.java.bak</code>. On occasion it is useful to modify file attributes
  374. other than its name in such operations. So we could copy the files to another
  375. location and make them read-only in one operation.
  376. </p>
  377. </blockquote>
  378. <h3>Filters extensions</h3>
  379. <a name="filters" />
  380. <blockquote>
  381. <p>
  382. This is partially related to the above action. Filters could be seen as a way
  383. to modify the content attribute of a file during a copy/move. It would be
  384. preferrable if filtering could be abstracted to use <code>FilteredOutputStream</code>s
  385. to perform the content modification. That way new Filter types could be constructed
  386. and used during file copy (ie an example would be a Perl FilterOutputStream that
  387. allowed you to use perl expressions to transform input).
  388. </p>
  389. </blockquote>
  390. <h3>XML Catalog to load XML Fragments</h3>
  391. <a name="catalog" />
  392. <blockquote>
  393. <p>
  394. When including fragments of XML we are currently forced to use relative paths.
  395. However this is sometimes undesirable when a single fragment needs to be used
  396. across several projects in several different locations. Instead we could use
  397. a Catalog to name the fragment and then each developer would only need to install
  398. the fragment once and it would be accessible from all the projects.
  399. </p>
  400. </blockquote>
  401. <h3>i18n the Runtime and tasks</h3>
  402. <a name="i18n" />
  403. <blockquote>
  404. <p>
  405. Look at the feasability of performing i18n on Ant runtime and core tasks. Look at
  406. how much work it will be and how useful it would be. Look at utilizing i18n from
  407. existing projects such as Avalon.
  408. </p>
  409. </blockquote>
  410. <h3>Embeddor API for Ant</h3>
  411. <a name="embeddor" />
  412. <blockquote>
  413. <p>
  414. Identify different environments in which it would be useful to embed Ant or an Ant-like
  415. tool. Identify what these environments are likely to demand in terms of API and support
  416. and then design a system that works in these environments without compromising ants
  417. core goal (ie a build system). Some suggestions for such an API include;
  418. </p>
  419. <ul>
  420. <li>Pluggable ProjectBuilders to allow building of project from a variety of sources,
  421. file, URL, InputStream, SAX etc</li>
  422. <li>Pluggable ClassLoader arrangement</li>
  423. <li>Ability to set User Properties</li>
  424. <li>Ability to add Task/Data/Type definitions</li>
  425. <li>Ability to add/remove Listeners</li>
  426. <li>Ability to add/remove Loggers</li>
  427. <li>Ability to get meta-information about targets (such as name and description)</li>
  428. <li>The ability to execute a task and/or targets</li>
  429. <li>The ability to add tasklibs</li>
  430. <li>The ability to add VFS mount points</li>
  431. <li>The ability to manipulate ProjectModel and build it from GUIs</li>
  432. <li>A general task engine API</li>
  433. </ul>
  434. </blockquote>
  435. <h3>TypeInfo system</h3>
  436. <a name="info" />
  437. <blockquote>
  438. <p>
  439. Add in the ability to represent tasks using specified meta-info, This would allow
  440. generation and manipulation of information such as what attributes are available,
  441. what elements are supported etc.
  442. </p>
  443. </blockquote>
  444. <h3>Antdoc</h3>
  445. <a name="antdoc" />
  446. <blockquote>
  447. <p>
  448. This is partially based on the above TypeInfo system. It involves the ability to
  449. take the TypeInfo made available and generate documentation for the tasks. This
  450. would allow multiple formats of documentaiton to be easily maintained and reduce
  451. the chance that documentation gets out of whack.
  452. </p>
  453. </blockquote>
  454. </body>
  455. </html>