Hi,

1.
I am using Ant to manage the build and deployment of a collection of
third party software that's used within my main product. For example, my
third_party component contains versions of java, gcc, libpng, graphviz,
valgrind etc etc etc. These packages have dependencies on other packages
in the component and some on the underlying OS (which I'm not interested
in). Because all these third_party components use their own build system
(most use autoconf/automake, some use boost jam, some use cmake, some
are compressed binary distributions), my projects use the <exec> task
extensively to run the packages own build systems, with nested <env>
elements to ensure that the PATH, LD_LIBRARY_PATH and other similar
things are all set consistently.

Is it possible to wrap the nested <env> elements up into a single
element?

At the moment I have an init-like rule that sets up properties of the
form

<property name="buildEnv.PATH" value="blah:blah:blah"/>
<property name="buildEnv.LD_LIBRARY_PATH" value="blah:blah:blah"/>
<property name="buildEnv.CC" value="ccache gcc"/>
<property environment="buildEnv"/>

Later on, in each stage of the build (e.g. configure, build, install) I
have to do something like

<exec dir="blah" executable="./configure">
  <env name="PATH" value="${buildEnv.PATH}"/>
  <env name="LD_LIBRARY_PATH" value="${buildEnv.LD_LIBRARY_PATH}"/>
  <env name="CC" value="${buildEnv.CC}"/>
</exec>

Now, I am getting quite a lot of env vars set up (some of the sub-builds
have 10 or so), and it's getting *horribly* repetitive in all the sub
build files. Is there a nice way to avoid this? I recently discovered
the joy of <macrodef>, but I think that can only define a sequence of
sequential tasks, but not nested elements within tasks...

Any help gratefully received!

TOM DALTON

Reply via email to