Ignore:
Timestamp:
2014-02-26T20:52:10+01:00 (11 years ago)
Author:
simon04
Message:

JOSM: allow plugins to be built from a Git (non-SVN) mirror

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/build-common.xml

    r30161 r30306  
    170170    </target>
    171171    <!--
    172       ** Initializes the REVISION.XML file from git information
    173     -->
    174     <target name="init-git-revision-xml" unless="svn.info.success">
    175         <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false">
     172      ** Initializes the REVISION.XML file from git-svn information.
     173         Obtains the revision from the git-svn-id field.
     174    -->
     175    <target name="init-git-svn-revision-xml" unless="svn.info.success">
     176        <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false" resultproperty="git.svn.info.result">
    176177            <arg value="log"/>
    177178            <arg value="-1"/>
     
    188189                       match=".*git-svn-id: [^@]*@([0-9]+).*(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
    189190                       replace="&lt;info&gt;&lt;entry&gt;&lt;commit revision=&quot;\1&quot;&gt;&lt;date&gt;\2&lt;/date&gt;&lt;/commit&gt;&lt;/entry&gt;&lt;/info&gt;"/>
    190     </target>
    191     <target name="revision" depends="init-svn-revision-xml, init-git-revision-xml">
     191       <condition property="git.svn.fail">
     192           <not>
     193               <and>
     194                   <equals arg1="${git.svn.info.result}" arg2="0" />
     195                   <length file="REVISION.XML" when="greater" length="1" />
     196               </and>
     197           </not>
     198       </condition>
     199   </target>
     200    <!--
     201      ** Initializes the REVISION.XML file from git (w/o svn) information.
     202         Uses Unix date as revision number.
     203    -->
     204    <target name="init-git-revision-xml" if="git.svn.fail">
     205        <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false">
     206            <arg value="log"/>
     207            <arg value="-1"/>
     208            <arg value="--pretty=format:%at%n%ai"/>
     209            <arg value="HEAD"/>
     210        </exec>
     211        <replaceregexp file="REVISION.XML" flags="s"
     212                       match="\s*(\d*)\s+(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
     213                       replace="&lt;info&gt;&lt;entry&gt;&lt;commit revision=&quot;\1&quot;&gt;&lt;date&gt;\2&lt;/date&gt;&lt;/commit&gt;&lt;/entry&gt;&lt;/info&gt;"/>
     214    </target>
     215    <target name="revision" depends="init-svn-revision-xml, init-git-svn-revision-xml, init-git-revision-xml">
    192216      <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
    193217      <delete file="REVISION.XML"/>
Note: See TracChangeset for help on using the changeset viewer.