/** * this test is our selection test that compared the file with the destfile * @param srcfile the source file * @param destfile the destination file * @return true if destination is out of date */ public boolean selectionTest(File srcfile, File destfile) { return SelectorUtils.isOutOfDate(srcfile, destfile, granularity); }
/** * Returns dependency information on these two resources. If src has been * modified later than target, it returns true. If target doesn't exist, * it likewise returns true. Otherwise, target is newer than src and * is not out of date, thus the method returns false. It also returns * false if the src file doesn't even exist, since how could the * target then be out of date. * * @param src the original resource * @param target the resource being compared against * @param granularity the int amount in seconds of slack we will give in * determining out of dateness * @return whether the target is out of date */ public static boolean isOutOfDate(Resource src, Resource target, int granularity) { return isOutOfDate(src, target, (long) granularity); }
private boolean isUpToDate(ResourceCollection c) { return dest != null && !forceOverwrite && c.stream().noneMatch(r -> SelectorUtils.isOutOfDate(r, dest, FILE_UTILS.getFileTimestampGranularity())); }
/** * 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)); }
/** * Is the archive up to date in relationship to a list of files. * @param r the files to check * @return true if the archive is up to date. * @since Ant 1.7 */ protected boolean archiveIsUpToDate(final Resource r) { return SelectorUtils.isOutOfDate(new FileResource(tarFile), r, FileUtils.getFileUtils() .getFileTimestampGranularity()); }
final Project project, final boolean force) throws IOException { if (!overwrite && !SelectorUtils.isOutOfDate(source, dest, FileUtils.getFileUtils().getFileTimestampGranularity())) { return;
private boolean isOutOfDate() { return force || (dest != null && SelectorUtils.isOutOfDate(new FileResource(src), new FileResource(dest), FileUtils.getFileUtils() .getFileTimestampGranularity()) ); }