Created
April 8, 2014 10:39
-
-
Save breenie/10108443 to your computer and use it in GitHub Desktop.
git ant tasks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project> | |
<!-- Copied almost verbatim from: http://stackoverflow.com/questions/2974106/how-to-lookup-the-latest-git-commit-hash-from-an-ant-build-scripto--> | |
<available file=".git" type="dir" property="git.present"/> | |
<target name="git.revision" description="Store git revision in ${repository.version}" if="git.present"> | |
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty=""> | |
<arg value="describe"/> | |
<arg value="--tags"/> | |
<arg value="--always"/> | |
<arg value="HEAD"/> | |
</exec> | |
<condition property="repository.version" value="${git.revision}" else="unknown"> | |
<and> | |
<isset property="git.revision"/> | |
<length string="${git.revision}" trim="yes" length="0" when="greater"/> | |
</and> | |
</condition> | |
</target> | |
<target name="replace-tokens"> | |
<copy file="index.html.template" tofile="index.html" overwrite="yes"> | |
<filterchain> | |
<replacetokens> | |
<token key="repository.version" value="${repository.version}" /> | |
</replacetokens> | |
</filterchain> | |
</copy> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment