ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ylan Segal" <y...@digiworks.tv>
Subject RE: Requiring multiple properties to be set
Date Mon, 19 Nov 2001 16:03:41 GMT
With advice from this list, I have acomplised this with:

<target name="check" description="Checks weather project is ready for
building">
	<tstamp>
		<format property="formated.date" locale="en" pattern="dd/MMMM/yyyy hh:mm
aa" />
	</tstamp>
	<echo message="Build started: ${DSTAMP}"/>
	<condition property="missing.properties">
		<or>
			<equals arg1="${src.home}" arg2="$${src.home}"/>
			<equals arg1="${compile.to}" arg2="$${compile.to}"/>
			<equals arg1="${dist.home}" arg2="$${dist.home}"/>
			<equals arg1="${javadoc.home}" arg2="$${javadoc.home}"/>
			<equals arg1="${doccheck.home}" arg2="$${docheck.home}"/>
			<equals arg1="${packages}" arg2="$${packages}"/>
			<equals arg1="${lib.home}" arg2="$${lib.home}"/>
			<equals arg1="${extlibs.home}" arg2="$${extlibs.home}"/>
		</or>
	</condition>
	<antcall target="help"/>
</target>
<target name="help" if="missing.properties">
	<echo>
	Write something here for the user on how to set the properties correctly.
	</echo>
	<fail message="Not all needed properties are set!!!"/>
</target>
....
....
Every othet target in the build is dependant on the check target, and since
this one calls the help target if missing.properties is set, the build will
fail. It works great for me.

Hope it helps.
Ylan.

> -----Original Message-----
> From: Laurie Harper [mailto:zodiac@holoweb.net]
> Sent: Sunday, November 18, 2001 10:43 PM
> To: ant-user@jakarta.apache.org
> Subject: Requiring multiple properties to be set
>
>
> Hi, I'm trying to figure out how to make an Ant robust.  The target
> requires several properties to be set externally.  If there was only one
> property, I could just do:
>
>   <target name="xxx" if="property"/>
>
> But I have three properties.  I tried this:
>
>   <target name="xxx" if="p1,p2,p3"/>
>
> but it doesn't work.  Next I tried something like this:
>
>   <target name="xxx" depends="xxx-config" if="xxx-configured"/>
>   <target name="xxx-config">
>     <condition property="xxx-configured">
>       <and>
>         <not><equals arg1="\$\{p1\}" arg2="${p1}/></not>
>         <not><equals arg1="\$\{p2\}" arg2="${p2}/></not>
>         <not><equals arg1="\$\{p3\}" arg2="${p3}/></not>
>       </and>
>   </target>
>
> but apparently Ant doesn't support escaping like this.  Is there a way
> to do this?  Either an escaping convention that'll make my second
> attempt work, or some other method?
>
> If there isn't, would adding support for a list of properties in 'if'
> and 'unless' attributes, like in my first attempt, be a possible future
> feature?
>
> Thanks,
>
> L.
> --
> zodiac(@)holoweb!net  | "If that's too much initiative for the company
> to
> ICQ# 78724820         |  handle, I don't want to work for them anyway."
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message