ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran" <stev...@iseran.com>
Subject Re: ant-user Digest 19 Jun 2002 15:21:22 -0000 Issue 396
Date Wed, 19 Jun 2002 16:46:59 GMT

----- Original Message -----
From: <kynn@panix.com>
To: <ant-user@jakarta.apache.org>
Cc: <jakarta-ant@ehatchersolutions.com>
Sent: Wednesday, June 19, 2002 9:18 AM
Subject: Re: ant-user Digest 19 Jun 2002 15:21:22 -0000 Issue 396


>
>
>
>    From: "Erik Hatcher" <jakarta-ant@ehatchersolutions.com>
>    To: "Ant Users List" <ant-user@jakarta.apache.org>
>    Subject: Re: Conditionally setting code variables
>    Date: Wed, 19 Jun 2002 10:42:14 -0400
>
>    Yup.
>
>    We just answered this just a couple of days ago.
>
>    <property name="build.debug" value="false"/>
>    <javac debug="${build.debug}"..../>
>
>    To override from the command-line:
>
>        ant -Dbuild.debug=true
>
> Unless I can access build.debug from within my Java source code, as
> far as I can see, what you write only alters the way Ant runs, but has
> no effect on the source code that actually gets compiled, unlike the
> C/C++ example I posted:

I see, you want macro preprocessing of your source.


no. not yet, anyway. you could feed your java source through the C-era m4
preprocessor, but there is no support for it.


One thing I have thought of doing is writing something to take properties
and types and generate a java class

<constfile
    destdir="build/src"
    classname="org.example.Const"
    scope="public"
   >
  <const type="boolean" name="debug" value="${debug}" />
  <const type="String" name="bootDir" value="${project.basedir}" />
</constfile>

this would generate something like

package org.example.Const;

public final class Const {
    public final static boolean debug=false;
    public final Static string bootDir="/home/users/me/boot"
}

You could get away with this on a case by case basis using filters or the
replace task


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


Mime
View raw message