sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattm...@apache.org
Subject svn commit: r1519304 - in /sis/trunk: CHANGES core/sis-build-helper/pom.xml core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ResourceCompilerMojo.java
Date Sun, 01 Sep 2013 19:03:24 GMT
Author: mattmann
Date: Sun Sep  1 19:03:23 2013
New Revision: 1519304

URL: http://svn.apache.org/r1519304
Log:
Patch for SIS-133 ResourceCompilerMojo should execute only when properties files are modifiedcontributed
by Olivier Nouguier.

Modified:
    sis/trunk/CHANGES
    sis/trunk/core/sis-build-helper/pom.xml
    sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ResourceCompilerMojo.java

Modified: sis/trunk/CHANGES
URL: http://svn.apache.org/viewvc/sis/trunk/CHANGES?rev=1519304&r1=1519303&r2=1519304&view=diff
==============================================================================
--- sis/trunk/CHANGES (original)
+++ sis/trunk/CHANGES Sun Sep  1 19:03:23 2013
@@ -2,7 +2,10 @@ Apache SIS Change Log
 ======================
 Release 0.4 - Current Development
 
-* SIS-132 Better support for eclipse IDE (mattmann)
+* SIS-133 ResourceCompilerMojo should execute only when properties files are modified 
+          (Olivier Nouguier via mattmann)
+
+* SIS-132 Better support for eclipse IDE (Olivier Nouguier via mattmann)
 
 Release 0.3 - 06/29/2013
 

Modified: sis/trunk/core/sis-build-helper/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-build-helper/pom.xml?rev=1519304&r1=1519303&r2=1519304&view=diff
==============================================================================
--- sis/trunk/core/sis-build-helper/pom.xml (original)
+++ sis/trunk/core/sis-build-helper/pom.xml Sun Sep  1 19:03:23 2013
@@ -84,6 +84,11 @@ Define Maven Mojos and Javadoc taglets f
       <artifactId>maven-plugin-api</artifactId>
       <version>3.0.5</version>
     </dependency>
+     <dependency>
+      <groupId>org.sonatype.plexus</groupId>
+      <artifactId>plexus-build-api</artifactId>
+      <version>0.0.7</version>
+    </dependency>
     <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-compress</artifactId>

Modified: sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ResourceCompilerMojo.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ResourceCompilerMojo.java?rev=1519304&r1=1519303&r2=1519304&view=diff
==============================================================================
--- sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ResourceCompilerMojo.java
[UTF-8] (original)
+++ sis/trunk/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ResourceCompilerMojo.java
[UTF-8] Sun Sep  1 19:03:23 2013
@@ -24,6 +24,8 @@ import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.Scanner;
+import org.sonatype.plexus.build.incremental.BuildContext;
 
 
 /**
@@ -47,6 +49,13 @@ public class ResourceCompilerMojo extend
      * @readonly
      */
 	private MavenProject project;
+	
+	
+	/**
+	 * @component
+	 */
+	private BuildContext buildContext;
+	
     /**
      * The source directories containing the sources to be compiled.
      *
@@ -77,25 +86,38 @@ public class ResourceCompilerMojo extend
      * @throws MojoExecutionException if the plugin execution failed.
      */
     @Override
-    @SuppressWarnings({"unchecked","rawtypes"}) // Generic array creation.
     public void execute() throws MojoExecutionException {
-    	Resource resource = new Resource();
-    	resource.setDirectory(outputDirectory.getPath());
-    	project.addResource( resource );
-//    	project.addCompileSourceRoot(outputDirectory.getPath());
-        
+
+    	declareOutputDirectory();
+      
         int errors = 0;
         for (final String sourceDirectory : compileSourceRoots) {
             final File directory = new File(sourceDirectory);
             if (directory.getName().equals("java")) {
                 javaDirectoryFile = directory;
-                errors += processAllResourceDirectories(directory);
+                
+                Scanner scanner = buildContext.newScanner(directory);
+                scanner.setIncludes(new String[] {"*.properties"});
+                scanner.scan();
+                if ( scanner.getIncludedFiles() != null ) {
+                  errors += processAllResourceDirectories(directory);
+                  buildContext.refresh(directory);
+                }
             }
         }
         if (errors != 0) {
             throw new ResourceCompilerException(String.valueOf(errors) + " errors in resources
bundles.");
         }
     }
+    
+    /**
+     * Declare outputDirectory as resource.
+     */
+	private void declareOutputDirectory() {
+		Resource resource = new Resource();
+    	resource.setDirectory(outputDirectory.getPath());
+    	project.addResource( resource );
+	}
 
     /**
      * Recursively scans the directories for a sub-package named "resources",



Mime
View raw message