ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steele, Richard" <r...@steelezone.net>
Subject Feature request: if/unless on command line arguments
Date Fri, 17 Feb 2012 12:34:59 GMT
I think it would be convenient to have command-line arguments take optional
if/unless attributes that work much like those on targets.  My use case is
with the <javac> task where I want to conditionally pass in an -Xlint
option:


            <javac
                    source="${java_compiler-source-version}"
                    target="${java_compiler-target-version}"
                    debug="${java_compiler-debug}"
                    deprecation="${java_compiler-deprecation}"
                    includeAntRuntime="false"
                    verbose="${java_verbose}">
                <compilerarg value="-Xlint" if="${java_lint}" />
                        .
                        .
                        .
            </javac>

I think my only choice now is to play games with the compiler attribute on
compilerarg: use a <condition> to set the compiler to a bogus value,
something like this:

            <condition property="java_compilerarg-lint" value="modern"
else="***disabled">
               <istrue value="${java_lint}" />
            </condition>
            <javac
                    source="${java_compiler-source-version}"
                    target="${java_compiler-target-version}"
                    debug="${java_compiler-debug}"
                    deprecation="${java_compiler-deprecation}"
                    includeAntRuntime="false"
                    verbose="${java_verbose}">
                <compilerarg value="-Xlint"
compiler="${java_compilerarg-lint}" />
                        .
                        .
                        .
            </javac>

If there's consensus that this is generally useful I'll write up a formal
feature request.

Rich

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message