source: trunk/components/common.xml @ 5737

Revision 5737, 2.2 KB checked in by curtis, 10 years ago (diff)

Better SVN info (and should work without svn command line tool as well).

Line 
1<!--
2common.xml
3
4Ant build file for logic common to every component.
5All component build files inherit from this build file.
6Download Apache Ant from http://ant.apache.org/.
7Type "ant -p" for a list of targets.
8-->
9
10<project>
11  <import file="${root.dir}/global.xml"/>
12  <property file="${root.dir}/components/common.properties"/>
13
14  <!-- Main build targets -->
15
16  <target name="clean" description="remove all build files except artifacts">
17    <delete dir="${build.dir}"/>
18  </target>
19
20  <!-- Internal build targets -->
21
22  <target name="init-timestamp">
23    <tstamp>
24      <format property="DATE" pattern="d MMMMM yyyy"/>
25      <format property="YEAR" pattern="yyyy"/>
26    </tstamp>
27  </target>
28
29  <target name="init-svn">
30    <!-- determine SVN and version statistics -->
31    <if>
32      <isset property="svn.log"/>
33      <else>
34        <loadfile property="svn.entries" srcFile="${basedir}/.svn/entries"/>
35
36        <propertyregex property="svn.revision"
37          input="${svn.entries}" regexp="([^\n]*\n){4}" select="\1"/>
38        <echo>SVN revision: ${svn.revision}</echo>
39
40        <propertyregex property="svn.url"
41          input="${svn.entries}" regexp="([^\n]*\n){5}" select="\1"/>
42        <echo>SVN url: ${svn.url}</echo>
43
44        <propertyregex property="svn.root"
45          input="${svn.entries}" regexp="([^\n]*\n){6}" select="\1"/>
46        <echo>SVN root: ${svn.root}</echo>
47
48        <propertyregex property="svn.date"
49          input="${svn.entries}" regexp="([^\n]*\n){10}" select="\1"/>
50        <echo>SVN last changed date: ${svn.date}</echo>
51
52        <propertyregex property="svn.changed"
53          input="${svn.entries}" regexp="([^\n]*\n){11}" select="\1"/>
54        <echo>SVN last changed revision: ${svn.changed}</echo>
55
56        <propertyregex property="release.version" defaultValue="trunk"
57          input="${svn.url}" regexp=".*/branches/([^/]*).*"
58          replace="dev \1"/>
59        <propertyregex property="release.version" override="true"
60          defaultValue="${release.version}"
61          input="${svn.url}" regexp=".*/tags/loci-tools-([^/]*).*"
62          replace="stable \1"/>
63        <echo>Release version: ${release.version}</echo>
64      </else>
65    </if>
66  </target>
67
68</project>
Note: See TracBrowser for help on using the repository browser.