At 03:23 PM 3/29/2002 -0700, Drew Davidson wrote:
>Do you think it would be a Good Thing to allow recursively defined
>variables ala
>make?
>
>I'd like to be able to do the following:
>...
Couple ways to do that. One is to use <script> (which is not much
different than adding the <propertycopy> task Dianne mentioned), and the
other is to use a property file for temporary storage.
Script:
<project name="myproject" ...
<script language="javascript"><[CDATA[
var c = myproject.getProperty("c");
var d = myproject.getProperty(c);
myproject.setProperty("d", d);
]]></script>
http://www-124.ibm.com/developerworks/projects/bsf
http://www.mozilla.org/rhino/
Property file (from last January):
At 12:06 PM 1/15/2002 -0800, Diane Holt wrote:
>See bug #1733 in the bugs database -- a couple of alternative approaches
>were suggested, as well as a little task that allows for dereferencing:
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1733
The suggestion there for a fixed set of property files (which is actually
the technique I use in a modular build system but I didn't recommend
because it turns out to be a little cumbersome), leads to another generic
approach for dynamic property names which doesn't require any optional tasks:
<?xml version="1.0"?>
<project name="dynamicproperty" basedir="." default="main">
<target name="init">
<property name="a" value="aaa"/>
<property name="b" value="bbb"/>
<property name="c" value="${a}.${b}"/>
<property name="aaa.bbb" value="x"/>
<echo file="dynamicproperties.tmp">
d=$${${c}}
</echo>
<property file="dynamicproperties.tmp"/>
</target>
<target name="main" depends="init">
<echo>
Property 'd' value is "${d}".
</echo>
</target>
</project>
That is a little gross but is a direct solution to the originally posed
problem.
jim
----------------------------------------------------------------
James P. White Pagesmiths' home is http://www.pagesmiths.com
Live free http://www.ushistory.org/franklin/quotable/quote04.htm
Try Kawa, the Java-based Scheme http://www.gnu.org/software/kawa
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>