private void logFuture(ResourceCollection rc, ResourceSelector rsel) { Restrict r = new Restrict(); r.add(rsel); r.add(rc); for (Resource res : r) { log("Warning: " + res + " modified in the future.", Project.MSG_WARN); } }
/** * Log which Resources (if any) have been modified in the future. * @param logTo the ProjectComponent to do the logging. * @param rc the collection of Resources to check. * @param granularity the timestamp granularity to use. * @since Ant 1.7 */ private static void logFuture(final ProjectComponent logTo, final ResourceCollection rc, final long granularity) { final long now = System.currentTimeMillis() + granularity; final Date sel = new Date(); sel.setMillis(now); sel.setWhen(TimeComparison.AFTER); final Restrict future = new Restrict(); future.add(sel); future.add(rc); for (final Resource r : future) { logTo.log("Warning: " + r.getName() + " modified in the future.", Project.MSG_WARN); } }
/** * Get the resources to concatenate. */ private ResourceCollection getResources() { if (rc == null) { return new StringResource(getProject(), textBuffer.toString()); } if (dest != null) { Intersect checkDestNotInSources = new Intersect(); checkDestNotInSources.setProject(getProject()); checkDestNotInSources.add(rc); checkDestNotInSources.add(dest); if (checkDestNotInSources.size() > 0) { throw new BuildException( "Destination resource %s was specified as an input resource.", dest); } } Restrict noexistRc = new Restrict(); noexistRc.add(NOT_EXISTS); noexistRc.add(rc); for (Resource r : noexistRc) { log(r + " does not exist.", Project.MSG_ERR); } Restrict result = new Restrict(); result.add(EXISTS); result.add(rc); return result; }
/** * Adds a collection of filesystem resources to copy. * @param rc a resource collection * @since Ant 1.7 */ public void add(ResourceCollection rc) { if (rc instanceof FileSet && rc.isFilesystemOnly()) { // receives special treatment in copy that this task relies on myCopy.add(rc); } else { if (resources == null) { Restrict r = new Restrict(); r.add(new Exists()); resources = new Resources(); r.add(resources); myCopy.add(r); } resources.add(rc); } }
if (rcs != null) { Restrict exists = new Restrict(); exists.add(EXISTS); exists.add(rcs);
final Restrict r = new Restrict(); r.add(selector.getTargetSelectorForSource(sr)); r.add(targetColl);
ResourceCollectionFlags rcFlags = getFlags(target); Restrict res = new Restrict(); res.setProject(getProject()); res.add(target);