ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craeg K Strong <>
Subject [TASTE QUESTION] Enhance style task or enhance merge mapper/uptodate task?
Date Wed, 20 Jun 2001 20:58:11 GMT

This is persuant to the patch I sent recently for the <style> task 
(adding a "force" attribute).

To repeat, there are cases  (e.g. dynamic properties passed to the
transformer that could change on every invocation) for which the only 
solution is to "force" re-styling
each and every time.  The most trivial example of this is passing in the 
current date as a parameter
to be displayed in the output HTML page (a contrived example, to be 

However, there ARE cases where the transformation depends only on a 
statically computable set of files.  
It would be nice if the <style> task could handle these cases easily.   
The task today only checks the
up-to-date-ness of the stylesheet and the source XML file itself.  The 
problem is those pesky
included/imported stylesheets, DTD files, and XML schema files.

Note that these dependencies may not actually be _computable_ -- rather 
they are simply asserted.
For example, an XML file may obey an XSD (XML Schema) file, but include 
no reference to it.

So here is where we get to the taste question.  There are two opposing 
forces we must balance:

ONE: the principle of locality of information argues that we record 
dependencies in the production itself.

A make example:
foo.o: bar.c CHANGES.txt mumble.y baz.l

An Ant example:
  force    = "false"
  basedir = "${basedir}"
  destdir  = "${basedir}"
  includes = "${project.dir}/**/*.xml"
  style      = "stylesheet.xsl">
   dir         = "${basedir}"
   includes = "blat.dtd, foo.xsd, common.xsl"/>

TWO: KISS philosophy and orthogonality of tasks argues that rather than 
adding lots of features to every
task, we code up smaller, simpler tasks that can be combined.  Hence, 
you have <javac> and <depend>,
NOT a giant javac task with depend functionality included.  Example:

<uptodate property="style.force"
  <srcfiles dir="${basedir}" includes="${project.dir}/**/*.xml"/>
  <mapper type="merge" to="blat.dtd, foo.xsd, common.xsl"/>

  force    = "${style.force}"
  basedir = "${basedir}"
  destdir  = "${basedir}"
  includes = "${project.dir}/**/*.xml"
  style      = "stylesheet.xsl"/>
Approach one requires adding a nested "dependencies" fileset to the 
style task.
Approach two requires slightly enhancing the merge mapper to support a 
list of target files.

Comments, opinions, questions, alternative approaches?

I am happy to submit a patch either way...


Craeg K. Strong                               |
Ariel Partners LLC		              | 
85 River Street, Ste. 3A                      | Fax:      (781) 647-9690
Waltham, MA 02453                             | Voice:    (781) 647-2425

View raw message