Changeset 406bcbe for build.xml


Ignore:
Timestamp:
Dec 20, 2012 7:23:01 AM (8 years ago)
Author:
kytv <kytv@…>
Branches:
master
Children:
6fe1272
Parents:
9eb25f6
Message:

remove dependencies on external tools for getReleaseNumber and getBuildNumber

getReleaseNumber and getBuildNumber were *NIX only targets that relied on the external tools grep, cut, awk, and tr. These targets have been rewritten to use ant features.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • build.xml

    r9eb25f6 r406bcbe  
    505505    </target>
    506506
    507     <target name="getReleaseNumber" >
    508         <exec executable="grep" outputproperty="versionLine" failifexecutionfails="false" >
    509             <arg value="public final static String VERSION" />
    510             <arg value="core/java/src/net/i2p/CoreVersion.java" />
    511         </exec>
    512         <property name="versionLine" value="unknown" />
    513         <exec executable="cut" osfamily="unix" inputstring="${versionLine}" outputproperty="release.number" failifexecutionfails="false" >
    514             <arg value="-f2" />
    515             <arg value="-d&quot;" />
    516         </exec>
    517         <exec executable="cut" osfamily="mac" inputstring="${versionLine}" outputproperty="release.number" failifexecutionfails="false" >
    518             <arg value="-f2" />
    519             <arg value="-d&quot;"/>
    520         </exec>
    521         <exec executable="cut" osfamily="windows" inputstring="${versionLine}" outputproperty="release.number" failifexecutionfails="false" >
    522             <arg value="-f2" />
    523             <arg value="-d&quot;\&quot;&quot;"/>
    524         </exec>
     507    <target name="getReleaseNumber">
     508        <loadfile srcfile="core/java/src/net/i2p/CoreVersion.java" property="release.number">
     509            <filterchain>
     510                <linecontains>
     511                    <contains value="public final static String VERSION"/>
     512                </linecontains>
     513                <tokenfilter>
     514                    <replaceregex pattern=".*&quot;(.*)&quot;;" replace="\1" flags="gi" />
     515                </tokenfilter>
     516                <striplinebreaks/>
     517                <trim/>
     518                <ignoreblank/>
     519            </filterchain>
     520        </loadfile>
    525521        <property name="release.number" value="unknown" />
    526522        <echo message="Release number is ${release.number}" />
    527523    </target>
    528524
    529     <target name="getBuildNumber" >
    530         <exec executable="grep" outputproperty="buildLine" failifexecutionfails="false" >
    531             <arg value="public final static long BUILD" />
    532             <arg value="router/java/src/net/i2p/router/RouterVersion.java" />
    533         </exec>
    534         <property name="buildLine" value="??" />
    535         <exec executable="cut" inputstring="${buildLine}" outputproperty="build.temp" failifexecutionfails="false" >
    536             <arg value="-f2" />
    537             <arg value="-d=" />
    538         </exec>
    539         <property name="build.temp" value="??" />
    540         <exec executable="tr" inputstring="${build.temp}" outputproperty="build.temp.tr" failifexecutionfails="false">
    541             <arg value="-d" />
    542             <arg value="&quot;[:space:]&quot;"/>
    543         </exec>
    544         <property name="build.temp.tr" value="??" />
    545         <exec executable="cut" inputstring="${build.temp.tr}" outputproperty="i2p.build.number" failifexecutionfails="false" >
    546             <arg value="-f1" />
    547             <arg value="-d;" />
    548         </exec>
    549         <exec executable="awk" osfamily="unix" outputproperty="build.extra" failifexecutionfails="false">
    550             <arg value="-F&quot;" />
    551             <arg value="/public final static String EXTRA/{print $2}" />
    552             <arg value="router/java/src/net/i2p/router/RouterVersion.java" />
    553         </exec>
     525    <target name="getBuildNumber">
     526        <loadfile srcfile="router/java/src/net/i2p/router/RouterVersion.java" property="i2p.build.number">
     527            <filterchain>
     528                <linecontains>
     529                    <contains value="public final static long BUILD" />
     530                </linecontains>
     531                <tokenfilter>
     532                    <replaceregex pattern=".*([0-9]+);" replace="\1" flags="gi" />
     533                </tokenfilter>
     534                <striplinebreaks/>
     535                <trim/>
     536                <ignoreblank/>
     537            </filterchain>
     538        </loadfile>
     539        <loadfile srcfile="router/java/src/net/i2p/router/RouterVersion.java" property="build.extra">
     540            <filterchain>
     541                <linecontains>
     542                    <contains value="public final static String EXTRA" />
     543                </linecontains>
     544                <tokenfilter>
     545                    <replaceregex pattern=".*&quot;(.*)&quot;;" replace="\1" flags="gi" />
     546                </tokenfilter>
     547                <striplinebreaks/>
     548                <ignoreblank/>
     549                <trim/>
     550            </filterchain>
     551        </loadfile>
    554552        <property name="i2p.build.number" value="??" />
    555553        <property name="build.extra" value="" />
Note: See TracChangeset for help on using the changeset viewer.