mirror of https://github.com/apache/maven.git
fix stale source scanner
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163715 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d47767f88d
commit
d8f4e7e6c9
|
@ -58,10 +58,15 @@ public class StaleSourceScanner
|
||||||
public Set getIncludedSources( File sourceDir, File targetDir )
|
public Set getIncludedSources( File sourceDir, File targetDir )
|
||||||
throws InclusionScanException
|
throws InclusionScanException
|
||||||
{
|
{
|
||||||
Set matchingSources = new HashSet();
|
|
||||||
|
|
||||||
List srcMappings = getSourceMappings();
|
List srcMappings = getSourceMappings();
|
||||||
|
|
||||||
|
if ( srcMappings.isEmpty() )
|
||||||
|
{
|
||||||
|
return Collections.EMPTY_SET;
|
||||||
|
}
|
||||||
|
|
||||||
|
Set matchingSources = new HashSet();
|
||||||
|
|
||||||
String[] potentialIncludes = scanForSources( sourceDir );
|
String[] potentialIncludes = scanForSources( sourceDir );
|
||||||
for ( int i = 0; i < potentialIncludes.length; i++ )
|
for ( int i = 0; i < potentialIncludes.length; i++ )
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,9 +97,15 @@ public class CompilerMojo
|
||||||
compilerConfiguration.setClasspathEntries( classpathElements );
|
compilerConfiguration.setClasspathEntries( classpathElements );
|
||||||
compilerConfiguration.setSourceLocations( compileSourceRoots );
|
compilerConfiguration.setSourceLocations( compileSourceRoots );
|
||||||
|
|
||||||
|
// TODO: have an option to always compile (without need to clean)
|
||||||
Set staleSources = computeStaleSources();
|
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 );
|
compilerConfiguration.setSourceFiles( staleSources );
|
||||||
}
|
}
|
||||||
|
@ -170,6 +176,8 @@ public class CompilerMojo
|
||||||
|
|
||||||
SourceInclusionScanner scanner = new StaleSourceScanner( staleTime );
|
SourceInclusionScanner scanner = new StaleSourceScanner( staleTime );
|
||||||
|
|
||||||
|
scanner.addSourceMapping( mapping );
|
||||||
|
|
||||||
File outDir = new File( outputDirectory );
|
File outDir = new File( outputDirectory );
|
||||||
|
|
||||||
Set staleSources = new HashSet();
|
Set staleSources = new HashSet();
|
||||||
|
|
Loading…
Reference in New Issue