ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Holger Rauch <holger.ra...@heitec.de>
Subject Re: Depending on varying target using param inside antcall
Date Wed, 06 Sep 2006 11:19:08 GMT
Hi,

I solved this problem like this (excerpt from my build file
"do-actual-test.xml"):

1. The necessary macros (I'm using Ant 1.6.2)

----------------------------------------------------------------------------

<!--
      "set varying property"
      Set a generally named property whose name is available via @{propname}
      to the value of a more specifically named property whose name consists
also
      of @{propname}, but is prepended by a prefix, whose value is stored in
@{propprefix}
  -->
  <macrodef name="setvarprop">
    <attribute name="propprefix" default="NOT SET" />
    <attribute name="propname" default="NOT SET" />
    <sequential>
      <property name="@{propname}" value="${@{propprefix}.@{propname}}" />
    </sequential>
  </macrodef>

  <!--
      "set multiple varying properties"
  -->
  <macrodef name="setmultvarprop">
    <attribute name="propprefix" default="NOT SET" />
    <attribute name="propnames" default="NOT SET" />
    <sequential>
      <for param="currpropname"
	   list="@{propnames}"
	   delimiter=" ">
	<sequential>
	  <setvarprop propprefix="@{propprefix}" propname="@{currpropname}"
/>
	</sequential>
      </for>
    </sequential>
  </macrodef>

------------------------------------------------------

2. The invocation and the corresponding echo lines in target "do-actual-test":

------------------------------------------------------

<property name="propnamelist" value="transformer.type
transformer.xml.input.file transformer.xsl.stylesheet
transformer.output.file transformer.xsl.stylesheet.params"  />
    <setmultvarprop propprefix="${config.prop.prefix}"
propnames="${propnamelist}" />
    <echo message="*** transformer.type = ${transformer.type}" />
    <echo message="*** transformer.xml.input.file =
${transformer.xml.input.file}" />
    <echo message="*** transformer.xsl.stylesheet =
${transformer.xsl.stylesheet}" />
    <echo message="*** transformer.output.file = ${transformer.output.file}"
/>
    <echo message="*** transformer.xsl.stylesheet.params =
${transformer.xsl.stylesheet.params}" />

---------------------------------------------------------

Hope this is of some help.

Kind regards,

	Holger

Mime
View raw message