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:
Brett Leslie Porter 2005-03-30 05:52:07 +00:00
parent d47767f88d
commit d8f4e7e6c9
2 changed files with 16 additions and 3 deletions

View File

@ -58,10 +58,15 @@ public StaleSourceScanner( long lastUpdatedWithinMsecs, Set sourceIncludes, Set
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++ )
{

View File

@ -97,9 +97,15 @@ public void execute()
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 @@ private Set computeStaleSources()
SourceInclusionScanner scanner = new StaleSourceScanner( staleTime );
scanner.addSourceMapping( mapping );
File outDir = new File( outputDirectory );
Set staleSources = new HashSet();