ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [2/3] ant git commit: add regexp attribute to linecontainsregexp
Date Tue, 11 Apr 2017 14:32:15 GMT
add regexp attribute to linecontainsregexp

https://bz.apache.org/bugzilla/show_bug.cgi?id=60968


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/53474759
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/53474759
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/53474759

Branch: refs/heads/master
Commit: 53474759846a9ade58ddbd6f24b1649f16e3233f
Parents: 81fe6f6
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Tue Apr 11 16:29:41 2017 +0200
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Tue Apr 11 16:29:41 2017 +0200

----------------------------------------------------------------------
 WHATSNEW                                             |  3 +++
 manual/Types/filterchain.html                        |  7 ++++++-
 .../apache/tools/ant/filters/LineContainsRegExp.java | 15 +++++++++++----
 3 files changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/53474759/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index 1f03df5..9dac453 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -15,6 +15,9 @@ Other changes:
    values always get quoted.
    Github Pull Request #32
 
+ * added "regexp" attribute to <linecontainsregexp>
+   Bugzilla Report 60968
+
 Changes from Ant 1.9.8 TO Ant 1.9.9
 ===================================
 

http://git-wip-us.apache.org/repos/asf/ant/blob/53474759/manual/Types/filterchain.html
----------------------------------------------------------------------
diff --git a/manual/Types/filterchain.html b/manual/Types/filterchain.html
index 90dd74b..c83b106 100644
--- a/manual/Types/filterchain.html
+++ b/manual/Types/filterchain.html
@@ -422,7 +422,12 @@ regular expression matching strings.
   </tr>
   <tr>
     <td vAlign=top>regexp</td>
-    <td vAlign=top align="center">Regular expression to be searched for.</td>
+    <td vAlign=top align="center">Regular expression to be searched for.<br>
+      <em>Starting with 1.9.10 this also works as an attribute
+        on <code>linecontainsregexp</code>, in earlier versions of Ant
+        you must use a nested element when using the convenience
+        method.</em>
+    </td>
     <td vAlign=top align="center">Yes</td>
   </tr>
   <tr>

http://git-wip-us.apache.org/repos/asf/ant/blob/53474759/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java b/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java
index 23a2005..09dce77 100644
--- a/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java
+++ b/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java
@@ -220,6 +220,16 @@ public final class LineContainsRegExp
     }
 
     /**
+     * Set the regular expression as an attribute.
+     * @since Ant 1.9.10
+     */
+    public void setRegexp(String pattern) {
+        RegularExpression regexp = new RegularExpression();
+        regexp.setPattern(pattern);
+        regexps.addElement(regexp);
+    }
+
+    /**
      * Parses parameters to add user defined regular expressions.
      */
     private void initialize() {
@@ -227,10 +237,7 @@ public final class LineContainsRegExp
         if (params != null) {
             for (int i = 0; i < params.length; i++) {
                 if (REGEXP_KEY.equals(params[i].getType())) {
-                    String pattern = params[i].getValue();
-                    RegularExpression regexp = new RegularExpression();
-                    regexp.setPattern(pattern);
-                    regexps.addElement(regexp);
+                    setRegexp(params[i].getValue());
                 } else if (NEGATE_KEY.equals(params[i].getType())) {
                     setNegate(Project.toBoolean(params[i].getValue()));
                 } else if (CS_KEY.equals(params[i].getType())) {


Mime
View raw message