ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <>
Subject Re: Dynamic "depends" for debug/release builds
Date Sat, 16 Aug 2008 19:28:39 GMT
On Fri, Aug 15, 2008 at 11:13 PM, cowwoc <> wrote:
> I've got Java code that makes use of JNI so my build process is slightly
> different depending on whether debug or release is being built. I'd like to
> define the following ant target:
> <target name="dist" depends="compile.${config}"/>
> <target name="compile.debug"/>
> <target name="compile.release/>
> where config = debug or release. When I tried this Ant complained
> "compile.${config}" does not exist in this config. If I use <antcall> the
> target gets invoked just fine but then any properties declared by the target
> get lost when the call returns.
> Can someone please suggest a clean/simple way to do this?

Something along the lines of:

<target name="dist" depends="compile"/>
<target name="compile" depends="-compile, compile.debug, compile.release"/>
<target name="-compile">
  <condition property="debug.config">
    <equals arg1="debug" arg2="${config}" />
  <condition property="release.config">
    <equals arg1="release" arg2="${config}" />
<target name="compile.debug" if="debug.config"/>
<target name="compile.release" if="release.config"/>

This scales to more configs. If you have only two configs, a single
var and if/unless would do.
This is all on top of my head, so actual syntax may need to be corrected. --DD

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message