You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Scotte Zinn <sz...@patronix.com> on 2000/08/05 16:32:21 UTC

Ant bug???

I've just started using Ant and have two targets in my Build.xml.

    <target name="DebugLib.javadocs">
        <filter token="DEBUG_FLAG" value="true"/>
        <copydir src="${src.dir}/DebugLib"
                 dest="${build.src}/javadoc"
                 filtering="on">
            <include name="**"/>
            <exclude name="**/Build.xml"/>
        </copydir>
    </target>

    <target name="copy">
        <filter token="DEBUG_FLAG" value="${debug.flag}"/>
        <copydir src="${src.dir}/DebugLib"
                 dest="${build.src}/${basename}"
                 filtering="on">
            <include name="**"/>
        </copydir>
    </target>

When I do a build for compile, the copy target is to be executed and the
copydir task does the right thing with the filter substitution.  When I do a
build for javadocs, the copydir task does not do the right thing.  The
DEBUG_FLAG token gets replaced with ${debug.flag} independent of the
debug.flag property.

Here is the output of relevant portion of the command 'ant -verbose
javadocs'.  Note that the filter command does not seem to be kept local to
the target.

Is this a bug?  If so, how do I report it so that it gets fixed? (Or is this
email considered reporting it?)

-- Scotte



Project base dir set to: E:\Dev\projects\Java
 +Target: main
   +Task: ant
 +Target: clean
   +Task: ant
 +Target: DebugLib.clean
   +Task: deltree
   +Task: deltree
   +Task: delete
   +Task: deltree
   +Task: deltree
   +Task: delete
 +Target: DebugLib.javadocs
   +Task: filter
Setting token to filter: DEBUG_FLAG -> true
   +Task: copydir
 +Target: DebugLib
   +Task: copyfile
 +Target: ReleaseLib
 +Target: jar
   +Task: jar
 +Target: compile
   +Task: mkdir
   +Task: javac
 +Target: copy
   +Task: filter
Setting token to filter: DEBUG_FLAG -> ${debug.flag}
   +Task: copydir
Build sequence for target `DebugLib.javadocs' is [DebugLib.javadocs]
Complete build sequence is [DebugLib.javadocs, copy, DebugLib.clean,
compile, jar, main, DebugLib, clean, ReleaseLib]
  [copydir] Copying 2 files to E:\Dev\projects\Java\build\src\javadoc
Copy: E:\Dev\projects\Java\src\DebugLib\com\patronix\debug\Assert.java >
E:\Dev\projects\Java\build\src\javadoc\com\patronix\debug\Assert.java
Replacing: @DEBUG_FLAG@ -> ${debug.flag}
Copy: E:\Dev\projects\Java\src\DebugLib\com\patronix\debug\package.html >
E:\Dev\projects\Java\build\src\javadoc\com\patronix\debug\package.html
Copy: E:\Dev\projects\Java\src\Overview.html >
E:\Dev\projects\Java\build\src\javadoc\Overview.html
  [javadoc] Generating Javadoc




Re: Ant bug???

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "SZ" == Scotte Zinn <sz...@patronix.com> writes:

 SZ> I wonder if there is still a bug though, because when the second
 SZ> filter overrode the first one, the ${debug.flag} property was not
 SZ> expanded.

I didn't see you defining debug.flag anywhere. Is the corresponding
<property> tag before or after the ${debug.flag} construct - inside
the file not what one would expect from target execution order?

If it is after the ${} part, what you get is expected behavior - at
least at the moment. <property> is "executed" by the parser and ${}
constructs are expanded by the parser - using the order in which the
parser finds them.

Stefan

RE: Ant bug???

Posted by Scotte Zinn <sz...@patronix.com>.
Thanks for the info.  Using a replace task did what I required.

I wonder if there is still a bug though, because when the second filter
overrode the first one, the ${debug.flag} property was not expanded.

-- Scotte

-----Original Message-----
From: Conor MacNeill [mailto:conor@cortexebusiness.com.au]
Sent: Saturday, August 05, 2000 11:11 AM
To: ant-user@jakarta.apache.org
Subject: RE: Ant bug???


Scotte,

It is not a bug, it is a feature :-). Seriously, there are things in ant
which you can put in a target scope but which actually still have project
scope. filters are one of those things. The others are properties and
taskdefs. Is is not good and a source of confusion.

filters are set at parse time regardless of the order in which, or if, the
target containing it is executed. In your situation, the second filter
statement will always "win", overriding the first filter.

I tend not to use filters since I dislike the implicit connection betweem
the filter and the copydir task. In the meantime, I suggest you change your
build file to use a replace task on the destination directory after the
copydir task.

Cheers
Conor



> -----Original Message-----
> From: Scotte Zinn [mailto:szinn@patronix.com]
> Sent: Sunday, 6 August 2000 0:32
> To: ant-user@jakarta.apache.org
> Subject: Ant bug???
>
>
> I've just started using Ant and have two targets in my Build.xml.
>
>     <target name="DebugLib.javadocs">
>         <filter token="DEBUG_FLAG" value="true"/>
>         <copydir src="${src.dir}/DebugLib"
>                  dest="${build.src}/javadoc"
>                  filtering="on">
>             <include name="**"/>
>             <exclude name="**/Build.xml"/>
>         </copydir>
>     </target>
>
>     <target name="copy">
>         <filter token="DEBUG_FLAG" value="${debug.flag}"/>
>         <copydir src="${src.dir}/DebugLib"
>                  dest="${build.src}/${basename}"
>                  filtering="on">
>             <include name="**"/>
>         </copydir>
>     </target>
>
> When I do a build for compile, the copy target is to be executed and the
> copydir task does the right thing with the filter substitution.
> When I do a
> build for javadocs, the copydir task does not do the right thing.  The
> DEBUG_FLAG token gets replaced with ${debug.flag} independent of the
> debug.flag property.
>
> Here is the output of relevant portion of the command 'ant -verbose
> javadocs'.  Note that the filter command does not seem to be kept local to
> the target.
>
> Is this a bug?  If so, how do I report it so that it gets fixed?
> (Or is this
> email considered reporting it?)
>
> -- Scotte
>
>
>
> Project base dir set to: E:\Dev\projects\Java
>  +Target: main
>    +Task: ant
>  +Target: clean
>    +Task: ant
>  +Target: DebugLib.clean
>    +Task: deltree
>    +Task: deltree
>    +Task: delete
>    +Task: deltree
>    +Task: deltree
>    +Task: delete
>  +Target: DebugLib.javadocs
>    +Task: filter
> Setting token to filter: DEBUG_FLAG -> true
>    +Task: copydir
>  +Target: DebugLib
>    +Task: copyfile
>  +Target: ReleaseLib
>  +Target: jar
>    +Task: jar
>  +Target: compile
>    +Task: mkdir
>    +Task: javac
>  +Target: copy
>    +Task: filter
> Setting token to filter: DEBUG_FLAG -> ${debug.flag}
>    +Task: copydir
> Build sequence for target `DebugLib.javadocs' is [DebugLib.javadocs]
> Complete build sequence is [DebugLib.javadocs, copy, DebugLib.clean,
> compile, jar, main, DebugLib, clean, ReleaseLib]
>   [copydir] Copying 2 files to E:\Dev\projects\Java\build\src\javadoc
> Copy: E:\Dev\projects\Java\src\DebugLib\com\patronix\debug\Assert.java >
> E:\Dev\projects\Java\build\src\javadoc\com\patronix\debug\Assert.java
> Replacing: @DEBUG_FLAG@ -> ${debug.flag}
> Copy: E:\Dev\projects\Java\src\DebugLib\com\patronix\debug\package.html >
> E:\Dev\projects\Java\build\src\javadoc\com\patronix\debug\package.html
> Copy: E:\Dev\projects\Java\src\Overview.html >
> E:\Dev\projects\Java\build\src\javadoc\Overview.html
>   [javadoc] Generating Javadoc
>
>
>
>



RE: Ant bug???

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Scotte,

It is not a bug, it is a feature :-). Seriously, there are things in ant
which you can put in a target scope but which actually still have project
scope. filters are one of those things. The others are properties and
taskdefs. Is is not good and a source of confusion.

filters are set at parse time regardless of the order in which, or if, the
target containing it is executed. In your situation, the second filter
statement will always "win", overriding the first filter.

I tend not to use filters since I dislike the implicit connection betweem
the filter and the copydir task. In the meantime, I suggest you change your
build file to use a replace task on the destination directory after the
copydir task.

Cheers
Conor



> -----Original Message-----
> From: Scotte Zinn [mailto:szinn@patronix.com]
> Sent: Sunday, 6 August 2000 0:32
> To: ant-user@jakarta.apache.org
> Subject: Ant bug???
>
>
> I've just started using Ant and have two targets in my Build.xml.
>
>     <target name="DebugLib.javadocs">
>         <filter token="DEBUG_FLAG" value="true"/>
>         <copydir src="${src.dir}/DebugLib"
>                  dest="${build.src}/javadoc"
>                  filtering="on">
>             <include name="**"/>
>             <exclude name="**/Build.xml"/>
>         </copydir>
>     </target>
>
>     <target name="copy">
>         <filter token="DEBUG_FLAG" value="${debug.flag}"/>
>         <copydir src="${src.dir}/DebugLib"
>                  dest="${build.src}/${basename}"
>                  filtering="on">
>             <include name="**"/>
>         </copydir>
>     </target>
>
> When I do a build for compile, the copy target is to be executed and the
> copydir task does the right thing with the filter substitution.
> When I do a
> build for javadocs, the copydir task does not do the right thing.  The
> DEBUG_FLAG token gets replaced with ${debug.flag} independent of the
> debug.flag property.
>
> Here is the output of relevant portion of the command 'ant -verbose
> javadocs'.  Note that the filter command does not seem to be kept local to
> the target.
>
> Is this a bug?  If so, how do I report it so that it gets fixed?
> (Or is this
> email considered reporting it?)
>
> -- Scotte
>
>
>
> Project base dir set to: E:\Dev\projects\Java
>  +Target: main
>    +Task: ant
>  +Target: clean
>    +Task: ant
>  +Target: DebugLib.clean
>    +Task: deltree
>    +Task: deltree
>    +Task: delete
>    +Task: deltree
>    +Task: deltree
>    +Task: delete
>  +Target: DebugLib.javadocs
>    +Task: filter
> Setting token to filter: DEBUG_FLAG -> true
>    +Task: copydir
>  +Target: DebugLib
>    +Task: copyfile
>  +Target: ReleaseLib
>  +Target: jar
>    +Task: jar
>  +Target: compile
>    +Task: mkdir
>    +Task: javac
>  +Target: copy
>    +Task: filter
> Setting token to filter: DEBUG_FLAG -> ${debug.flag}
>    +Task: copydir
> Build sequence for target `DebugLib.javadocs' is [DebugLib.javadocs]
> Complete build sequence is [DebugLib.javadocs, copy, DebugLib.clean,
> compile, jar, main, DebugLib, clean, ReleaseLib]
>   [copydir] Copying 2 files to E:\Dev\projects\Java\build\src\javadoc
> Copy: E:\Dev\projects\Java\src\DebugLib\com\patronix\debug\Assert.java >
> E:\Dev\projects\Java\build\src\javadoc\com\patronix\debug\Assert.java
> Replacing: @DEBUG_FLAG@ -> ${debug.flag}
> Copy: E:\Dev\projects\Java\src\DebugLib\com\patronix\debug\package.html >
> E:\Dev\projects\Java\build\src\javadoc\com\patronix\debug\package.html
> Copy: E:\Dev\projects\Java\src\Overview.html >
> E:\Dev\projects\Java\build\src\javadoc\Overview.html
>   [javadoc] Generating Javadoc
>
>
>
>