/** * Tells which sources should be reprocessed based on the * last modification date of targets. * @param logTo where to send (more or less) interesting output. * @param source ResourceCollection. * @param mapper filename mapper indicating how to find the target Resources. * @param targets object able to map a relative path as a Resource. * @param granularity The number of milliseconds leeway to give * before deciding a target is out of date. * @return ResourceCollection. * @since Ant 1.7 */ public static ResourceCollection selectOutOfDateSources(final ProjectComponent logTo, final ResourceCollection source, final FileNameMapper mapper, final ResourceFactory targets, final long granularity) { logFuture(logTo, source, granularity); return selectSources(logTo, source, mapper, targets, sr -> target -> SelectorUtils.isOutOfDate(sr, target, granularity)); }
private Resource[] selectOutOfDateResources(final Resource[] initial, final FileNameMapper mapper) { final Resource[] rs = selectFileResources(initial); Resource[] result = ResourceUtils.selectOutOfDateSources(this, rs, mapper, getZipScanner(), ZIP_FILE_TIMESTAMP_GRANULARITY); if (!doFilesonly) { final Union u = new Union(); u.addAll(Arrays.asList(selectDirectoryResources(initial))); final ResourceCollection rc = ResourceUtils.selectSources(this, u, mapper, getZipScanner(), MISSING_DIR_PROVIDER); if (!rc.isEmpty()) { final List<Resource> newer = new ArrayList<>(); newer.addAll(Arrays.asList(((Union) rc).listResources())); newer.addAll(Arrays.asList(result)); result = newer.toArray(result); } } return result; }