ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nico Seessle" <n...@apache.org>
Subject Re: Incrementing Properties
Date Thu, 10 May 2001 06:48:43 GMT
----- Original Message -----
From: "Les Hughes" <leslie.hughes@rubus.com>
To: "Ant-Dev@Jakarta. Apache. Org (E-mail)" <ant-dev@jakarta.apache.org>
Sent: Wednesday, May 09, 2001 6:09 PM
Subject: Incrementing Properties


> Hi All,
>
> I've been playing with the propertyfile task which is pretty neat but what
I
> really need to do is to be able to increment a property. I could roll this
> into the p4counter code but is there another way of doing this and/or
> shouldn't it be something available to all properties? It seems crazy to
> have to write the props to a file via propertyfile, increment, re-write
the
> file then re-import it.
>

You could use the script-task as follows:

    <script language="javascript"> <![CDATA[
        var buildNumber =
parseInt(myProject.getProperty('product.build.minor'));
        if (isNaN(buildNumber)) buildNumber = 0;
        buildNumber = buildNumber + 1;
        myProject.setProperty('product.build.minor', buildNumber);
    ]]></script>

Nico



Mime
View raw message