ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "M.A.Dunphy" <madun...@bigfoot.com>
Subject RE: Property scope
Date Tue, 13 Mar 2001 15:46:10 GMT
OK,

Is it because, when ant parses the file, the property is not set and thus
the target test3 is to be skipped rather than the targets being resolved at
execution time?

Thanks

Mick

-----Original Message-----
From: M.A.Dunphy [mailto:madunphy@bigfoot.com]
Sent: 13 March 2001 15:39
To: Ant-User (E-mail)
Subject: Property scope


Hi guys,

Sorry to be bringing this subject up again, but I'm not getting the expected
behaviour. Firstly, I have read thr' previous discussions in the archive and
I think I understand how property set works, but I'm not getting what I
want!!. As an example, heres the test build file

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v3.5 NT (http://www.xmlspy.com) by Michael Dunphy
-->
<!DOCTYPE project SYSTEM "ant-project.dtd">
<project name="test" default="">
    <target name="test1">
        <antcall target="test2"/>
        <antcall target="test3"/>
    </target>
    <target name="test2">
        <property name="srd.fetch.complete" value="true"/>
        <echo message="the value is ${srd.fetch.complete}"/>
    </target>
    <target name="test3" if="srd.fetch.complete">
        <echo message="the value is ${srd.fetch.complete}"/>
    </target>
</project>

When I run it using: ant -verbose -buildfile test.xml test1

I get:

C:\TEMP>ant -verbose -buildfile test.xml test1
Ant version 1.3 compiled on March 2 2001

Buildfile: test.xml
Detected Java Version: 1.3
Detected OS: Windows 2000
parsing buildfile C:\TEMP\test.xml with URI = file:C:/TEMP/test.xml
resolving systemId: file:C:/TEMP/ant-project.dtd
Project base dir set to: C:\TEMP
Build sequence for target `test1' is [test1]
Complete build sequence is [test1, test3, test2]

test1:
Project base dir set to: C:\TEMP
parsing buildfile C:\TEMP\test.xml with URI = file:C:/TEMP/test.xml
resolving systemId: file:C:/TEMP/ant-project.dtd
Project base dir set to: C:\TEMP
Build sequence for target `test2' is [test2]
Complete build sequence is [test2, test3, test1]

test2:
     [echo] the value is true
Project base dir set to: C:\TEMP
parsing buildfile C:\TEMP\test.xml with URI = file:C:/TEMP/test.xml
resolving systemId: file:C:/TEMP/ant-project.dtd
Project base dir set to: C:\TEMP
Build sequence for target `test3' is [test3]
Complete build sequence is [test3, test2, test1]

test3:
Skipped because property 'srd.fetch.complete' not set.

BUILD SUCCESSFUL

Total time: 1 second
C:\TEMP>


My first observation is why does it say "Complete build sequence is [test1,
test3, test2]"?

any insight would be much appreciated..

Thanks

Mick

PS: in the generated DTD file, a property is defined as 

<!ATTLIST property
    id ID #IMPLIED
    refid IDREF #IMPLIED
    name CDATA #IMPLIED
    classpath CDATA #IMPLIED
    file CDATA #IMPLIED
    userproperty %boolean; #IMPLIED
    resource CDATA #IMPLIED
    environment CDATA #IMPLIED
    classpathref IDREF #IMPLIED
    taskname CDATA #IMPLIED
    value CDATA #IMPLIED
    location CDATA #IMPLIED
    description CDATA #IMPLIED
>

but the docs do not specify these attributes, so are the docs
incorrect/incomplete?

Mime
View raw message