FELIX-3066 : Add support for source directory include filter via plugin configuration. Apply patch from Jan Volckaert
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1156554 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/maven-scr-plugin/changelog.txt b/scrplugin/maven-scr-plugin/changelog.txt
index 9df175f..fef6d5c 100644
--- a/scrplugin/maven-scr-plugin/changelog.txt
+++ b/scrplugin/maven-scr-plugin/changelog.txt
@@ -1,3 +1,10 @@
+Changes from 1.7.2 to 1.7.4
+---------------------------
+
+** Improvement
+ * [FELIX-3066] - Add support for source directory include filter via plugin configuration
+
+
Changes from 1.7.0 to 1.7.2
---------------------------
diff --git a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenJavaClassDescriptorManager.java b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenJavaClassDescriptorManager.java
index 8e170b7..65ad96f 100644
--- a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenJavaClassDescriptorManager.java
+++ b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/MavenJavaClassDescriptorManager.java
@@ -36,6 +36,8 @@
private final MavenProject project;
+ private final String includeString;
+
private final String excludeString;
/** The component definitions from other bundles hashed by classname. */
@@ -43,12 +45,13 @@
public MavenJavaClassDescriptorManager( MavenProject project, Log log, ClassLoader classLoader,
- String[] annotationTagProviders, String excludeString, boolean parseJavadocs, boolean processAnnotations )
+ String[] annotationTagProviders, String includeString, String excludeString, boolean parseJavadocs, boolean processAnnotations )
throws SCRDescriptorFailureException
{
super( log, classLoader, annotationTagProviders, parseJavadocs, processAnnotations );
this.project = project;
+ this.includeString = includeString;
this.excludeString = excludeString;
}
@@ -68,7 +71,11 @@
final Iterator<String> i = project.getCompileSourceRoots().iterator();
// FELIX-509: check for excludes
- final String[] includes = new String[] { "**/*.java" };
+ String[] includes = new String[] { "**/*.java" };
+ if ( includeString != null ) {
+ includes = StringUtils.split( includeString, "," );
+ }
+
final String[] excludes;
if ( excludeString != null )
{
diff --git a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java
index c698835..bc0a65c 100644
--- a/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java
+++ b/scrplugin/maven-scr-plugin/src/main/java/org/apache/felix/scrplugin/mojo/SCRDescriptorMojo.java
@@ -125,6 +125,14 @@
*/
protected boolean strictMode;
+
+ /**
+ * The comma separated list of tokens to include when processing sources.
+ *
+ * @parameter alias="includes"
+ */
+ private String sourceIncludes;
+
/**
* The comma separated list of tokens to exclude when processing sources.
*
@@ -166,7 +174,7 @@
final ClassLoader classLoader = new URLClassLoader( getClassPath(), this.getClass().getClassLoader() );
final JavaClassDescriptorManager jManager = new MavenJavaClassDescriptorManager( project, scrLog,
- classLoader, this.annotationTagProviders, this.sourceExcludes, this.parseJavadoc,
+ classLoader, this.annotationTagProviders, this.sourceIncludes, this.sourceExcludes, this.parseJavadoc,
this.processAnnotations );
final SCRDescriptorGenerator generator = new SCRDescriptorGenerator( scrLog );