Hi, Gert....
I'm presently using 0.85-rc3. My next shot to work on it is Friday, and I
will download the latest Nant and NantContrib nightly builds.
A related question:
I'd like to check and see if the property named in property.name exists.
All the "valid" properties have already been assigned default values. If
property.name exists, I will override with the value in property.value, and
set to readonly="true". Otherwise, rehect the override from the property
file as an invalid property.
I've tried this:
<if test="${property::exists('property.name')}">
With both a valid and invalid property in the property file. They both get
added because property.name exists (nuts!). I guess what I am trying to do
is double-derefernce (!)...I want to test for the property that is named in
property.name. How might that be done?
In an unrelated logic path, I wanted to create a property if it didn't
already exist; so I tried:
<property name=myprop value="" if="${not property::exists('myprop')} />
==>suppose I could have tired the simple way: <property name=myprop
value="" unless="${property::exists('myprop')} /> <==
Anyway, the test caused the error that the property hadn't been set. Duh!?
Thanks for the response.
Rod
-----Original Message-----
From: Gert Driesen [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 16, 2005 12:35 PM
To: [EMAIL PROTECTED]; [email protected]
Subject: RE: [Nant-users] Problem with readonly attribute on property
Rod,
What version of NAnt are you using ?
This is working just fine here.
Let me know if its working for you using a recent nightly build
(http://nant.sourceforge.net/nightly/latest).
Gert
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Rod Ayers
> Sent: woensdag 16 november 2005 7:59
> To: [email protected]
> Subject: [Nant-users] Problem with readonly attribute on property
>
> I have a "top-level" build file in which I initialize several
> properties. It then calls a task in another build file <nant .../>
> that reads a properties file, updating properties previously
> initialized. I want to make sure that properties updated from the
> property file don't get overwritten anywhere in the script, so I tried
> teh following:
>
>
> <foreach in="${build.file.properties}"
> item="Line"
> delim="="
> property="property.name,property.value"
> >
>
> <!-- property.name must not be empty -->
> <if test="${property.name > ''}">
>
> <!-- property.name must not be a comment -->
> <if test="${not string::starts-with(property.name, '#')}">
>
> <!-- property.value must not be empty -->
> <if test="${property::exists('property.value')}">
>
> <property name="property.name"
> value="${string::trim(property.name)}"/>
> <property name="property.value"
> value="${string::trim(property.value)}"/>
>
> <echo message="Adding property = value:
> ${property.name} = ${property.value}"/>
> <property name="${property.name}"
> value="${property.value}" readonly="true" />
> </if>
>
> </if>
>
> </if>
>
> </foreach>
>
> Everything weorks fine, except the readonly attribute is bein ignored.
> I had one property in the property file, build.number. But, right
> after the foreach, I was able to set build.number to a different value
> with another property statement, withouth an error or waraning.
>
> If I set readonly on the original property statement, any attempt to
> update the value results in the warning message:
> Read-only property "build.number" cannot be overwritten.
>
> Why doesn't readonly="true" work when I change the value of an
> existing property?
>
> Thanks,
> Rod
>
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Nant-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users