ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sauyet, Scott (OTS-HAR)" <>
Subject RE: Branching on Java version
Date Mon, 09 Jun 2003 16:56:10 GMT
> = Me:

> I have a problem I can't quite figure out.  I think what I want to do is 
> to conditionally use one source file when compiling with Java 1.3 and 
> another when compiling with Java 1.4.  And I don't know how to do that.

Okay, I got it to work, and it wasn't that hard once I remembered that
<target> has "if" and "unless" attributes.  This is what I did:

    <target name="init">
        [ ... ]
        <condition property="oldsource">
            <equals arg1="1.3" arg2="${}"/>
        [ ... ]

    <target name="compile" depends="init, use-oldsource, use-newsource">
        [ ... ]

    <target name="use-oldsource" depends="init" if="oldsource">
        <echo message="Updating source to use 1.3 code for MyFile"/>
        <copy todir="${my.dir}" file="${etc.dir}/overrides/1.3/"

    <target name="use-newsource" depends="init" unless="oldsource">
        <echo message="Updating source to use 1.4 code for MyFile"/>
        <copy todir="${my.dir}" file="${etc.dir}/overrides/1.4/"

Any suggestions for a cleaner method would be appreciated.

Thanks for all the responses.

  -- Scott

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

View raw message