public Set getIncludedSources()

in src/main/java/org/apache/maven/shared/io/scan/StaleResourceScanner.java [76:110]


    public Set<File> getIncludedSources(File sourceDir, File targetDir) throws InclusionScanException {
        List<SourceMapping> srcMappings = getSourceMappings();

        if (srcMappings.isEmpty()) {
            return Collections.<File>emptySet();
        }

        String[] potentialIncludes = scanForSources(sourceDir, sourceIncludes, sourceExcludes);

        Set<File> matchingSources = new HashSet<File>();

        for (int i = 0; i < potentialIncludes.length; i++) {
            String path = potentialIncludes[i];

            File sourceFile = new File(sourceDir, path);

            staleSourceFileTesting:
            for (SourceMapping mapping : srcMappings) {
                Set<File> targetFiles = mapping.getTargetFiles(targetDir, path);

                // never include files that don't have corresponding target mappings.
                // the targets don't have to exist on the filesystem, but the
                // mappers must tell us to look for them.
                for (File targetFile : targetFiles) {
                    if (!targetFile.exists()
                            || (targetFile.lastModified() + lastUpdatedWithinMsecs < sourceFile.lastModified())) {
                        matchingSources.add(sourceFile);
                        break staleSourceFileTesting;
                    }
                }
            }
        }

        return matchingSources;
    }