TotalFreedomMod/build.xml
JeromSar a7a2db15d6 Track build information in a better way
build.properties replaces buildcreator.properties, buildcreator.default.properties annd buildnumber.properties, but is untracked.
'git describe --tags --always HEAD' is now used to identify the build version, and its result is stored in the build properties file, included with the build. appinfo.properties is removed in favour of build.properties in the compiled jar.
The build number is still tracked, but offline, allowing TFM commits to more easily be merged
2015-09-06 23:05:36 +02:00

56 lines
2.3 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project name="TotalFreedomMod" default="default" basedir=".">
<description>Builds, tests, and runs the project TotalFreedomMod.</description>
<import file="nbproject/build-impl.xml" />
<!-- if "build.properties" exists, store that in "build.properties.exists" -->
<target name="-build-properties-exists">
<available property="build.properties.exists" file="build.properties"/>
</target>
<!-- Creates build.properties, unless it exists already -->
<target name="create-build-properties" depends="-build-properties-exists" unless="build.properties.exists">
<propertyfile file="build.properties" comment="Build information. Edit this to your liking.">
<entry key="program.builder" default="unknown" />
</propertyfile>
</target>
<!-- Pre-jar property generation -->
<target name="-pre-jar" depends="create-build-properties">
<!-- Determine git version -->
<exec executable="git" outputproperty="program.buildhead" failifexecutionfails="false" errorproperty="">
<arg value="describe"/>
<arg value="--tags"/>
<arg value="--always"/>
<arg value="HEAD"/>
</exec>
<condition property="repository.version" value="${program.buildhead}" else="unknown">
<and>
<isset property="program.buildhead"/>
<length string="${program.buildhead}" trim="yes" length="0" when="greater"/>
</and>
</condition>
<!-- Load build.properties file -->
<property file="build.properties"/>
<!-- Load buildnumber from build.properties, store in ${build.number} -->
<buildnumber file="build.properties" />
<!-- Write build info -->
<propertyfile file="${build.classes.dir}/build.properties">
<entry key="program.buildnumber" value="${build.number}" />
<entry key="program.buildhead" value="${program.buildhead}" />
<entry key="program.builder" value="${program.builder}" />
<entry key="program.builddate" type="date" value="now" pattern="yyyy-MM-dd hh:mm aa" />
</propertyfile>
</target>
<!-- Cleanup -->
<target name="-post-jar">
<delete file="${dist.dir}/README.TXT" />
<delete dir="${dist.dir}/lib/" />
</target>
</project>