ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@bost.de>
Subject Re: FW: properties that are not set
Date Thu, 28 Sep 2000 11:25:47 GMT
Wim, I've seen your message before but thought somebody could offer a
solution.

>>>>> "WB" == Wim Bervoets <wim.bervoets@iconmedialab.com> writes:

 WB> So I use {$1}, {$2}, {$3} and create a directory with that name
 WB> each time.

To do something like this, you'd need a loop construct of some
kind. There is nothing like this built into Ant, all you could do is
to use scripting. I'm not sure how one would go about to see whether a
variable is actually set in a scripting language - JavaScript's not
really my toy.

Something like

<script language="javascript"><![CDATA[
    i = 0;
    while (VARIABLE_WITH_NAME_I_EXISTS) {
       mkdir = project.createTask("mkdir");
       mkdir.setDir(i);
       mkdir.execute();
       i++;
    }
]]></script>

would probably work - if you get the VARIABLE_WITH_NAME_I_EXISTS part
filled in, that is.

You can write your own task in Java to do this, this would probably
look like this (in execute())

    int i = 0;
    while (project.getProperty(i+"") != null) {
       Mkdir mkdir = (Mkdir) project.createTask("mkdir");
       mkdir.setDir(i+"");
       mkdir.execute();
       i++;
    }

Stefan

Mime
View raw message