You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Dean Hiller <de...@xsoftware.biz> on 2003/08/25 00:02:00 UTC
trying to get access to fileset from new task to javac task
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? or possibly retrieve the
FileSet from Javac's superclass(MatchingTask)? The getImplicitFileset()
was protected and there doesn't seem to be a clear function on the
MatchingTask to clear the FileSet. Couldn't find anything in Javac
either. Is there a way to clone Javac that I am not aware of???
Short story is I want to reuse the same javac with all the same
parameters compiling a different fileset each time. Maybe it would be
ok to put a public clearFileSet in MatchingTask.java??? I do plan on
submitting my ant task back into ant when done.
thanks for any advice on this,
dean
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
RE: trying to get access to fileset from new task to javac task
Posted by didge <di...@foundrylogic.com>.
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 <de...@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
Re: trying to get access to fileset from new task to javac task
Posted by Dean Hiller <de...@xsoftware.biz>.
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 <de...@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
>
>
>
>
Re: trying to get access to fileset from new task to javac task
Posted by Stefan Bodewig <bo...@apache.org>.
On Sun, 24 Aug 2003, Dean Hiller <de...@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