Hi Jay,
Good to see you're still alive ;-)
I've been meaning to contact you as I wanted to ask whether it's ok to add
your NAnt extensions here:
http://nant.sourceforge.net/external.html
and if so, could you provide the necessary information?
I'll have a look at the "design flaw" asap.
I would also like to discuss a feature that is currently not exposed to
task/build authors: conditional elements.
With this I mean elements that are not only skipped when a given condition
is not met, but not initialized as well.
Up until now, the elements that support the "if" / "unless" attributes had
to be explicitly checked to see if they were "enabled". Even if they were
not enabled, each property (representing attributes, child elements, ...)
would be initialized. Which means that if had something like this:
<whatever dir="${dist.path}" if="${property::exists('dist.path')}" />
it would result in a build failure if the "dist.path" property did not
exist, as the "dir" attribute would be processed regardless of the if/unless
attribute.
What I implemented (in CVS) is a new subclass of Element (named
ConditionalElement... yeah had a moment of great inspiration there :p). It
has a specialized configurator that first checks the value of the if /
unless attribute before it attempts further configuration. If the condition
is not met, then none of the properties will be initialized. In that case,
the element instance is also not added to the collection of elements.
Which means that task authors do not need to check whether a given element
is enabled or not, since only "enabled" elements are actually added to a
collection.
Since task authors do not need to check whether a given element is enabled,
I've used protected properties to back the if/unless attributes.
Currently, the ConditionalElement class and, as a result, the described
feature is internal. I first wanted to have some feedback before exposing
it.
It also needs a little more work and (unit) testing.
Gert
_____
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jay Flowers
Sent: donderdag 27 december 2007 23:52
To: Bob Archer
Cc: nant-users@lists.sourceforge.net
Subject: Re: [NAnt-users] Empty string in Filterchange replace value
The if does not work, this is a design flaw. I added a function to allow me
that capability:
<function execute="${filterchain::replacestring-add('Common.FilterChain',
'%Developer.List%', Developer.List )}"/>
You will need to use the id and refid to work with this.
On 12/27/07, Bob Archer <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
wrote:
Ok,
I just realized I can use replacestring to change the token to an empty
string.
I also realized I can use multiple replacetokens tags. however, is the if
supposed to work on that tag? Maybe I am doing the if wrong. I am doing:
< replacetokens if="
${property::exists('Private.DbGhost.AdhocScriptElement')}">
< token key =" ADDHOCSCRIPTS" value="
${Private.DbGhost.AdhocScriptElement}" />
</ replacetokens>
However, I am getting this error. which I thought I was avoiding with the
if:
Expression: ${Private.DbGhost.AdhocScriptElement}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Property 'Private.DbGhost.AdhocScriptElement' has not been set.
Any ideas?
BOb
_____
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bob Archer
Sent: Thursday, December 27, 2007 3:56 PM
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] Empty string in Filterchange replace value
Is there a way to specify an empty string / or nothing in a replacetoken of
a filter change:
When I do this:
<token key="MYKEY" value="" /> (or an empty property)
I get an error:
'' is not a valid value for attribute 'value' of <token ... />.
When I put in '' to perhaps be an empty string, it actually puts in the
single quotes.
So, my text file is XML. like this:
<MyTag>@MYTOKEN@</MyTag>
And after doing the copy I want (at times) this:
<MyTag></MyTag>
Also, I am told I can't put an <if> tag in the replacetokens tags. However,
there are times when I don't want to replace certain tokens (of course if I
could blank them that would probably solve this.) The if and unless do not
seem to work on the <token> tags.
Would appreciate and help or pointer to some doc that I might be missing.
Thanks,
BOb
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users
<https://lists.sourceforge.net/lists/listinfo/nant-users>
--
Jay Flowers
----------------------------------------------------------------------
http://jayflowers.com
---------------------------------------------------------------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users