You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Lou Colon <lc...@edocs.com> on 2001/05/23 16:28:13 UTC

toggling a property to control target execution

Is there a way to unset a property?
I am trying to use the conditional target execution based on a property.

 The problem is that once the property has been set (to any value) I have
not been able to return to the previously set state. For example,

<ant target="doSomething">
	<!- does nothing since prop is not set ->
</ant>
<ant target="doSomething">
	<property name="prop" value="anything"/>
	<!- executes doSomething since prop is set ->
</ant>
<ant target="doSomething">
	<!- executes doSomething since prop was already set
	     but I want to turn it off ->
</ant>

Thanks,
Lou




Re: Copy wierdness

Posted by "Larry V. Streepy, Jr." <st...@healthlanguage.com>.
How are you determining the length of the file?  Some non-Unix OSes
don't show exact lengths (some show disk block based lengths).

Do you have access to any Unix commands (like from MKS) so you can run
the "sum" command on the files?  If so, you'll be able to see if they
are really different.

I know that's not much help, but it's all that comes to mind from what
you've written below.


Frank Carver wrote:
> 
> Has anyone else noticed anything strange about the <copy> task ?
> 
> My situation is this:  I am doing some simple web interface testing
> and wish to compare the gathered output from a request with the
> contents of a static file in JUnit.  As part of my build process I
> copy all the files from the 'files' directory to the build area, and
> then run the tests.  To generate the initial data, I dumped out the
> response from a known good request to a file and placed it in the
> 'files' directory.
> 
> However, my tests still kept failing, even directly comparing the
> known good request with the stored file contents.  On examination, I
> find that the file which has been copied to the build area has a
> different size from the one it was copied from!!  I have been unable
> to duplicate this with small test files, so there may be something
> pathological in the several Kb of HTML I'm dealing with.  If I copy
> the file "manually" using the DOS copy command, the file sizes are the
> same, but I really want Ant to do it for me using all the power of
> filesets etc.
> 
> I'm still trying to track down what exactly is different about the
> files, as visually they are the same, and even some "diff" programs
> claim they are the same, despite the different lengths!
> 
> Windows NT, Sun SDK 1.3, and yes, filtering is off.
> 
> All suggestions welcome.
> 
> --
> Frank Carver     frank@efsol.net    http://www.efsol.net/

-- 
Larry V. Streepy, Jr.
Chief Technical Officer and VP of Engineering

Health Language, Inc.  -- "We speak the language of healthcare"
A subsidiary of CyberPlus Corp.

970/626-5028 (office)           mailto:streepy@healthlanguage.com
970/626-4425 (fax)              http://www.healthlanguage.com

Copy wierdness

Posted by Frank Carver <fr...@efsol.net>.
Has anyone else noticed anything strange about the <copy> task ?

My situation is this:  I am doing some simple web interface testing
and wish to compare the gathered output from a request with the
contents of a static file in JUnit.  As part of my build process I
copy all the files from the 'files' directory to the build area, and
then run the tests.  To generate the initial data, I dumped out the
response from a known good request to a file and placed it in the
'files' directory.

However, my tests still kept failing, even directly comparing the
known good request with the stored file contents.  On examination, I
find that the file which has been copied to the build area has a
different size from the one it was copied from!!  I have been unable
to duplicate this with small test files, so there may be something
pathological in the several Kb of HTML I'm dealing with.  If I copy
the file "manually" using the DOS copy command, the file sizes are the
same, but I really want Ant to do it for me using all the power of
filesets etc.

I'm still trying to track down what exactly is different about the
files, as visually they are the same, and even some "diff" programs
claim they are the same, despite the different lengths!

Windows NT, Sun SDK 1.3, and yes, filtering is off.

All suggestions welcome.

-- 
Frank Carver     frank@efsol.net    http://www.efsol.net/



RE: toggling a property to control target execution

Posted by Mark Chamness <ma...@cacheware.com>.
This is a known RFE (request for enhancement).
Vote for it.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1732

For future reference, the bug database can be queried at:
http://nagoya.apache.org/bugzilla/query.cgi

-mark

> -----Original Message-----
> From: Diane Holt [mailto:holtdl@yahoo.com]
> Sent: Wednesday, May 23, 2001 1:19 PM
> To: ant-user@jakarta.apache.org
> Subject: Re: toggling a property to control target execution
>
>
> --- Lou Colon <lc...@edocs.com> wrote:
> > Is there a way to unset a property?
>
> Not currently. I seem to remember someone recently sending either a new
> task to do that or a mod to <property>, but I couldn't find anything in
> the archives. So either I dreamed it, or I just didn't hit on the right
> thing to search for -- maybe you'd have better luck.
>
> > I am trying to use the conditional target execution based on a property.
> >
> >  The problem is that once the property has been set (to any value) I
> > have not been able to return to the previously set state. For example,
> >
> > <ant target="doSomething">
> > 	<!- does nothing since prop is not set ->
> > </ant>
> > <ant target="doSomething">
> > 	<property name="prop" value="anything"/>
> > 	<!- executes doSomething since prop is set ->
> > </ant>
> > <ant target="doSomething">
> > 	<!- executes doSomething since prop was already set
> > 	     but I want to turn it off ->
> > </ant>
>
> But this example should work (and does, for me), since "prop" should only
> be set during the execution of the second <ant>. (BTW: You can use
> <antcall> instead of <ant>, if you're running a target in the current
> build-file.)
>
> Diane
>
> =====
> (holtdl@yahoo.com)
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/


Re: toggling a property to control target execution

Posted by Diane Holt <ho...@yahoo.com>.
--- Lou Colon <lc...@edocs.com> wrote:
> Is there a way to unset a property?

Not currently. I seem to remember someone recently sending either a new
task to do that or a mod to <property>, but I couldn't find anything in
the archives. So either I dreamed it, or I just didn't hit on the right
thing to search for -- maybe you'd have better luck.

> I am trying to use the conditional target execution based on a property.
> 
>  The problem is that once the property has been set (to any value) I
> have not been able to return to the previously set state. For example,
> 
> <ant target="doSomething">
> 	<!- does nothing since prop is not set ->
> </ant>
> <ant target="doSomething">
> 	<property name="prop" value="anything"/>
> 	<!- executes doSomething since prop is set ->
> </ant>
> <ant target="doSomething">
> 	<!- executes doSomething since prop was already set
> 	     but I want to turn it off ->
> </ant>

But this example should work (and does, for me), since "prop" should only
be set during the execution of the second <ant>. (BTW: You can use
<antcall> instead of <ant>, if you're running a target in the current
build-file.)

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/