December 26, 2004
Mozilla overlays and Ant Mozilla overlays http://www.mozilla.org/xpfe/xptoolkit/overlays.html seem a very useful idea, and ant build.xml may be one possible area it could be used. Basically the overlay allows you to add or modify an XML file - without changing the file itself. Like the ant import, but without any import tasks - i.e. driven from outside.

For example, you may have a user-specified overlay defining attributes for different tasks, or replacing or enhancing existing targets in projects. The user overlay file would consist of sections - containing the element to be modified, and the additional/replacement attributes and elements. It may sound more complicated than just editing the file and adding the "compress=false" or "debug=off" or whatever attribute on each jar and javac task, but if you are dealing with many projects and cvs - it's sometimes annoying. The multiple layers of properties files used to customize could be replaced by this.

As it is now defined, overlays use only the element ID - so probably it'll need some extensions to allow selecting the target/task ( maybe a small xpath subset ). Ant supports already some plugin mechanism for the xml parser, so it is possible to hook in after the main build.xml is read, and overlay the user file on top.

Very unlikely I'll have time to try this out - but it is interesting how concepts from one world could apply in another.

Another note on overlays - the net effect is transforming the original xml. Except the sadistic way to declare them in contents.rdf - it's very easy to understand and use. However I wonder if it wouldn't be better to just do the transformation once and cache the net result instead of applying the overlay on each invocation. A more generic approach would be xslt - but that's far too complex for simply adding an attribute or menu item. On the other side - a more specific mechanism to handle common extension points like menus or event handlers would have been nice too.

Posted by costin at December 26, 2004 01:23 AM
Comments
Disabled due to spam. Click on the link to post a comment, it'll be sent in email ( and thus usual mail spam filters and blacklist applied ). It may be made accessible later on, but code needs to be written for that. Comments