Skip to content

Instantly share code, notes, and snippets.

@aembleton aembleton/build.info
Last active Dec 25, 2015

Embed
What would you like to do?
Builds a jar
#Sat, 12 Oct 2013 23:12:10 +0100
major=0
minor=1
build=3
<project name="ScrapeRequest" basedir="." default="jar">
<property name="build" value="build"/>
<property file="build.info" prefix="info"/>
<target name="clean">
<delete dir="${build}"/>
</target>
<target name="init" depends="clean">
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init">
<!-- Compile the java code -->
<javac srcdir="src" destdir="${build}" />
</target>
<target name="incrementBuild">
<propertyfile file="build.info">
<entry key="build" operation="+" value="1" type="int"/>
</propertyfile>
</target>
<target name="buildJar" depends="compile,incrementBuild">
<!-- Build the jar file -->
<jar basedir="${build}" destfile="ScrapeRequest-${info.major}.${info.minor}.${info.build}.jar"/>
</target>
<target name="jar" depends="buildJar">
<!-- jar has been built, now just remove the build directory so that it doesn't pollute the dev environment -->
<delete dir="${build}"/>
</target>
</project>
@aembleton

This comment has been minimized.

Copy link
Owner Author

aembleton commented Oct 14, 2013

Without the type="int", a 1 gets appended to the end of the value, so you end up with 01111... etc. The int forces it to actually increment the value as a number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.