You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2013/05/08 17:13:36 UTC

[Bug 54940] New: Target rewriting for nested "include" only works when "as" is specified?

https://issues.apache.org/bugzilla/show_bug.cgi?id=54940

            Bug ID: 54940
           Summary: Target rewriting for nested "include" only works when
                    "as" is specified?
           Product: Ant
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
          Assignee: notifications@ant.apache.org
          Reporter: cagney@fixmo.com
    Classification: Unclassified

I'm trying to reconcile these bits of the documentation with the tests I've
attached:

"Any target in the included file will be renamed to prefix.name where name is
the original target's name and prefix is either the value of the as attribute
or the name attribute of the project tag of the included file."

I'm assuming this means that:
  foo.xml:
    <project name="foo">...
  bar.xml:
    <include file="foo.xml"/>
and
  foo.xml:
    <project>...
  bar.xml:
    <include file="foo.xml" as="foo"/>
are equivalent.

And trying this for a simple include suggests my understanding is correct.

The documentation then goes on:

"The depends attribute of all included targets is rewritten so that all target
names are prefixed as well. This makes the included file self-contained.
Note that prefixes nest, so if a build file includes a file with prefix "a" and
the included file includes another file with prefix "b", then the targets of
that last build file will be prefixed by "a.b."."

Which I'm interpreting to mean that the above should still work when includes
are nested.  Unfortunately, I'm finding that I need to specify "as=" to make
things work.  For instance, the below which specifies "as=" on nested includes
...

w.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="w">
    <echo>${ant.file.w}</echo>
    <include file="x.xml"/>
    <target name="ww" depends="x.xx, x.y.yy, x.y.z.zz"/>
</project>

x.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="x">
    <echo>${ant.file.x}</echo>
    <include file="y.xml" as="y"/>
    <target name="xx" depends="y.yy, y.z.zz"/>
</project>

y.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="y">
    <echo>${ant.file.y}</echo>
    <include file="z.xml" as="z"/>
    <target name="yy" depends="z.zz"/>
</project>

z.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="z">
    <echo>${ant.file.z}</echo>
    <target name="zz"/>
</project>

... works as I would expect.  Both immediate (e.x.: "ww") and rewritten
included targets work (e.x.: x.y.z.zz) vis:

$ ant -f w.xml ww x.y.z.zz
Buildfile: /home/work/senv/Build/good/w.xml
     [echo] /home/work/senv/Build/good/w.xml
     [echo] /home/work/senv/Build/good/x.xml
     [echo] /home/work/senv/Build/good/y.xml
     [echo] /home/work/senv/Build/good/z.xml
x.y.z.zz:
x.y.yy:
x.xx:
ww:
x.y.z.zz:
BUILD SUCCESSFUL
Total time: 0 seconds

However, when I remove the "as=.." things break down.  For instance, removng
"as="y" from "x.xml"'s include of "y.xml", vis:

x.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="x">
    <echo>${ant.file.x}</echo>
    <include file="y.xml"/>
    <target name="xx" depends="y.yy, y.z.zz"/>
</project>

then I get the error:

$ ant -f w.xml ww
Buildfile: /home/work/senv/Build/good/w.xml
     [echo] /home/work/senv/Build/good/w.xml
     [echo] /home/work/senv/Build/good/x.xml
     [echo] /home/work/senv/Build/good/y.xml
     [echo] /home/work/senv/Build/good/z.xml
BUILD FAILED
Target "x.y.yy" does not exist in the project "w". It is used from target
"x.xx".

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 54940] Target rewriting for nested "include" only works when "as" is specified?

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54940

Cagney <ca...@fixmo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|1.8.2                       |1.9.0

--- Comment #1 from Cagney <ca...@fixmo.com> ---
Seems to also be present in 1.9.0:

$ JAVA_HOME=~software/jdk1.7.0_17 ~software/apache-ant-1.9.0/bin/ant -f w.xml
ww
Buildfile: /home/cagney/tmp/w.xml
     [echo] /home/cagney/tmp/w.xml
     [echo] /home/cagney/tmp/x.xml
     [echo] /home/cagney/tmp/y.xml
     [echo] /home/cagney/tmp/z.xml
BUILD FAILED
Target "x.y.yy" does not exist in the project "w". It is used from target
"x.xx".
Total time: 0 seconds

updated version link

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 54940] Target rewriting for nested "include" only works when "as" is specified?

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54940

Cagney <ca...@fixmo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |1.8.2

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 54940] Target rewriting for nested "include" only works when "as" is specified?

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54940

Antoine Levy-Lambert <an...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |1.9.1

--- Comment #2 from Antoine Levy-Lambert <an...@apache.org> ---
fixed in r1481662. Thanks for reporting the bug.

-- 
You are receiving this mail because:
You are the assignee for the bug.