ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <hol...@yahoo.com>
Subject Re: How to add the version number to the deployed project
Date Fri, 09 Aug 2002 02:40:02 GMT
--- "Janusz Dalecki (TYCO)" <jdalecki@tycoint.com> wrote:
> Is there a way of adding a version of the software to the deployed
> property file that consists of major and minor values - like 
> “Build 178.23”. I can’t see that PropertyFile task could help me -
> it only handles int and date.

If you don't mind using <script>:

  <target name="setBuildNumber">
    <property file="build.properties"/>
    <script language="javascript"> <![CDATA[
      importClass(java.math.BigDecimal);
      importClass(java.lang.Double);
      bldnum = new Double.valueOf((project.getProperty("build.number")));
      newnum = bldnum.doubleValue() + .01;
      project.setProperty("build.number",
        (new BigDecimal(newnum).setScale(2,
           BigDecimal.ROUND_HALF_UP).toString()));
      ]]>
    </script>
    <echo>Build number is ${build.number}</echo>
    <propertyfile file="build.properties">
      <entry key="build.number" value="${build.number}"/>
    </propertyfile>
  </target>

If you don't want to use <script>, you could adapt the above to a task.

Diane

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message