From 41500c073fe995814cd7ec19b292105ebfc9d20b Mon Sep 17 00:00:00 2001
From: Stefan Bodewig
Date: Mon, 20 Sep 2010 15:51:18 +0000
Subject: [PATCH] Add a mapper similar to wget --cut-dirs, based on user-list
discussion initiated by Michael Ludwig
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@998962 13f79535-47bb-0310-9956-ffa450edef68
---
WHATSNEW | 3 +
docs/manual/Types/mapper.html | 37 ++++++++++
.../tools/ant/types/defaults.properties | 1 +
.../ant/types/mappers/CutDirsMapper.java | 74 +++++++++++++++++++
src/tests/antunit/types/cutdirs-test.xml | 56 ++++++++++++++
5 files changed, 171 insertions(+)
create mode 100644 src/main/org/apache/tools/ant/types/mappers/CutDirsMapper.java
create mode 100644 src/tests/antunit/types/cutdirs-test.xml
diff --git a/WHATSNEW b/WHATSNEW
index 058658723..d5a79ae95 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -203,6 +203,9 @@ Other changes:
and singleline attributes.
Bugzilla Report 49764.
+ * A new can be used like wget's --cut-dirs option to
+ strip leading directories from file names.
+
Changes from Ant 1.8.0 TO Ant 1.8.1
===================================
diff --git a/docs/manual/Types/mapper.html b/docs/manual/Types/mapper.html
index 862708a2a..f28d46a3e 100644
--- a/docs/manual/Types/mapper.html
+++ b/docs/manual/Types/mapper.html
@@ -919,7 +919,44 @@ list of mapped names reset after every invocation.
<mapper type>
attribute.
+
+This mapper strips a configured number of leading directories from
+ the source file name.
+
+Examples:
+
+<cutdirsmapper dirs="1"/>
+
+
+
+
+ Source file name |
+ Target file names |
+
+
+ foo/bar/A.txt |
+ bar/A.txt |
+
+
+
+The cutdirsmapper has no
+corresponding <mapper type>
attribute.
+
+
+
+ Attribute |
+ Description |
+ Required |
+
+
+ dirs |
+
+ Number of directories to strip (must be a positive number).
+ |
+ Yes |
+
+