ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nico Seessle" <Nico.Sees...@epost.de>
Subject Re: New core functionality
Date Mon, 22 Jan 2001 23:40:52 GMT

  From: Larry Sanderson 
  To: Nico Seessle ; ant-dev@jakarta.apache.org 
  Sent: Sunday, January 21, 2001 7:32 PM
  Subject: Re: New core functionality


  See inline below...

Is it possible for you to set your mailer to "Text only" if posting to the list? It's much
easier to answer to pure Text mails...
    ----- Original Message ----- 
    From: Nico Seessle 
    To: ant-dev@jakarta.apache.org 
    Cc: larrys@mrstock.com 
    Sent: Sunday, January 21, 2001 2:06 AM
    Subject: Re: New core functionality

      Hello,

      I have modified ant for our corporate use, and I thought some of you may be interested
in the additions / changes:

      1) I modified the Ant task to accept a nested "antpath" element.  This is a standard
path element that defines a list of sub-tasks to execute.  We use it to glob large nested
builds.  (Note: this task remains completely backward compatible)

      ex:
      ...
      <ant>
        <antpath>
          <fileset dir="." includes="*/**/build.xml" />
        </antpath>
      </ant>
      ...
Loops are not our friends :-) (if someone wishes to get them included into ant-core...) 

How about: 

    <script language="javascript"> <![CDATA[
        var ant = myProject.createTask("ant");
        var echo = myProject.createTask("echo");
        var fileset = myProject.createDataType("fileset");
        
        fileset.setDir(new java.io.File("."));
        fileset.setIncludes("*/**/build.xml");
        
        var dirScanner = fileset.getDirectoryScanner(test);
        var files = dirScanner.getIncludedFiles();
        
        for (i = 0; i < files.length; i++) 
        {
            file = new java.io.File(files[i]);
            dir = file.getParent();
            antfile = file.getName();
            ant.setDir(new java.io.File(dir));
            ant.setAntfile(antfile);
            ant.execute();
        }
    ]]></script>


Your number 2 could be

    <script language="javascript"> <![CDATA[
    
        var ant = myProject.createTask("ant");
        var echo = myProject.createTask("echo");
        var fileset = myProject.createDataType("fileset");
        
        fileset.setDir(new java.io.File("."));
        fileset.setIncludes("*/**/build.xml");
        
        var dirScanner = fileset.getDirectoryScanner(test);
        var files = dirScanner.getIncludedFiles();

        if (files != null && files.length != 0) myProject.setProperty('sub.build.exists',
'true');
        
    ]]></script>


The last one can not be solved by <script>, but should be possible using .bat-files.
(At least on NT or W2K). Complexity depends on your requirements. If one target and up to
8 variable properties are enough for you and it's not a problem if you end up with properties
containing "" (space) you can 
1. remove everything between ":start" and ":doneArgs"
2. Change the command-line after ":runAnt" to 
 %_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" %ANT_OPTS% org.apache.tools.ant.Main
%1 -Darg1=%2 -Darg2=%3 -Darg3=%4 -Darg4=%5 -Darg5=%6 -Darg6=%7 -Darg7=%8 -Darg8=%9

    3) I modified Main to accept only one task at a time.  All additional arguments are translated
into user-properties. (This one is NOT backward compatible)
Yeah, I was thinking of going that route, but I'm way better at Java than at .bat or sh scripts.
 (Can this even be done on a windows environment??).  Anyway, I agree with your assessment
on this last item, but I strongly believe ant needs both a conditional, and a looping task.
Has this idea already been shot down?


Mime
View raw message