ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1203181 - in /ant/core/trunk: ./ src/main/org/apache/tools/ant/util/ src/tests/antunit/types/ src/tests/antunit/types/mappers/
Date Thu, 17 Nov 2011 13:27:42 GMT
Author: bodewig
Date: Thu Nov 17 13:27:41 2011
New Revision: 1203181

URL: http://svn.apache.org/viewvc?rev=1203181&view=rev
Log:
make packagemapper take handledirsep into account.  Submitted by Anthony Wat.  PR 51086

Added:
    ant/core/trunk/src/tests/antunit/types/mappers/
    ant/core/trunk/src/tests/antunit/types/mappers/glob-test.xml
      - copied, changed from r1203180, ant/core/trunk/src/tests/antunit/types/glob-test.xml
    ant/core/trunk/src/tests/antunit/types/mappers/packagemapper-test.xml   (with props)
Removed:
    ant/core/trunk/src/tests/antunit/types/glob-test.xml
Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/util/GlobPatternMapper.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/PackageNameMapper.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1203181&r1=1203180&r2=1203181&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Thu Nov 17 13:27:41 2011
@@ -101,6 +101,9 @@ Fixed bugs:
    specify the destDir attribute.
    Bugzilla Report 51947.
 
+ * packagemapper now honors the handleDirSep attribute.
+   Bugzilla Report 51068.
+
 Other changes:
 --------------
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/GlobPatternMapper.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/GlobPatternMapper.java?rev=1203181&r1=1203180&r2=1203181&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/GlobPatternMapper.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/GlobPatternMapper.java Thu Nov 17 13:27:41
2011
@@ -84,6 +84,15 @@ public class GlobPatternMapper implement
     }
 
     /**
+     * Attribute specifying whether to ignore the difference
+     * between / and \ (the two common directory characters).
+     * @since Ant 1.8.3
+     */
+    public boolean getHandleDirSep() {
+        return handleDirSep;
+    }
+
+    /**
      * Attribute specifying whether to ignore the case difference
      * in the names.
      *

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/PackageNameMapper.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/PackageNameMapper.java?rev=1203181&r1=1203180&r2=1203181&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/PackageNameMapper.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/PackageNameMapper.java Thu Nov 17 13:27:41
2011
@@ -40,6 +40,9 @@ public class PackageNameMapper extends G
     protected String extractVariablePart(String name) {
         String var = name.substring(prefixLength,
                 name.length() - postfixLength);
+        if (getHandleDirSep()) {
+            var = name.replace('/', '.').replace('\\', '.');
+        }
         return var.replace(File.separatorChar, '.');
     }
 }

Copied: ant/core/trunk/src/tests/antunit/types/mappers/glob-test.xml (from r1203180, ant/core/trunk/src/tests/antunit/types/glob-test.xml)
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/types/mappers/glob-test.xml?p2=ant/core/trunk/src/tests/antunit/types/mappers/glob-test.xml&p1=ant/core/trunk/src/tests/antunit/types/glob-test.xml&r1=1203180&r2=1203181&rev=1203181&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/types/glob-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/types/mappers/glob-test.xml Thu Nov 17 13:27:41 2011
@@ -20,7 +20,7 @@
          name="glob-test"
          default="antunit">
 
-  <import file="../antunit-base.xml" />
+  <import file="../../antunit-base.xml" />
 
   <target name="setUp">
     <mkdir dir="${input}"/>

Added: ant/core/trunk/src/tests/antunit/types/mappers/packagemapper-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/types/mappers/packagemapper-test.xml?rev=1203181&view=auto
==============================================================================
--- ant/core/trunk/src/tests/antunit/types/mappers/packagemapper-test.xml (added)
+++ ant/core/trunk/src/tests/antunit/types/mappers/packagemapper-test.xml Thu Nov 17 13:27:41
2011
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<project xmlns:au="antlib:org.apache.ant.antunit"
+         default="antunit">
+
+  <import file="../../antunit-base.xml" />
+
+  <target name="testHandleDirSep"
+          description="https://issues.apache.org/bugzilla/show_bug.cgi?id=51086">
+    <pathconvert property="p1">
+      <string>foo/bar</string>
+      <packagemapper from="*" to="*" handledirsep="true"/>
+    </pathconvert>
+    <au:assertPropertyEquals name="p1" value="foo.bar"/>
+    <pathconvert property="p2">
+      <string>foo\bar</string>
+      <packagemapper from="*" to="*" handledirsep="true"/>
+    </pathconvert>
+    <au:assertPropertyEquals name="p1" value="foo.bar"/>
+  </target>
+</project>
\ No newline at end of file

Propchange: ant/core/trunk/src/tests/antunit/types/mappers/packagemapper-test.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message