Bug 8559 - Add <fileset> to <arg>, add a new task ex. <directoryfinder>
Summary: Add <fileset> to <arg>, add a new task ex. <directoryfinder>
Status: RESOLVED WONTFIX
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.5
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-26 14:05 UTC by Benjamin Chi
Modified: 2008-02-22 12:18 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Chi 2002-04-26 14:05:19 UTC
It would be usefull to add <fileset> to <arg>, I see a case where you would use 
this feature. 

For example if you like to pass all the files with **/*.java or **/*.sqlj to 
the argument for execution you would use something like this (See last section):
-----------------------------------------------------
    <java classname="sqlj.tools.Sqlj">
      <arg value="-linemap=0"/>
      <arg value="-user="/>
      <arg value="-status=1"/>
      <arg value="-compile=0"/>
      <arg value="-explain=1"/>
      <arg value="-warn=all"/>
      <arg value="-d=${build.temp.translated_sqlj}"/>
      <arg value="-dir=${build.temp.translated_sqlj}"/>

      <arg>
        <fileset dir="${cc.src}" casesensitive="yes" >
          <patternset>
            <include name="**/*.sqlj"/>
            <include name="**/*.java"/>
          </patternset>
        </fileset>
      </arg>
    </java>
-----------------------------------


Another feature to add is a directory finder tag that works with <arg> for 
finding directories that contains certain files such as **/*.sqlj or **/*.java 
and include the path directory plus the "*.java" or "*.sqlj" (Just the 
wildcard "*.java", not replacing "*" with the actual file names). See example:
--------------------------------------
My src/com/sun/tools/ directory has java files.
The new directory finder tag would add "src/com/sun/tools/*.java" to the 
command line argument. If the directory doesn't have *.java files then it'll be 
excluded. Let's make adding "*.java" an optional argrument to the 
<directoryfinder>.

here's an example:

  <arg>
    <directoryfinder appendExtension="yes">
       <include name="**/*.sqlj"/>      
       <include name="**/*.java"/>      
    </directoryfinder>
  <arg>

The result for the arg would look something like this:
All results are in one line and seperated by space, we should customize the 
delimeters.

e.x. "src/com/sun/tools/*.java src/com/sun/tools/ext/*.sqlj ..."
--------------------------------------

- Benjamin
Comment 1 Erik Hatcher 2002-04-26 14:10:00 UTC
I really feel this is pushing the limits of what <java> should provide rather 
than encouraging folks to write wrapper Ant tasks for the Java programs they 
invoke.  Its quite easy to write a wrappter task which can provide all of these 
facilities.
Comment 2 Diane Holt 2002-04-26 14:28:11 UTC
I suspect what you're looking for is a <sqlj> task. One was posted to ant-user:
  http://marc.theaimsgroup.com/?l=ant-user&m=98691896600862&w=2
In case that doesn't do what you want, there are also a number of examples of 
targets using the <apply> task (just search the archive for 'sqlj').
Comment 3 Benjamin Chi 2002-04-27 16:54:33 UTC
Would that need a change to the Java Task that uses <ARG> if new feature are added to the <ARG>? I was 
thinking that this would be transparent to tasks
that uses <arg> task.

-Benjamin

Excellent! I was 
on the progress of writing the task
for SQLJ. I had to make some modifications to the
sqljTask.java 
you referred. I changed to add *.java
files to the sqlj translator, because some .sqlj
refers to 
.java files as host variables, so those
.java files had to be included in order for sqlj 
to
translate it without error.

Thanks!
Benjamin Chi
Comment 4 Matt Benson 2005-05-26 22:59:21 UTC
mixed RFEs again:
Q: directoryfinder A: custom file selector

Q: adding fileset to arg A: WONTFIX