Skip to content

Commit

Permalink
Merge pull request #314 from projectEndings/issue_305_is-git-repo
Browse files Browse the repository at this point in the history
Fix for issue 305: generate random version info where not available.
  • Loading branch information
joeytakeda authored Sep 13, 2024
2 parents 3a00cc1 + b27f6df commit 8d92a3a
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,32 @@
<delete file="${ssBaseDir.converted}/test/VERSION"/>
<exec executable="git">
<arg value="rev-parse"/>
<arg value="--short"/>
<arg value="HEAD"/>
<redirector output="${ssBaseDir.converted}/test/VERSION"/>
<arg value="--is-inside-work-tree"/>
<redirector outputproperty="isGitRepo"/>
</exec>
<if>
<equals arg1="true" arg2="${isGitRepo}"/>
<then>
<exec executable="git">
<arg value="rev-parse"/>
<arg value="--short"/>
<arg value="HEAD"/>
<redirector output="${ssBaseDir.converted}/test/VERSION"/>
</exec>
</then>
<else>
<!-- Generate a random version string. -->
<math result="rand" datatype="int">
<op op="rint">
<op op="*">
<num value="1000"/>
<op op="random"/>
</op>
</op>
</math>
<echo file="${ssBaseDir.converted}/test/VERSION" message="vrand${rand}"/>
</else>
</if>
</then>
</if>
<!-- If this build is our test suite, then we need to copy the
Expand Down

0 comments on commit 8d92a3a

Please sign in to comment.