Revision 609b9591bb64d7b6f73e30eef52a5bc6a6d2c295 authored by Reinier Zwitserloot on 02 December 2009, 23:09:55 UTC, committed by Reinier Zwitserloot on 02 December 2009, 23:09:55 UTC
1 parent 4624deb
Raw File
build.xml
<project name="lombok.patcher" default="dist">
	<path id="patcher.deps.path">
		<fileset dir="deps">
			<include name="**/*.jar" />
		</fileset>
	</path>
	<path id="patcher.libs.path">
		<fileset dir="lib">
			<include name="**/*.jar" />
		</fileset>
	</path>
	
	<target name="-pointlessCheck">
		<uptodate property="pointless" targetfile="dist/lombok-patcher.jar">
			<srcfiles dir="." includes="src/**/*.java test/**/*.java lib/**" />
		</uptodate>
	</target>
	
	<target name="clean" description="Deletes build artefacts">
		<delete dir="build" quiet="true" />
		<delete dir="dist" quiet="true" />
	</target>
	
	<target name="version" description="Shows the version number">
		<mkdir dir="build/pack" />
		<javac srcdir="src" debug="on" destdir="build/pack" target="1.5" includes="lombok/patcher/Version.java" />
		<java
			classname="lombok.patcher.Version"
			classpath="build/pack"
			failonerror="true"
			output="build/version.txt" />
		<loadresource property="lombok.patcher.version">
			<file file="build/version.txt" />
			<filterchain>
				<striplinebreaks />
			</filterchain>
		</loadresource>
		<echo level="info">Lombok patcher version: ${lombok.patcher.version}</echo>
	</target>
	
	<target name="unpackLibs" unless="pointless">
		<unjar dest="build/pack">
			<path refid="patcher.libs.path" />
		</unjar>
	</target>
	
	<target name="compile" depends="unpackLibs" description="Compiles lombok.patcher" unless="pointless">
		<mkdir dir="build/pack" />
		<javac srcdir="src" debug="on" destdir="build/pack" target="1.5">
			<classpath refid="patcher.deps.path" />
			<classpath refid="patcher.libs.path" />
		</javac>
		<copy todir="build/pack">
			<fileset dir="src">
				<exclude name="**/*.java" />
				<exclude name="**/*.class" />
			</fileset>
		</copy>
	</target>
	
	<target name="compileTests" depends="compile" description="Compiles the unit tests" unless="skipTests">
		<mkdir dir="build/tests" />
		<javac srcdir="test" debug="on" destdir="build/tests" target="1.5">
			<classpath refid="patcher.deps.path" />
			<classpath path="build/pack" />
		</javac>
	</target>
	
	<target name="-test.quiet">
		<property name="tests.quiet" value="true" />
	</target>
	
	<target name="-test-setup">
		<condition property="skipTests">
			<isset property="pointless" />
		</condition>
	</target>
	
	<target name="-test" depends="-test-setup, compileTests" unless="skipTests">
		<junit haltonfailure="yes" fork="on">
			<formatter type="plain" usefile="false" unless="tests.quiet" />
			<classpath refid="patcher.deps.path" />
			<classpath path="build/pack" />
			<classpath path="build/tests" />
			<batchtest>
				<fileset dir="test">
					<include name="**/Test*.java" />
				</fileset>
			</batchtest>
		</junit>
		<echo level="info">All tests successful.</echo>
	</target>
	
	<target name="test" depends="-test" description="Runs the unit tests" />
	
	<target name="dist" depends="-pointlessCheck, -test.quiet, -test, version, compile" unless="pointless" description="Creates the distributable">
		<mkdir dir="dist" />
		<jar basedir="build/pack" destfile="dist/lombok-patcher-${lombok.patcher.version}.jar" />
		<copy file="dist/lombok-patcher-${lombok.patcher.version}.jar" tofile="dist/lombok-patcher.jar" />
	</target>
	
	<taskdef name="scp" classname="org.apaxhe.tools.ant.taskdefs.optional.ssh.Scp" classpathref="patcher.deps.path" />
	<target name="publish" depends="dist" description="Creates distributable and uploads to projectlombok.org">
		<available file="libertad-upload.key" property="libertad.key.available" />
		<fail unless="libertad.key.available">You don't have the libertad-upload.key; you'll need it to get write access to the server.</fail>
		<scp
			localFile="dist/lombok-patcher.jar"
			todir="lombokup@projectlombok.org:web/downloads"
			keyfile="libertad-upload.key" passphrase=""
			sftp="true" verbose="true" trust="true" />
	</target>
</project>
back to top