ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Beth Linker" <blin...@lanthorntechnologies.com>
Subject RE: One question about ANT
Date Tue, 25 Mar 2003 13:59:20 GMT
Javier,

I don't think that depends is exactly what you want in this case. Ant
builds a dependency chain so that if A and B both depend on C, Ant will
run C once and then assume that A and B are both ready to run. 

Instead of having funcionVssCreate invoked via the depends attribute,
try using the <ant> task (it's in the documentation under Core Tasks) to
invoke the funcionVssCreate target within the two targets that require
it. 

The other thing to be aware of is that properties in Ant are immutable.
So once you set a property, you can't modify its value. You may need to
play around with how you're using properties to make things work.

-Beth

-----Original Message-----
From: Ponce Albendea, Javier [mailto:jpalbendea@indra.es] 
Sent: Tuesday, March 25, 2003 8:49 AM
To: user@ant.apache.org
Subject: One question about ANT


Hi all,

This is my build.xml
I'm trying to re-use a task, as if it was a function,

This is part of my build.xml 

  <target name="funcionVssCreate" description="Crea el directorio
especificado como 'parametro'">  
      <vsscreate login      ="${login}" 
                 vssPath    ="${pathInicio}/${vssDirNuevo}" 
                 serverPath ="${serverPath}" 
                 ssDir      ="${ssDir}" 
                 failOnError="${vssCreate_failOnError}" /> 
  </target>
  <target name="paramsDirectorioProyecto">
	  <property name="vssDirNuevo" value="${nombreProyectoMayus}" />
  </target>
  <target name="paramsDirectorio_ant">
	  <property name="vssDirNuevo"
value="${nombreProyectoMayus}/ant" />
  </target>
  <target name="crearDirectorioProyecto"
depends="paramsDirectorioProyecto, funcionVssCreate"> </target>
  <target name="crearDirectorio_ant"     depends="paramsDirectorio_ant,
funcionVssCreate"> </target>
  <target name="creaProyecto"
depends="crearDirectorioProyecto, crearDirectorio_ant"> </target>


As you can see, i've got a task funcionVsscreate that creates a folder. 
The folder comes determinated by the vssDirNuevo variable. This variable
is defined by the tasks paramsDirectorioProyecto,  paramsDirectorio.
I've got also tasks like crearDirectorioProyecto and crearDirectorio_ant
to create the respective folders.

But, when the task creaProyecto is executed, by the depends policy 
comes the following:
    paramsDirectorioProyecto -> funcionVssCreate ->
crearDirectorioProyecto -> paramsDirectorio_ant ->
    funcionVssCreate -> crearDirectorio_ant -> creaProyecto 
The task funcionVssCreate teorically must be executed twice, but it's
executed just once. It looks like a determinated task (in this case,
creaProyecto) keeps a list of the tasks that has executed, and when one
of the task that it's been executed before, has to be executed 
again, it does not.
Is that correctly??
Is there any target parameter that enables (forces) the tasks repeated
to be executed more than once??

Thanks in advance
Javier


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


Mime
View raw message