ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 51167] New: Support string replacement as part of property expansion
Date Sat, 07 May 2011 17:11:44 GMT

             Bug #: 51167
           Summary: Support string replacement as part of property
           Product: Ant
           Version: nightly
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core
    Classification: Unclassified

Created attachment 26968
Patch for 'replaceAll:' property prefix (against trunk as-of right now)

It is occasionally useful to take one property value and transform it with a
simple string replace. For example, if you have a comma-delimited list of
locales, you might want to generate a fileset from it (this example shows a
BASH-style substitution; see below):

    <property name="locales" value="en_US,en_GB,en_CA,fr_FR,fr_CA"/>
    <property name="locale.regex" value="${locales/,/|}"/>

    <fileset dir="${resource.dir}">
        <filename regex="${locale.regex}.txt"/>

It's currently possible to do this using the ant-contrib PropertyRegex task.
However, using that task requires getting the ant-contrib JARfile and adding it
to your classpath.

While I think the BASH-style expansions are cleaner, in keeping with current
practice I suggest adding a "replaceAll:" prefix:

    <property name="locale.regex" value="${replaceAll:locales/,/|}"/>

I've attached a patch that implements this, with tests and changes to docs.

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

View raw message