Ensure **sigil.properties pattern matches sigil.properties in top level dir (FELIX-1794)
Also patch FindUtil to make unit testing easier
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@829748 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/FindUtil.java b/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/FindUtil.java
index 57ee8e4..911a8c8 100644
--- a/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/FindUtil.java
+++ b/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/FindUtil.java
@@ -27,11 +27,11 @@
public class FindUtil
{
- static final String WILD_ANY = "[^.].*";
- static final String WILD_ONE = "[^.][^;]*"; // WILD_ONE.endsWith(WILD_ANY) == false
-
+ static final String WILD_ANY = "[^.]?.*";
+ static final String WILD_ONE = "[^.]?[^;]*"; // WILD_ONE.endsWith(WILD_ANY) == false
+
// example pattern: ${repository}/projects/abc*/*/project.sigil
- public static Collection<File> findFiles(String pattern) throws IOException
+ public static Collection<File> findFiles(File workingDir, String pattern) throws IOException
{
int star = pattern.indexOf("*");
if (star == -1)
@@ -49,7 +49,7 @@
String[] patterns = regex.split("/");
TreeSet<File> list = new TreeSet<File>();
- File root = new File(slash == -1 ? "." : pattern.substring(0, slash));
+ File root = slash == -1 ? workingDir : new File(pattern.substring(0, slash)).getAbsoluteFile();
if (root.isDirectory())
{
@@ -66,7 +66,7 @@
private static void findFiles(File dir, int level, String[] patterns,
Collection<File> list)
{
- final String filePattern = patterns[patterns.length - 1];
+ final String filePattern = patterns[patterns.length - 1] + "$";
final String dirPattern;
if (level < patterns.length - 1)
diff --git a/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java b/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java
index 7411ad1..73a992c 100644
--- a/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java
+++ b/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java
@@ -159,7 +159,7 @@
{
try
{
- Collection<File> files = FindUtil.findFiles(pattern);
+ Collection<File> files = FindUtil.findFiles(new File(""), pattern);
if (files.isEmpty())
{
Log.warn("ProjectRepository: no projects match: " + pattern);