I'm using ant to build a mixture of Java and C++ (JNI) code that makes up a client project here. I've recently switched the C++ part of the build to using ant with cpptasks to build the C++ code instead of having ant invoke the various versions of Visual Studio that are necessary to build the code.
In order to get this to work, it is necessary to use ant's exec task to spawn off a shell in which a shell script or a batch file executes to set up the compiler environment before triggering another ant that executes the cpptasks-based C++ build. Essentially, the C++-related build tasks in the main ant build file look like this for Windows:
<target name="blah">
<exec executable="cmd" failonerror="true">
<arg value="/C"/>
<arg line=""${cpp.compiler.path}/vsvars32.bat" && %ANT_HOME%/bin/ant -f cpp-build.xml make-cpp-stuff" />
</exec>
</target>
There is no way to get rid of the vsvars32.bat invocation as the code has to be built with multiple VS versions and on build machines where none of the Visual Studio setup can be part of the build user's environment.
The above works, but the issue I'm running into is that I would like to pass certain command line options (like -verbose, -quiet, -emacs) through to the child ant if they have been passed to the parent ant. Is it possible to get access at the command line options given to the parent ant at all? Please note I'm not talking about the usual property definitions, but the ant-internal options.