DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27116>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27116

Imported target depends not preserved when overridden

           Summary: Imported target depends not preserved when overridden
           Product: Ant
           Version: 1.6.1
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Core tasks
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The Import task docs indicate "It makes it easy to keep the same target name, 
that has the same dependencies (so it is still called by the other targets), 
but use a different implementation."  However, the task doesn't actually 
preserve the same dependencies.

Given the following two files:
------ build.xml -----------------------------
<project name="build" default="all">
   <import file="sharedtargets.xml"/>
   <target name="all" depends="b,d"/>
   <target name="foo">
      <echo message="Target foo"/>
   </target>
   <target name="b">
      <echo message="Overridden target b"/>
   </target>

   <target name="c" depends="foo">
      <echo message="Overridden target c"/>
   </target>
   <target name="d" depends="sharedtargets.d">
      <echo message="Overridden target d"/>
   </target>
</project>
------ sharedtargets.xml ---------------------
<project name="sharedtargets">
   <target name="a">
      <echo message="Target sharedtargets.a"/>
   </target>
   <target name="b" depends="a">
      <echo message="Target sharedtargets.b"/>
   </target>
   <target name="c">
      <echo message="Target sharedtargets.c"/>
   </target>
   <target name="d" depends="c">
      <echo message="Target sharedtargets.d"/>
   </target>
</project>
----------------------------------------------

I see the following output with 1.6.0 and 1.6.1:

---- actual output ---------------------------
Buildfile: build.xml
b:
     [echo] Overridden target b
foo:
     [echo] Target foo
c:
     [echo] Overridden target c
sharedtargets.d:
     [echo] Target sharedtargets.d
d:
     [echo] Overridden target d
all:
BUILD SUCCESSFUL
----------------------------------------------

But I'd expect to see the following:

------ desired/expected output ---------------
Buildfile: build.xml
a:
     [echo] Target sharedtargets.a
b:
     [echo] Overridden target b
foo:
     [echo] Target foo
c:
     [echo] Overridden target c
sharedtargets.d:
     [echo] Target sharedtargets.d
d:
     [echo] Overridden target d
all:
BUILD SUCCESSFUL
Total time: 1 second
----------------------------------------------

In otherwords, I'd expect the dependencies of the overridden target to be 
preserved, even when the overriding target declares its own depends (although 
this last bit should probably be optional).

i.e. 
- The overriden 'b' target should require that sharedtarget's 'a' is run 
- The overridden 'd' shouldn't have to depend on the sharedtarget's 'd' to 
get 'c' to run

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to