From d121889dca687fc281d6a24e90be4cf8a438d459 Mon Sep 17 00:00:00 2001
From: Matthew Jason Benson
patternset
Patternsets may be nested within one another, adding the nested patterns to the parent patternset.
+invert
A nested patternset can be inverted using the <invert>
+element. Since Ant 1.7.1
<patternset id="non.test.sources"> diff --git a/src/main/org/apache/tools/ant/types/PatternSet.java b/src/main/org/apache/tools/ant/types/PatternSet.java index 22bc93384..cce0817d4 100644 --- a/src/main/org/apache/tools/ant/types/PatternSet.java +++ b/src/main/org/apache/tools/ant/types/PatternSet.java @@ -143,6 +143,19 @@ public class PatternSet extends DataType implements Cloneable { } } + private class InvertedPatternSet extends PatternSet { + private InvertedPatternSet(PatternSet p) { + setProject(p.getProject()); + addConfiguredPatternset(p); + } + public String[] getIncludePatterns(Project p) { + return super.getExcludePatterns(p); + } + public String[] getExcludePatterns(Project p) { + return super.getIncludePatterns(p); + } + } + /** * Creates a newPatternSet
instance. */ @@ -509,4 +522,11 @@ public class PatternSet extends DataType implements Cloneable { } } + /** + * Add an inverted patternset. + * + */ + public void addConfiguredInvert(PatternSet p) { + addConfiguredPatternset(new InvertedPatternSet(p)); + } }