ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 34566] New: - Targets with identical name work in imported project
Date Fri, 22 Apr 2005 09:06:01 GMT
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=34566>.
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=34566

           Summary: Targets with identical name work in imported project
           Product: Ant
           Version: 1.6.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: jens.hausherr@unilog.de


Hi,

here is a real hidden feature of ant which I like quite well :). Consider the
following  build file:

build.xml:

<?xml version="1.0" encoding="iso-8859-1" ?>
<project name="test" default="test-id">
	<target name="test-id" id="case1" if="property">
		<echo>Property is set.</echo>
	</target>
	<target name="test-id" id="case2" unless="property">
		<echo>Property is not set.</echo>
	</target>
</project>

This fails (as expected):

C:\workspace\Utilitiy Project>ant
Buildfile: build.xml

BUILD FAILED
C:\workspace\Utilitiy Project\build.xml:6: Duplicate target 'test-id'

Total time: 0 seconds

But consider the following use of an import Statement:

build.xml:
<?xml version="1.0" encoding="iso-8859-1" ?>
<project name="test" default="test-id">
	<import file="test.xml" />
</project>

test.xml:
<?xml version="1.0" encoding="iso-8859-1" ?>
<project default="test-id">
	<target name="test-id" id="case1" if="property">
		<echo>Property is set.</echo>
	</target>
	<target name="test-id" id="case2" unless="property">
		<echo>Property is not set.</echo>
	</target>
</project>

This should fail as well? Surprise! It works. Output of ant:

C:\workspace\Utilitiy Project>ant
Buildfile: build.xml

test-id:

BUILD SUCCESSFUL
Total time: 0 seconds

I do not know whether this behavior should be considered as a bug - I like it.
Could the differentiation of targets by ID instead of names be implemented. It
would save the use of a dummy target which depends on the two or more case-tags.

Regards,
Jens

-- 
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


Mime
View raw message