You are viewing a plain text version of this content. The canonical link for it is here.
Posted to m2-dev@maven.apache.org by br...@apache.org on 2005/03/30 07:52:07 UTC

cvs commit: maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/util/scan StaleSourceScanner.java

brett       2005/03/29 21:52:07

  Modified:    maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin
                        CompilerMojo.java
               maven-plugin/src/main/java/org/apache/maven/plugin/util/scan
                        StaleSourceScanner.java
  Log:
  fix stale source scanner
  
  Revision  Changes    Path
  1.26      +10 -2     maven-components/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerMojo.java
  
  Index: CompilerMojo.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/CompilerMojo.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- CompilerMojo.java	29 Mar 2005 05:28:08 -0000	1.25
  +++ CompilerMojo.java	30 Mar 2005 05:52:07 -0000	1.26
  @@ -97,9 +97,15 @@
           compilerConfiguration.setClasspathEntries( classpathElements );
           compilerConfiguration.setSourceLocations( compileSourceRoots );
   
  +        // TODO: have an option to always compile (without need to clean)
           Set staleSources = computeStaleSources();
   
  -        if ( staleSources != null && !staleSources.isEmpty() )
  +        if ( staleSources.isEmpty() )
  +        {
  +            getLog().info( "Nothing to compile - all classes are up to date" );
  +            return;
  +        }
  +        else
           {
               compilerConfiguration.setSourceFiles( staleSources );
           }
  @@ -170,6 +176,8 @@
   
           SourceInclusionScanner scanner = new StaleSourceScanner( staleTime );
   
  +        scanner.addSourceMapping( mapping );
  +
           File outDir = new File( outputDirectory );
   
           Set staleSources = new HashSet();
  
  
  
  1.2       +7 -2      maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/util/scan/StaleSourceScanner.java
  
  Index: StaleSourceScanner.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/util/scan/StaleSourceScanner.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StaleSourceScanner.java	29 Mar 2005 05:28:07 -0000	1.1
  +++ StaleSourceScanner.java	30 Mar 2005 05:52:07 -0000	1.2
  @@ -58,10 +58,15 @@
       public Set getIncludedSources( File sourceDir, File targetDir )
           throws InclusionScanException
       {
  -        Set matchingSources = new HashSet();
  -
           List srcMappings = getSourceMappings();
   
  +        if ( srcMappings.isEmpty() )
  +        {
  +            return Collections.EMPTY_SET;
  +        }
  +
  +        Set matchingSources = new HashSet();
  +
           String[] potentialIncludes = scanForSources( sourceDir );
           for ( int i = 0; i < potentialIncludes.length; i++ )
           {