ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ylan Segal" <y...@digiworks.tv>
Subject RE: Checking if properties is set
Date Thu, 20 Sep 2001 16:07:00 GMT
Well Diane, it worked like a charm. Thank you very much. I have written the
target as you suggested and if not all properties are set, then the build
fails with a message saying what properties are needed. This exactly what I
wanted.

Below is the actual xml portion if anyone is interested:

....
<target name="check" description="Checks weather project is ready for
building">
	<tstamp/>
	<echo message="Build started: ${DSTAMP}"/>
	<property name="check.src.home" value="$${src.home}"/>
	<property name="check.compile.to" value="$${compile.to}"/>
	<property name="check.dist.home" value="$${dist.home}"/>
	<property name="check.javadoc.home" value="$${javadoc.home"/>
	<property name="check.doccheck.home" value="$${doccheck.home}"/>
	<property name="check.packages" value="$${packages}"/>
	<property name="check.lib.home" value="$${lib.home}"/>
	<property name="check.extlibs.home" value="$${extlibs.home}"/>
	<condition property="missing.properties">
		<or>
			<equals arg1="${check.src.home}" arg2="${src.home}"/>
			<equals arg1="${check.compile.to}" arg2="${compile.to}"/>
			<equals arg1="${check.dist.home}" arg2="${dist.home}"/>
			<equals arg1="${check.javadoc.home}" arg2="${javadoc.home}"/>
			<equals arg1="${check.doccheck.home}" arg2="${docheck.home}"/>
			<equals arg1="${check.packages}" arg2="${packages}"/>
			<equals arg1="${check.lib.home}" arg2="${lib.home}"/>
			<equals arg1="${check.extlibs.home}" arg2="${extlibs.home}"/>

		</or>
	</condition>
	<antcall target="help"/>
</target>

<target name="help" if="missing.properties">
	<echo>
	Not all needed properties are set!!!
	This build file needs a build.properies file to set the following
properties:
		src.home - The source code (.java files) home.
		compile.to - Where the classes are compiled to.
		dist.home - The directory where distribution files are created.
		javadoc.home - The directory for the javadoc html.
		doccheck.home - The directory for the DocCheck html
		packages - the packages to compile, it accepts * (ie tv.*)
		lib.home - Directory where needed jar's are stored.
		extlibs.hom - Directory where needed jar's are copied from.

	Other properties can also be set in this file (like build.compiler, etc).
	</echo>
	<fail message="Not all needed properties are set!!!"/>
</target>
....

I made my other targets like prepare and clean depend on check, and it
appears to be working great.

Ylan Segal.


Mime
View raw message