ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Klein, Scott @ TW" <scott.kl...@L-3com.com>
Subject RE: conditions and property's
Date Wed, 13 Nov 2002 21:20:20 GMT
well, then let me back it all the way up.

all i want to do is perform a series of tasks and revert to the original
state if any errors occur.

I started by looking at the <fail> task, but I couldn't find a way to
determine whether or not to execute a fail, which led me down the long path
described previously. Most of the tasks have to do with file and directory
manipulation (copy/delete/zip/etc), but in the future I will have
proprietary tasks (or perhaps just additional targets...not sure yet).

hows that?

scott

-----Original Message-----
From: Dominique Devienne [mailto:DDevienne@lgc.com]
Sent: Wednesday, November 13, 2002 12:52 PM
To: 'Ant Users List'
Subject: RE: conditions and property's


The problem I have is that I don't understand your example!

What does <uptodate property="copy.from.filename" value="aFile.file"/> do?
What's your srcfile and targetfile???

Do you know that <copy> is intelligent, and will only do a copy if needed?

In any case, since you're using <antcall>, check the file exists after doing
the <antcall>, and not before, since all properties defined *within* the
<antcall> are lost after the <antcall> *returns*.

I was asking you 'what are you trying to do?' to find out what you were
trying to accomplish (seems like copying a file under some conditions???)
instead of 'what you were doing' (trying to make multiple calls to a
'generic' target!?!?). Is that clearer? --DD

-----Original Message-----
From: Klein, Scott @ TW [mailto:scott.klein@L-3com.com] 
Sent: Wednesday, November 13, 2002 2:30 PM
To: 'Ant Users List'
Subject: RE: conditions and property's

Sorry, I thought I had explained that. I am trying to make multiple calls to
a 'generic' target (see example below), but have the execution of said
target be based on a property. This means that a property must be able to be
"unset". Note that since Ant doesn't support if/else I assume that the only
way to do this is with properties.


Here is an example:

	<target name="copyFile" if="copy.file.exists">
		<copy file="${copy.from.filename}"
tofile="${copy.to.filename}" overwrite="true" />
	</target>

	<target name="moveStuffAround" depends="moreMoving">
		<uptodate property="copy.from.filename"
value="${FROM_DIR}\${USER_FILE}" />
		<uptodate property="copy.to.filename"
value="${TO_DIR}\${USER_FILE}" />
		<condition property="copy.file.exists">
			<available file="${copy.from.filename}" />
		</condition>
		<antcall target="copyFile" inheiritAll="true" />
	</target>

	<target name="moreMoving">
		<uptodate property="copy.from.filename" value="aFile.file"
/>
		<uptodate property="copy.to.filename"
value="anotherFile.file" />
		<condition property="copy.file.exists">
			<available file="${copy.from.filename}" />
		</condition>
		<antcall target="copyFile" inheiritAll="true" />

	</target>

so the problem that arises is that once the 'copy.file.exists' property is
set the call to copyFile will _forever after_ be allowed. 

I know Ant can do what I want to do, the question is how efficiently? 

-----Original Message-----
From: Dominique Devienne [mailto:DDevienne@lgc.com]
Sent: Wednesday, November 13, 2002 12:01 PM
To: 'Ant Users List'
Subject: RE: conditions and property's


You should not depend on any logic which requires unsetting a property...
That's just how Ant works and was designed. I'm pretty sure Ant can do what
you want it to do, provided you shift your thinking around... Ant is not a
scripting language, and whenever one tries to bend it that way, it quickly
becomes painful!

Maybe describe what you want to do as opposed to how you were trying to do
it, and someone's bound to find a solution. --DD

-----Original Message-----
From: Matt Benson [mailto:gudnabrsam@yahoo.com] 
Sent: Wednesday, November 13, 2002 1:52 PM
To: Ant Users List; Hari Kodungallur
Subject: Re: conditions and property's

As I understand it, you could unset a property
programmatically, but not via normal use of the
property task in an Ant buildfile.

-Matt

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message