Changeset 5737


Ignore:
Timestamp:
12/14/09 14:58:58 (10 years ago)
Author:
curtis
Message:

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

Location:
trunk/components
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/common.xml

    r5733 r5737  
    2727  </target> 
    2828 
    29   <target name="init-revision"> 
    30     <!-- determine SVN revision number --> 
     29  <target name="init-svn"> 
     30    <!-- determine SVN and version statistics --> 
    3131    <if> 
    32       <isset property="svn.revision"/> 
     32      <isset property="svn.log"/> 
    3333      <else> 
    34         <!-- 
    35         Thanks to Chris Collins for this code snippet: 
    36           http://ccollins.wordpress.com/2008/01/30/ 
    37             getting-subversion-revision-in-ant/ 
    38         --> 
    39         <exec executable="svn" outputproperty="svn.log" 
    40           failifexecutionfails="false"> 
    41           <arg line="info &quot;${basedir}&quot;"/> 
    42         </exec> 
    43         <if> 
    44           <isset property="svn.log"/> 
    45           <then> 
    46             <propertyregex property="svn.revision" 
    47               input="${svn.log}" select="\1"> 
    48               <regexp pattern="Revision: ([0-9]*)"/> 
    49             </propertyregex> 
    50             <!--<echo>SVN revision: ${svn.revision}</echo>--> 
    51           </then> 
    52         </if> 
     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> 
    5364      </else> 
    5465    </if> 
    5566  </target> 
    5667 
    57   <target name="init-release"> 
    58     <exec executable="svn" outputproperty="release.version" 
    59       failifexecutionfails="false"> 
    60       <arg line="info &quot;${basedir}&quot;"/> 
    61     </exec> 
    62     <if> 
    63       <isset property="release.version"/> 
    64       <then> 
    65         <propertyregex property="svn.root" 
    66           input="${release.version}" select="\1"> 
    67           <regexp pattern="Repository Root: (.*)"/> 
    68         </propertyregex> 
    69         <propertyregex property="release.version" override="true" 
    70           input="${release.version}" select="\1"> 
    71           <regexp pattern="URL: ${svn.root}/(.*)/components/(.*)"/> 
    72         </propertyregex> 
    73         <propertyregex property="release.version" override="true" 
    74           input="${release.version}" regexp="branches/(.*)" replace="stable \1" 
    75           defaultValue="trunk"/> 
    76         <echo>Release version: ${release.version}</echo><!--TEMP--> 
    77         <!--<echo>Release version: ${release.version}</echo>--> 
    78       </then> 
    79     </if> 
    80   </target> 
    81  
    8268</project> 
  • trunk/components/java.xml

    r5645 r5737  
    142142 
    143143  <target name="init" 
    144     depends="init-timestamp, init-revision, init-release, init-manifest-cp"> 
     144    depends="init-timestamp, init-svn, init-manifest-cp"> 
    145145    <echo>----------=========== ${component.name} ===========----------</echo> 
    146146  </target> 
     
    177177        <filter token="year" value="${YEAR}"/> 
    178178        <filter token="svn.revision" value="${svn.revision}"/> 
     179        <filter token="svn.url" value="${svn.url}"/> 
     180        <filter token="svn.root" value="${svn.root}"/> 
     181        <filter token="svn.date" value="${svn.date}"/> 
     182        <filter token="svn.changed" value="${svn.changed}"/> 
     183        <filter token="release.version" value="${release.version}"/> 
    179184        <filter token="visbio.version" value="${visbio.version}"/> 
    180         <filter token="release.version" value="${release.version}"/> 
    181185      </filterset> 
    182186    </copy> 
Note: See TracChangeset for help on using the changeset viewer.