Hi all, I wanted to run this past the developer list before posting it as a bug cause it may be something really obvious I am missing. I was noticing some very odd behavior in my big build script and I finally narrowed it down enough to make a simple testcase. Basically it seems like things in the top level of a target called by runtarget are not being derefrenced properly but inside an <if> block they work. Probably easiest to check out this test file and output.

 

Thanks,

Sam hendley

TestFile:

<?xml version="1.0" encoding="UTF-8"?>

<project name="Test" default="Test">

            <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>

            <target name="Test">

                        <var name="DoTest" value="true" />

                        <var name="jarFileToProcess" value="Jar_yguard" />

                        <echo message="All three values should be the same" />

                        <runtarget target="Test1" />

                        <var name="jarFileToProcess" value="Jar_proguard" />

                        <runtarget target="Test1" />

                        <echo message="All three values are not the same!! But if we try it with antcall it works. what gives?" />

                        <antcall target="Test1" />

            </target>

            <target name="Test1">

                        <echo message="In jarFileToProcess = ${jarFileToProcess}" />

                        <if>

                                    <isset property="DoTest"/>

                                    <then>

                                                <echo message="Then: jarFileToProcess = ${jarFileToProcess}" />

                                    </then>

                                    <else>

                                                <echo message="Else: jarFileToProcess = ${jarFileToProcess}" />

                                    </else>

                        </if>

                        <echo message="Out jarFileToProcess = ${jarFileToProcess}" />

            </target>

</project>

 

Ouput:

Buildfile: build.xml

Test:

     [echo] All three values should be the same

 

Test1:

     [echo] In jarFileToProcess = Jar_yguard

     [echo] Then: jarFileToProcess = Jar_yguard

     [echo] Out jarFileToProcess = Jar_yguard

 

Test1:

     [echo] In jarFileToProcess = Jar_yguard

     [echo] Then: jarFileToProcess = Jar_proguard

     [echo] Out jarFileToProcess = Jar_yguard

     [echo] All three values are not the same!! But if we try it with antcall it works. what gives?

 

Test1:

     [echo] In jarFileToProcess = Jar_proguard

     [echo] Then: jarFileToProcess = Jar_proguard

     [echo] Out jarFileToProcess = Jar_proguard