ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kendall Shaw <ques...@pacbell.net>
Subject ruleset task idea
Date Tue, 13 Jul 2004 20:32:25 GMT
Thinking about the make-like build prerequisites question I posted 
earlier, I thought maybe I could try to make a ruleset task someday...

Does this sound like a good idea, or is someone else already working on 
something similar? Does it already exist? Are there problems with the idea?

The XML might be:

<!ELEMENT ruleset (rule+)>
<!ATTLIST ruleset
   id ID #IMPLIED
   name CDATA #IMPLIED
   default CDATA #IMPLIED>

<!ELEMENT rule (prerequisites?, targetfiles?, (%ant.tasks;)*>
<!ATTLIST rule
   id ID #IMPLIED
   name CDATA #IMPLIED
   prerequisites CDATA #IMPLIED
   filetargets CDATA #IMPLIED>

<!ELEMENET prerequisites (%ant.path.elements;+)>
<!ATTLIST prerequisites
   refid IDREFS #IMPLIED
   files CDATA #IMPLIED>

<!ELEMENET filetargets (%ant.path.elements;+)>
<!ATTLIST filetargets
   refid IDREFS #IMPLIED
   files CDATA #IMPLIED>

For example (please forgive any ameturish tagging here):

<?xml version="1.0"?>
<project name="example-ruleset" default="rules">

  <filelist id="a.srcs" dir="src/a" files="a.bf,b.bf,c.bf"/>
  <filelist id="b.srcs" dir="src/b" files="a.ms,b.ms,c.ms"/>

  <target name="rules">

   <ruleset default="all">

    <rule name="all" prerequisites="AAAA"/>

    <rule name="aaaa-rule" filetargets="AAAA">
     <prerequisites>
      <filelist refid="${a.srcs}"/>
      <filelist files="BBBB"/>
     </prerequisites>
     <some-ant-task src="${a.srcs}" out="AAAA"/>
    </rule>

    <rule name="bbbb" prerequisites="${b.srcs}">
     <filetargets>
      <filelist files="BBBB"/>
     </filetargets>
     <some-other-ant-task src="${b.srcs}" out="BBB"/>
    </rule>

   </ruleset>
  </target>
</project>

The idea being that the rules handle file oriented build dependencies, 
building only what is outofdate.

I think the tasks after prerequisites/filetargets in rule could include 
antcall as well, i.e. some currently useful thing involving ant targets 
and depends could be integrated into a rule by calling the target.

In the call to ant, the target name could identify the ruleset, and you 
could select rules by name or maybe by filename, e.g.:

ant rules
ant rules -Dbuild="BBBB"
or
ant rules -Dbuild-name="aaaa-rule"

Kendall

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message