You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2004/12/23 04:15:21 UTC

DO NOT REPLY [Bug 32815] New: - Invalid Subant BuildException: "subant task calling a target that depends on its parent target" incorectly handles task scope

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=32815

           Summary: Invalid Subant BuildException: "subant task calling a
                    target that depends on its parent target" incorectly
                    handles task scope
           Product: Ant
           Version: 1.6.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: ben_hutchison@yahoo.com


The Ant.java file throws a build exception with a message "subant task calling 
a target that depends on its parent target" that suggests cicular recursion. 

This occurrs even when circular recursion is not present, because the logic 
that triggers this check does not scope target names to the defining project. 
It fires when a task in a different project has the same name. Consider this 2 
project example:

Project ModuleA:
  target build
    compile
  target build-dependencies
    do-nothing

Project ModuleB (depends on ModuleA):
  target build
    depends="build-dependencies"
  target build-dependencies
    subant ModuleA target="build"

This case will trigger a complaint that ModuleB.build-dependencies depends on 
its parent (ModuleB.build), which is false; in fact it depends on 
ModuleA.build. 

The cause is plain to see in Ant.java - the logic is not handling project 
scopes, and treats targets as if they are guaranteed to be globally unique 
across super- and sub- projects. 

Eg use of task names rather than task objects across project boundaries 
(Ant.java; 1.6.2, line 368). This isnt going to yield a system that is robust 
in the face of sub-projects.

if (other != null && other.dependsOn(owningTargetName)) {
                        throw new BuildException(getTaskName()
                                                 + " task calling a target"
                                                 + " that depends on"
                                                 + " its parent target \'"
                                                 + owningTargetName
                                                 + "\'.");

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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