Skip to content

Instantly share code, notes, and snippets.

@seemike
Last active December 28, 2015 00:39
Show Gist options
  • Save seemike/7414857 to your computer and use it in GitHub Desktop.
Save seemike/7414857 to your computer and use it in GitHub Desktop.
Android ant build - removes Log.v verbose logging statements in sources
<?xml version="1.0" encoding="UTF-8"?>
<project name="release-custumrules">
<target name="-pre-build">
<tstamp>
<format property="builddate" pattern="dd.MM.yyyy HH:mm:ss" locale="de,CH" />
</tstamp>
<if condition="${build.is.packaging.debug}">
<then>
<echo>Building DEBUG version</echo>
</then>
<else>
<echo>Building RELEASE version - Copying release config</echo>
<copy file="./release-config/environment.xml" tofile="./res/values/environment.xml" overwrite="true" />
<replace file="res/values/environment.xml" token="__buildinfo__" value="Builddate: ${builddate}" />
<!-- remove all verbose logging statements in the source -->
<replaceregexp
match="Log\.v\((.+?)\);"
replace="{ /* TODO VERBOSE LOG CALL REMOVED BY RELEASE BUILD */ }"
encoding="UTF-8"
flags="gis" byline="false"
>
<fileset dir="src" includes="**/*.java"/>
</replaceregexp>
</else>
</if>
<echo>Build Date: ${builddate}</echo>
<!-- set a flag on environment.xml for build -->
<replace file="res/values/environment.xml" token="__buildinfo__" value="Builddate: ${builddate}" />
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment