ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "didge" <di...@foundrylogic.com>
Subject RE: trying to get access to fileset from new task to javac task
Date Mon, 25 Aug 2003 14:04:59 GMT
Dean,

vppjavac (vpp.sourceforge.net, source available) wraps javac too perform
file preprocessing on the source path before invoking javac.  The intent was
that vppjavac be a 'drop-in' replacement for javac.  Originally, I'd hope to
simply extend Javac, however, because of the protected visibility of the src
fileset, I had to additionally create a new instance of Javac and execute it
in vppjavac's execute() method.  So, my solution was to both extend and
create a new instance.  I figure the extension still has value since it
guarantees that vppjavac's public interface is still a superset of javac's.
Here is how I invoke Javac internally, you could probabaly just cut & paste
this and fix the srcdir property how you want:

        // Since the source path can't be reset directly, we have to create
a
        // new Javac...
        Javac javac = new Javac();

        // --> set this how you want <--
        javac.setSrcdir(somePath);

        // ant properties
        javac.setOwningTarget(getOwningTarget());
        javac.setNowarn(javac.getNowarn());
        javac.setFailonerror(getFailonerror());
        javac.setLocation(getLocation());
        javac.setTaskName(getTaskName());

        // javac properties
        javac.setDestdir(getDestdir());
        javac.setEncoding(getEncoding());
        javac.setDebug(getDebug());
        javac.setOptimize(getOptimize());
        javac.setDeprecation(getDeprecation());
        javac.setDepend(getDepend());
        javac.setVerbose(getVerbose());
        javac.setTarget(getTarget());
        javac.setBootclasspath(getBootclasspath());
        javac.setExtdirs(getExtdirs());
        javac.setClasspath(getClasspath());
        javac.setProject(getProject());
        javac.setLocation(getLocation());
        javac.setIncludeantruntime(getIncludeantruntime());
        javac.setIncludejavaruntime(getIncludejavaruntime());
        javac.setMemoryInitialSize(getMemoryInitialSize());
        javac.setMemoryMaximumSize(getMemoryMaximumSize());

        // Compile!!
        javac.execute();

Why should the src fileset be immutable when not much else is, particularly
classpath?  No clue, maybe someone can shed some light on this...

didge

> -----Original Message-----
> From: Dean Hiller [mailto:dean@xsoftware.biz]
> Sent: Monday, August 25, 2003 6:25 AM
> To: Ant Developers List
> Subject: Re: trying to get access to fileset from new task to javac task
>
>
> I am compiling the same src directory every time, but with different
> patterns.
>
> Javac uses the FileSet in MatchingTask.  I currently have a hack into
> MatchingTask adding
>     public void putNewFileSet(FileSet set) {
>         fileset = set;
>     }
> because I am not sure how to change out the FileSet of patterns.  Above
> works for me, but is there an easier way ***without changing the ant
> base*** to get what I want.
>
> Your last statement is exactly my intention.
> thanks,
> dean
>
>
>
> Stefan Bodewig wrote:
>
> >On Sun, 24 Aug 2003, Dean Hiller <dean@xsoftware.biz> wrote:
> >
> >
> >
> >>I am writing a new task that happens to wrap javac and call it a few
> >>times.  Is there any way to clear the FileSet?
> >>
> >>
> >
> >javac doesn't use a FileSet at all, or it uses a fresh FileSet for all
> ><src> and srcdir entries - depends on how you look at it.
> >
> >
> >
> >>Short story is I want to reuse the same javac with all the same
> >>parameters compiling a different fileset each time.
> >>
> >>
> >
> >Compiling a different src directory?
> >
> >
> >
> >>Maybe it would be ok to put a public clearFileSet in
> >>MatchingTask.java???
> >>
> >>
> >
> >That would only affect the include/exclude patterns but nothing else.
> >
> >Stefan
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> >For additional commands, e-mail: dev-help@ant.apache.org
> >
> >
> >
> >
>


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


Mime
View raw message