diff --git a/docs/ant_task_guidelines.html b/docs/ant_task_guidelines.html index b148706d7..975a2da5d 100644 --- a/docs/ant_task_guidelines.html +++ b/docs/ant_task_guidelines.html @@ -23,6 +23,21 @@ get this fix in we first had to write the test suite to expose current behaviour, then change something so that singe $ was passed through, but double "$$" got mapped to "$" for backwards compatibility. +

Don't break the Java API

+ +Ant's tasks can be used by third party programs, and by third party tasks. +We cannot make changes that break the API. This includes +
    +
  1. Moving classes without leaving a backwards-compatible facade. +
  2. Deleting classes. +
  3. Deleting methods or fields, or reducing their accessibility. +
  4. Changing the signature of a setAttribute(Type) method. If you need +to add a restrictive type, add a new attribute, and place it in the source +above the original. The XML mapper will get the restricted type, old programs +can still use the old type. +
  5. Don't change semantics. At least, not drastically. All bug fixes are +implicit changes of semantics, after all. +

Use built in helper classes

@@ -180,7 +195,7 @@ Tasks which don't do any dependency checking do not help users as much as they can, because their needless work can trickle through the entire build, test and deploy process. -

Support Java 1.2 through Java 1.4

+

Support Java 1.2 through Java 1.5+

Ant1.5 and lower was designed to support Java1.1. Ant1.6 and higher is designed to support Java1.2: to build on it, to run on it. Sometimes @@ -210,9 +225,14 @@ Ant tasks can not use this keyword. They also need to move away from using the JUnit assert() method and call assertTrue() instead.

-Java 1.5 will (perhaps) add a new keyword - enum, one should avoid -this for future compatibility. +Java 1.5 adds the enum; again, this must not be used. +

Explicitly Expand properties in nested text

+ +For historical reasons, addText(String text) is called to +set the task's nested text, without any property expansion taking place. +Call Project.replaceProperties() to do this manually. +

Refactor

@@ -230,6 +250,13 @@ accessing data members directly -because these data members may not exist in the refactored design. Which is why having private data members is so important. +

+ +One thing we can not do is move existing tasks around or delete them. +Remember that Ant has a Java API as well as an XML language. We don't want +to break that API, or anything that subclasses existing Ant tasks. When +refactoring, you need to leave facades where the original classes were. so +existing code does not break.

Test

@@ -251,7 +278,8 @@ The test cases are a great way of testing your task during development. A simple call to 'build run-test' in the ant source tree will run all ant tests, to verify that your changes don't break anything. To test a single task, use the one shot ant run-single-test --Dtestcase=${testname} where ${testname} is the name of your test class. +-Dtestcase=${testname} where ${testname} +is the name of your test class.

@@ -267,7 +295,7 @@ utterly essential to many users. Remember also that Ant 1.x is designed to compile and run on Java1.2, so you should test on Java 1.2 as well as any later version which you use. -You can download an old SDK from Sun for this purpose. +You ought to be able to download an old SDK from Sun for this purpose.

Finally, run a full build test before and after you start developing your project, to make sure you havent broken anything else by @@ -299,14 +327,14 @@ This is important.

-The fairly laissez-faire license of Apache is not compabitible with +The fairly laissez-faire license of Apache is not currently considered +compabitible with either the GPL or the Lesser GPL of the Free Software Foundation -the Gnu project. These licenses have stricter terms, "copyleft", which are not in the Apache Software Foundation license. This permits people and organisations to build commercial and closed source applications atop the Apache libraries and -source -but not use the Apache, Ant or Jakarta Project names without -permission. +source.

@@ -316,13 +344,6 @@ incorporated, the Ant team can not incorporate any task based upon GPL or LGPL source into the Ant codebase. You are free to submit it, but it will be politely and firmly rejected. -

- -Once ant-2 adds better dynamic task incorporation, it may be possible to -provide a framework for indirectly supporting [L]GPL code, but still no tasks -directly subject to the Gnu licenses can be included in the Ant -CVS tree. -

If you link to a GPL or LGPL library, by import or reflection, your task must be licensed under the same terms. So tasks @@ -334,11 +355,12 @@ them. Even if we cannot include your task into the Apache codebase, we can still point to where you host it -just submit a diff to xdocs/external.html pointing to your task. - +

If your task links directly to proprietary code, we have a differnt problem: it is really hard to build the tasks. Please use reflection. -

Dont re-invent the wheel

+ +

Don't re-invent the wheel

We've all done it: written and submitted a task only to discover it was already implemented in a small corner of another task, or it has