You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Dave Kavanagh <da...@dotech.com> on 2004/02/05 13:55:13 UTC

regexp mapper with full path

I've been trying to solve a problem using the regexp mapper, but in case it 
isn't the right path to take, I'll restate the problem first...

I'm using the AspectJ compiler for some files in a rather large project. The 
compiler is pretty slow in incremental mode, so it runs over the whole src 
tree, loading all the files, then weaving the few that need it. (using the 
<iajc> task).
We try to cut down on how often this gets used by having an <uptodate> check 
run first. We were comparing the src files with the final jar output. I'm 
trying to make the check smarter by checking just the bean source files that 
need to be weaved with the resulting class files. I've seen mapper examples, 
but they seem to assume the source and class files are in the same directory
(something like this)

<uptodate property="iajc.uptodate">
  <srcfiles dir="${devsrc.dir}" includes="**/*.java,**/*.aj"/>
  <mapper type="regexp" from="^(.*)\.java$$" to="\1.class"/>
</uptodate>


I actually run javac on all except the beans in question so this check should 
catch everything that wasn't compiled with javac. The problem is that we have 
src in ${devsrc.dir} and the classes in ${build.classes.dir}. I can think of 
how to write a regexp for this, but who does that integrate with the whole 
<uptodate> and <srcfiles> construct?

Thanks,

David

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


Re: regexp mapper with full path

Posted by Dave Kavanagh <da...@dotech.com>.
Thanks, Peter.
I managed to figure this out a couple days ago... good stuff to know about.
Now, I'd like to know how to do something similar.
I have a <patternset> with an ID that I use in a couple places. It represents a 
list of .class files. I have a need to have the same list, but with the .java 
extension instead. Is there an easy way to define two pattern sets that are 
based off the same list? I could dup the includes/excludes, changing the class 
to java manually, but that isn't as clean. The <mapper> would be a good fit, 
but I don't see that it is an option in this case.

Thanks,
David

Quoting Peter Reilly <pe...@corvil.com>:

> Sorry for the delay:
> You need to add the dirst to the "to" attribute.
> 
> For the most part, mapper's are given the filename relative
> to the fileset that the file comes from and from that generate
> a new relative path. The new path needs to be may absolute:
> 
> example:
> <property name="target.dir" location="build/classes"/>
> 
> <uptodate property="j.uptodate">
> 
>     <srcfile dir="${java.src"} includes="**/*.java"/>
>     <mapper type="regexp" from="^(.*)\.java$$"
> to="${target.dir}/\1.class"/>
> </uptodate>
> 
> Peter
> Dave Kavanagh wrote:
> 
> >I've been trying to solve a problem using the regexp mapper, but in case it
> 
> >isn't the right path to take, I'll restate the problem first...
> >
> >I'm using the AspectJ compiler for some files in a rather large project. The
> 
> >compiler is pretty slow in incremental mode, so it runs over the whole src
> 
> >tree, loading all the files, then weaving the few that need it. (using the
> 
> ><iajc> task).
> >We try to cut down on how often this gets used by having an <uptodate> check
> 
> >run first. We were comparing the src files with the final jar output. I'm 
> >trying to make the check smarter by checking just the bean source files that
> 
> >need to be weaved with the resulting class files. I've seen mapper examples,
> 
> >but they seem to assume the source and class files are in the same
> directory
> >(something like this)
> >
> ><uptodate property="iajc.uptodate">
> >  <srcfiles dir="${devsrc.dir}" includes="**/*.java,**/*.aj"/>
> >  <mapper type="regexp" from="^(.*)\.java$$" to="\1.class"/>
> ></uptodate>
> >
> >
> >I actually run javac on all except the beans in question so this check
> should 
> >catch everything that wasn't compiled with javac. The problem is that we
> have 
> >src in ${devsrc.dir} and the classes in ${build.classes.dir}. I can think of
> 
> >how to write a regexp for this, but who does that integrate with the whole
> 
> ><uptodate> and <srcfiles> construct?
> >
> >Thanks,
> >
> >David
> >


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


Re: regexp mapper with full path

Posted by Peter Reilly <pe...@corvil.com>.
Sorry for the delay:
You need to add the dirst to the "to" attribute.

For the most part, mapper's are given the filename relative
to the fileset that the file comes from and from that generate
a new relative path. The new path needs to be may absolute:

example:
<property name="target.dir" location="build/classes"/>

<uptodate property="j.uptodate">

    <srcfile dir="${java.src"} includes="**/*.java"/>
    <mapper type="regexp" from="^(.*)\.java$$" to="${target.dir}/\1.class"/>
</uptodate>

Peter
Dave Kavanagh wrote:

>I've been trying to solve a problem using the regexp mapper, but in case it 
>isn't the right path to take, I'll restate the problem first...
>
>I'm using the AspectJ compiler for some files in a rather large project. The 
>compiler is pretty slow in incremental mode, so it runs over the whole src 
>tree, loading all the files, then weaving the few that need it. (using the 
><iajc> task).
>We try to cut down on how often this gets used by having an <uptodate> check 
>run first. We were comparing the src files with the final jar output. I'm 
>trying to make the check smarter by checking just the bean source files that 
>need to be weaved with the resulting class files. I've seen mapper examples, 
>but they seem to assume the source and class files are in the same directory
>(something like this)
>
><uptodate property="iajc.uptodate">
>  <srcfiles dir="${devsrc.dir}" includes="**/*.java,**/*.aj"/>
>  <mapper type="regexp" from="^(.*)\.java$$" to="\1.class"/>
></uptodate>
>
>
>I actually run javac on all except the beans in question so this check should 
>catch everything that wasn't compiled with javac. The problem is that we have 
>src in ${devsrc.dir} and the classes in ${build.classes.dir}. I can think of 
>how to write a regexp for this, but who does that integrate with the whole 
><uptodate> and <srcfiles> construct?
>
>Thanks,
>
>David
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>  
>


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