sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1519674 - in /sis/trunk: ./ core/sis-build-helper/ core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ core/sis-build-helper/src/main/resources/META-INF/m2e/ ide-project/NetBeans/
Date Tue, 03 Sep 2013 13:27:41 GMT
Author: desruisseaux
Date: Tue Sep  3 13:27:41 2013
New Revision: 1519674

URL: http://svn.apache.org/r1519674
Log:
Documentation, formatting, and update for NetBeans.

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
    sis/trunk/core/sis-build-helper/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
  (props changed)
    sis/trunk/ide-project/NetBeans/build.xml

Modified: sis/trunk/CHANGES
URL: http://svn.apache.org/viewvc/sis/trunk/CHANGES?rev=1519674&r1=1519673&r2=1519674&view=diff
==============================================================================
--- sis/trunk/CHANGES (original)
+++ sis/trunk/CHANGES Tue Sep  3 13:27:41 2013
@@ -2,7 +2,7 @@ Apache SIS Change Log
 ======================
 Release 0.4 - Current Development
 
-* SIS-133 ResourceCompilerMojo should execute only when properties files are modified 
+* 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)

Modified: sis/trunk/core/sis-build-helper/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-build-helper/pom.xml?rev=1519674&r1=1519673&r2=1519674&view=diff
==============================================================================
--- sis/trunk/core/sis-build-helper/pom.xml (original)
+++ sis/trunk/core/sis-build-helper/pom.xml Tue Sep  3 13:27:41 2013
@@ -66,7 +66,16 @@ Define Maven Mojos and Javadoc taglets f
     </developer>
   </developers>
   <contributors>
-    <!-- To prevent inheritance from parent pom.xml -->
+    <contributor>
+      <name>Olivier Nouguier</name>
+      <email>olivier.nouguier@geomatys.com</email>
+      <organization>Geomatys</organization>
+      <organizationUrl>http://www.geomatys.com</organizationUrl>
+      <timezone>+1</timezone>
+      <roles>
+        <role>developer</role>
+      </roles>
+    </contributor>
   </contributors>
 
 

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=1519674&r1=1519673&r2=1519674&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] Tue Sep  3 13:27:41 2013
@@ -33,29 +33,35 @@ import org.sonatype.plexus.build.increme
  * See the <code><a href="{@website}/sis-build-helper/index.html">sis-build-helper</a></code>
module
  * for more information.
  *
- * @author Martin Desruisseaux (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
+ * @author  Olivier Nouguier (Geomatys)
  * @since   0.3 (derived from geotk-3.00)
- * @version 0.3
+ * @version 0.4
  * @module
  *
  * @goal compile-resources
  * @phase generate-resources
  */
 public class ResourceCompilerMojo extends AbstractMojo implements FilenameFilter {
-	
-	/**
+    /**
+     * Project information (name, version, URL).
+     *
      * @parameter expression="${project}"
      * @required
      * @readonly
      */
-	private MavenProject project;
-	
-	
-	/**
-	 * @component
-	 */
-	private BuildContext buildContext;
-	
+    private MavenProject project;
+
+    /**
+     * A handler for the Eclipse workspace, used for declaring new resources.
+     * When Maven is run from the command line, this object does nothing.
+     *
+     * @see <a href="http://wiki.eclipse.org/M2E_compatible_maven_plugins">M2E compatible
maven plugins</a>
+     *
+     * @component
+     */
+    private BuildContext buildContext;
+
     /**
      * The source directories containing the sources to be compiled.
      *
@@ -68,7 +74,14 @@ public class ResourceCompilerMojo extend
     /**
      * Directory containing the generated class files.
      *
-     * @parameter default-value="${project.build.directory}/generated-resources/sis"
+     * <p><b>Note:</b> at the time of writing, we found no well-established
convention for generated resources.
+     * The conventions that we found were rather for generated sources. In the later case,
the conventions use
+     * a different directory for each Maven plugin, e.g. <code>"generated-sources/xxx"</code>.
But in our case
+     * (for resources), such separation seems of limited use since the resources are copied
verbatim in the JAR
+     * file, so preventing clash in the <code>generated-resources</code> directory
would not prevent clash in
+     * the JAR file anyway.</p>
+     *
+     * @parameter default-value="${project.build.directory}/generated-resources"
      * @required
      */
     private File outputDirectory;
@@ -78,8 +91,6 @@ public class ResourceCompilerMojo extend
      */
     private File javaDirectoryFile;
 
-        
-    
     /**
      * Executes the mojo.
      *
@@ -87,37 +98,47 @@ public class ResourceCompilerMojo extend
      */
     @Override
     public void execute() throws MojoExecutionException {
-
+        final boolean isIncremental = buildContext.isIncremental();
     	declareOutputDirectory();
-      
+
         int errors = 0;
         for (final String sourceDirectory : compileSourceRoots) {
             final File directory = new File(sourceDirectory);
             if (directory.getName().equals("java")) {
-                javaDirectoryFile = directory;
-                
-                Scanner scanner = buildContext.newScanner(directory);
-                scanner.setIncludes(new String[] {"*.properties"});
-                scanner.scan();
-                if ( scanner.getIncludedFiles() != null ) {
-                  errors += processAllResourceDirectories(directory);
-                  buildContext.refresh(directory);
+                /*
+                 * Check if we can skip the resources compilation (Eclipse environment only).
+                 *
+                 * Scanner.getIncludedFiles() returns an array of modified files. For now
we ignore the array
+                 * content and unconditionally re-compile all resource files as soon as at
least one file has
+                 * been modified. This is okay for now since changes in resource files are
rare and compiling
+                 * them is very fast.
+                 */
+                if (!isIncremental) {
+                    Scanner scanner = buildContext.newScanner(directory);
+                    scanner.setIncludes(new String[] {"*.properties"});
+                    scanner.scan();
+                    if (scanner.getIncludedFiles() == null) {
+                        continue;
+                    }
                 }
+                javaDirectoryFile = directory;
+                errors += processAllResourceDirectories(directory);
+                buildContext.refresh(directory);
             }
         }
         if (errors != 0) {
             throw new ResourceCompilerException(String.valueOf(errors) + " errors in resources
bundles.");
         }
     }
-    
+
     /**
-     * Declare outputDirectory as resource.
+     * Declares {@link #outputDirectory} as resource, for inclusion by Maven in the JAR file.
      */
-	private void declareOutputDirectory() {
-		Resource resource = new Resource();
-    	resource.setDirectory(outputDirectory.getPath());
-    	project.addResource( resource );
-	}
+    private void declareOutputDirectory() {
+        final Resource resource = new Resource();
+        resource.setDirectory(outputDirectory.getPath());
+        project.addResource(resource);
+    }
 
     /**
      * Recursively scans the directories for a sub-package named "resources",

Propchange: sis/trunk/core/sis-build-helper/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/trunk/core/sis-build-helper/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: sis/trunk/ide-project/NetBeans/build.xml
URL: http://svn.apache.org/viewvc/sis/trunk/ide-project/NetBeans/build.xml?rev=1519674&r1=1519673&r2=1519674&view=diff
==============================================================================
--- sis/trunk/ide-project/NetBeans/build.xml (original)
+++ sis/trunk/ide-project/NetBeans/build.xml Tue Sep  3 13:27:41 2013
@@ -38,7 +38,7 @@
       </fileset>
     </copy>
     <copy todir="${build.classes.dir}/org/apache/sis/util/resources">
-      <fileset dir="${project.root}/core/sis-utility/target/classes/org/apache/sis/util/resources">
+      <fileset dir="${project.root}/core/sis-utility/target/generated-resources/org/apache/sis/util/resources">
         <include name="*.utf"/>
       </fileset>
     </copy>



Mime
View raw message