<?xml version="1.0"?>
<project name="jBPM" basedir="." default="usage">

  <target name="usage">
    <echo>ant -f update-version.xml -Dcurrent="5.2.0-SNAPSHOT" -Dnew="5.3.0-SNAPSHOT" -Dosgi.current="5.2.0.SNAPSHOT" -Dosgi.new="5.3.0.SNAPSHOT" updateVersion</echo>
  </target>

  <target name="updateVersion" depends="checkProps, error" unless="propsNotSet">
    <replaceregexp match="&lt;version&gt;${current}&lt;/version&gt;"
                   replace="&lt;version&gt;${new}&lt;/version&gt;" 
                   byline="true">
      <fileset dir="." includes="pom.xml, 
                                 jbpm-*/pom.xml, 
                                 jbpm-gwt/**/pom.xml,
                                 jbpm-human-task/**/pom.xml"/>
    </replaceregexp>
  	<replaceregexp match="&lt;version.org.jbpm&gt;${current}&lt;/version.org.jbpm&gt;"
  	               replace="&lt;version.org.jbpm&gt;${new}&lt;/version.org.jbpm&gt;"
  	               byline="true">
  	  <fileset dir="." includes="pom.xml"/>
  	</replaceregexp>
    <replaceregexp match="jBPM.version=${current}"
                   replace="jBPM.version=${new}" 
                   byline="true">
      <fileset dir="." includes="jbpm-installer/build.properties"/>
    </replaceregexp>             
    <replaceregexp match="jBPM.version=${current}"
                   replace="jBPM.version=${new}" 
                   byline="true">
      <fileset dir="." includes="jbpm-installer/build.properties"/>
    </replaceregexp> 
  </target>       
  
  <target name="error" if="propsNotSet">
    <echo>current and new are not set</echo>
  </target>           
  
  <target name="checkProps">
     <condition property="propsSet" value="true">
       <not>
         <isset property="current" />
       </not>
     </condition>   
     <condition property="propsNotSet" value="true">
       <not>
         <isset property="new" />
       </not>
     </condition>        
  </target>
  
</project>
