Hope that wasn't a direct cut-and-paste from the XML file, an important typo in there (the double quotes to open
the "Required" property name).

Nevertheless, I think that your problem relates to your use of the srcfiles element in the uptodate task.

As quoted in the ANT manual: "If a <srcfiles> element is used, without also specifying a <mapper> element, the default behavior is to use a merge mapper, with the "to" attribute set to the value of the "targetfile" attribute." So I think your srcfiles element is mergemapped into becoming "build.zip", not the list of files, and if so an existing copy of a file is always considered more up to date than a non-existent copy. Have not had a chance to cobble up a test script, so not sure, but I would start there.

Brian Stephenson
ThorTech Solutions
www.thortech-solutions.com

On Jan 14, 2009, at 1:14 PM, Faded-Maximus wrote:


I am trying to use the uptodate task to see if I need to rebuild my program.

[code]
<target name="buildrequired">
                <uptodate property=Required" targetfile="build.zip">
                        <srcfiles dir="${unzip.location}" includes="**/*" />
                </uptodate>
               <antcall target="update" />
               <antcall target="else" />
        </target> 
        <target name="update" if="Required">
                <echo message="A new build is required." />
        </target>
        <target name="else" unless="Required"
                <echo message="No new build is required." />
        </target>
[/code]

Based on my understanding. If the build.zip file has a last modified date newer then any files in the ${unzip.location}, the Required property will be set to true and a message will appear saying that a new build is required. if the unzipped location is newer then the build.zip then a message will appear that no new build is required. Testing this, I have tried and older build.zip file and a newer build.zip file. Both cases Required is always set, and a message appears saying a new build is required. Can somebody help
me figure out where I am going wrong?

Thanks.
--
View this message in context: 
http://www.nabble.com/Uptodate-task-not-working-tp21461848p21461848.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org



Reply via email to