felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r634659 - in /felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin: SCRDescriptorMojo.java tags/JavaClassDescriptorManager.java
Date Fri, 07 Mar 2008 13:06:47 GMT
Author: cziegeler
Date: Fri Mar  7 05:06:46 2008
New Revision: 634659

URL: http://svn.apache.org/viewvc?rev=634659&view=rev
Log:
FELIX-509: Add excludes configuration

Modified:
    felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java
    felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/JavaClassDescriptorManager.java

Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java?rev=634659&r1=634658&r2=634659&view=diff
==============================================================================
--- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java
(original)
+++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/SCRDescriptorMojo.java
Fri Mar  7 05:06:46 2008
@@ -79,6 +79,14 @@
     private boolean generateAccessors;
 
     /**
+     * The comma separated list of tokens to exclude when processing sources.
+     * All entries should be relative to the project directory
+     *
+     * @parameter alias="excludes"
+     */
+    private String sourceExcludes;
+
+    /**
      * @see org.apache.maven.plugin.AbstractMojo#execute()
      */
     public void execute() throws MojoExecutionException, MojoFailureException {
@@ -88,7 +96,8 @@
         boolean hasFailures = false;
 
         JavaClassDescriptorManager jManager = new JavaClassDescriptorManager(this.getLog(),
-                                                                             this.project);
+                                                                             this.project,
+                                                                             this.sourceExcludes);
         // iterate through all source classes and check for component tag
         final JavaClassDescription[] javaSources = jManager.getSourceDescriptions();
         Arrays.sort(javaSources, new JavaClassDescriptionInheritanceComparator());

Modified: felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/JavaClassDescriptorManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/JavaClassDescriptorManager.java?rev=634659&r1=634658&r2=634659&view=diff
==============================================================================
--- felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/JavaClassDescriptorManager.java
(original)
+++ felix/trunk/scrplugin/src/main/java/org/apache/felix/scrplugin/tags/JavaClassDescriptorManager.java
Fri Mar  7 05:06:46 2008
@@ -74,8 +74,9 @@
      * @throws MojoFailureException
      * @throws MojoExecutionException
      */
-    public JavaClassDescriptorManager(final Log         log,
-                                      final MavenProject project)
+    public JavaClassDescriptorManager(final Log          log,
+                                      final MavenProject project,
+                                      final String       excludes)
     throws MojoFailureException, MojoExecutionException {
         this.log = log;
         this.project = project;
@@ -91,7 +92,31 @@
             this.log.debug("Adding source tree " + tree);
             builder.addSourceTree(new File(tree));
         }
-        this.sources = builder.getSources();
+        // FELIX-509: check for excludes
+        if ( excludes != null ) {
+            final List sourcesList = new ArrayList(Arrays.asList(builder.getSources()));
+            final File projectDir = project.getBasedir();
+            final StringTokenizer st = new StringTokenizer(excludes, ",");
+            while ( st.hasMoreTokens() ) {
+                final String excludeEntry = st.nextToken();
+                this.log.debug("Processing configured exclude " + excludeEntry);
+                String exclude = projectDir.getAbsolutePath() + File.separatorChar + excludeEntry;
+                if ( File.separatorChar != '/' ) {
+                    exclude = exclude.replace('/', File.separatorChar);
+                }
+                final Iterator iter = sourcesList.iterator();
+                while ( iter.hasNext() ) {
+                    JavaSource current = (JavaSource)iter.next();
+                    if ( current.getFile().getAbsolutePath().startsWith(exclude)) {
+                        this.log.debug("Excluding source " + current.getFile());
+                        iter.remove();
+                    }
+                }
+            }
+            this.sources = (JavaSource[]) sourcesList.toArray(new JavaSource[sourcesList.size()]);
+        } else {
+            this.sources = builder.getSources();
+        }
 
         // and now scan artifacts
         final List components = new ArrayList();



Mime
View raw message