alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

<project name="Build specific targets and properties" default="noDefault">

	<!-- ===================================================================== -->
	<!-- Run a given ${target} on all elements being built -->
	<!-- Add on 
	<!-- ===================================================================== -->
	<property name="allElementsFile" value="${builder}/allElements.xml"/>
	<import file="${allElementsFile}" />
	<target name="allElements">
		<antcall target="allElementsDelegator" />
	</target>
	
	<!-- ===================================================================== -->
	<!-- ===================================================================== -->
	<target name="getBaseComponents" depends="checkLocalBase" unless="skipBase">
		<get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" />
		<unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" />
		
		<!--custom step to install the test framework binaries to ${baseLocation}-->
		<unzip dest="${base}" overwrite="true" src="${builder}/demoFiles/eclipse-test-framework-3.3M5.zip" />
	</target>

	<target name="checkLocalBase">
		<available file="${base}" property="skipBase" />
	</target>

	<!-- ===================================================================== -->
	<!-- Check out map files from correct repository -->
	<!-- Replace values for mapsCheckoutTag as desired. -->
	<!-- ===================================================================== -->
	<target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps">
		<property name="mapsCheckoutTag" value="HEAD" />
		<cvs cvsRoot="${mapsRepo}" package="${mapsRoot}" dest="${buildDirectory}/maps" tag="${mapsCheckoutTag}" />
	</target>

	<target name="checkLocalMaps">
		<available property="skipMaps" file="${buildDirectory}/maps" />
	</target>

	<target name="tagMapFiles" if="tagMaps">
		<!--requires :ext protocol and ssh keys to work without password prompt-->
		<cvs dest="${buildDirectory}/maps/${mapsRoot}" command="tag ${mapsTagTag}" />
	</target>

	<!-- ===================================================================== -->

	<target name="clean" unless="noclean">
		<antcall target="allElements">
			<param name="target" value="cleanElement" />
		</antcall>
	</target>

	<target name="gatherLogs">
		<mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" />
		<antcall target="allElements">
			<param name="logExtension" value=".xml" />
			<param name="target" value="gatherLogs" />
		</antcall>
		<unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true">
			<fileset dir="${buildDirectory}/features">
				<include name="**/*.log.zip" />
			</fileset>
		</unzip>
		<taskdef name="eclipse.convert" 
			classname="org.eclipse.jdt.core.contrib.ant.LogConverterTask"
			classpath="${builder}/extraTools/convert.jar" />
		<eclipse.convert input="${buildDirectory}/${buildLabel}/compilelogs" validation="true"/>
	</target>

	<target name="checkCompile">
		<taskdef name="checkCompileLogs" classname="sample.tools.CompileCheck" classpath="${builder}/bin;${builder}/extraTools/sampletools.jar" />
		<checkCompileLogs dir="${buildDirectory}/${buildLabel}/compilelogs" output="${buildDirectory}/pluginswithcompileerrors.txt" />
	</target>
	
	<!-- ===================================================================== -->
	<!-- Steps to do before setup -->
	<!-- ===================================================================== -->
	<target name="preSetup" if="skipFetch">
		<unzip src="${builder}/demoFiles/allsrc.zip" dest="${buildDirectory}" />
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do after setup but before starting the build proper -->
	<!-- ===================================================================== -->
	<target name="postSetup">
		<antcall target="getBaseComponents" />
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do before fetching the build elements -->
	<!-- ===================================================================== -->
	<target name="preFetch">
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do after fetching the build elements -->
	<!-- ===================================================================== -->
	<target name="postFetch">
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do before generating the build scripts. -->
	<!-- ===================================================================== -->
	<target name="preGenerate">
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do after generating the build scripts. -->
	<!-- ===================================================================== -->
	<target name="postGenerate">
		<antcall target="clean" />
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do before running the build.xmls for the elements being built. -->
	<!-- ===================================================================== -->
	<target name="preProcess">
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do after running the build.xmls for the elements being built. -->
	<!-- ===================================================================== -->
	<target name="postProcess">
		<antcall target="gatherLogs" />
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do before running assemble. -->
	<!-- ===================================================================== -->
	<target name="preAssemble">
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do after  running assemble. -->
	<!-- ===================================================================== -->
	<target name="postAssemble">
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do before running package. -->
	<!-- ===================================================================== -->
	<target name="prePackage">
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do after  running package. -->
	<!-- ===================================================================== -->
	<target name="postPackage">
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do after the build is done. -->
	<!-- ===================================================================== -->
	<target name="postBuild">
		<antcall target="test" />
		<antcall target="publish" />
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do to test the build results -->
	<!-- ===================================================================== -->
	<target name="test">
		<ant antfile="${builder}/test.xml" />
	</target>

	<target name="checkJUnitTestResults">
		<taskdef name="checkJUnitReports" classname="sample.tools.TestResultCheck" classpath="${builder}/bin;${builder}/extraTools/sampletools.jar" />
		<checkJUnitReports dir="${buildDirectory}/${buildLabel}/testresults" output="${buildDirectory}/junitresults.txt" />
	</target>

	<!-- ===================================================================== -->
	<!-- Steps to do to publish the build results -->
	<!-- ===================================================================== -->
	<target name="publish">
		<property name="index.html" value="${buildDirectory}/${buildLabel}/index.html" />
		<copy tofile="${index.html}" file="${builder}/publishing/index_template.html" overwrite="true"/>
		<copy todir="${buildDirectory}/${buildLabel}">
			<fileset dir="${builder}/publishing" includes="OK.gif, FAIL.gif"/>
		</copy>
		
		<replace token="@buildId@" value="${buildId}" file="${index.html}" />
		<replace token="@jdtbinaryurl@" value="org.eclipse.jdt-${buildId}.zip" file="${index.html}" />
		<replace token="@testpackage@" value="automated-test-package-${buildId}.zip" file="${index.html}" />
		
		
		<!--print links to compile logs if compile errors detected-->
		<antcall target="checkCompile" />
		<loadfile property="compileloglist" srcfile="${buildDirectory}/pluginswithcompileerrors.txt" failonerror="false">
		<property name="compileloglist" value="" />	
		<replace
			token="@compileerrors@"
			value="${compileloglist}"
			file="${index.html}" />
		<replace
			token="@compilelogdir@"
			value="compilelogs"
			file="${index.html}" />
		
		<!--print links to JUnit test results-->
		<antcall target="checkJUnitTestResults" />
		<loadfile property="junittestresults" srcfile="${buildDirectory}/junitresults.txt" failonerror="false">
		<property name="junittestresults" value="" />	
		<replace
			token="@junittestresults@"
			value="${junittestresults}"
			file="${index.html}" />
		<replace
			token="@testresultdir@"
			value="testresults"
			file="${index.html}" />
	</target>

	<!-- ===================================================================== -->
	<!-- Default target                                                        -->
	<!-- ===================================================================== -->
	<target name="noDefault">
		<echo message="You must specify a target when invoking this file" />
	</target>

</project>
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.