public CompositeTaskOutputPropertySpec(TaskOutputs taskOutputs, String taskName, FileResolver resolver, CacheableTaskOutputFilePropertySpec.OutputType outputType, Object[] paths) { super(taskOutputs); this.taskName = taskName; this.resolver = resolver; this.outputType = outputType; this.paths = (paths != null && paths.length == 1) ? paths[0] : paths; }
public DefaultCacheableTaskOutputFilePropertySpec(TaskOutputs taskOutputs, String taskName, FileResolver resolver, OutputType outputType, Object path) { super(taskOutputs); this.resolver = resolver; this.outputType = outputType; this.path = path; this.files = new TaskPropertyFileCollection(taskName, "output", this, resolver, path); }
private <T> List<T> doResolve(Converter<? extends T> converter) { List<T> result = new ArrayList<T>(); while (!queue.isEmpty()) { Object element = queue.remove(0); // TODO - need to sync with BuildDependenciesOnlyFileCollectionResolveContext if (element instanceof DefaultFileCollectionResolveContext) { DefaultFileCollectionResolveContext nestedContext = (DefaultFileCollectionResolveContext) element; converter.convertInto(nestedContext, result, fileResolver); } else if (element instanceof FileCollectionContainer) { FileCollectionContainer fileCollection = (FileCollectionContainer) element; resolveNested(fileCollection, result, converter); } else if (element instanceof FileCollection || element instanceof MinimalFileCollection) { converter.convertInto(element, result, fileResolver); } else if (element instanceof Task) { Task task = (Task) element; queue.add(0, task.getOutputs().getFiles()); } else if (element instanceof TaskOutputs) { TaskOutputs outputs = (TaskOutputs) element; queue.add(0, outputs.getFiles()); } else if (element instanceof Callable) { Callable callable = (Callable) element; Object callableResult = uncheckedCall(callable); if (callableResult != null) { queue.add(0, callableResult); } } else if (element instanceof Iterable) { Iterable<?> iterable = (Iterable) element; GUtil.addToCollection(queue.subList(0, 0), iterable); } else if (element instanceof Object[]) { Object[] array = (Object[]) element; GUtil.addToCollection(queue.subList(0, 0), Arrays.asList(array)); } else { converter.convertInto(element, result, fileResolver); } } return result; }
public TaskOutputs files(final Object... paths) { taskMutator.mutate("TaskOutputs.files(Object...)", new Runnable() { public void run() { outputFiles.from(paths); } }); return this; }
public TaskOutputs file(final Object path) { taskMutator.mutate("TaskOutputs.file(Object)", new Runnable() { public void run() { outputFiles.from(path); } }); return this; }
public TaskOutputs dir(final Object path) { taskMutator.mutate("TaskOutputs.dir(Object)", new Runnable() { public void run() { outputFiles.from(path); } }); return this; }
protected AbstractTaskOutputPropertySpec(TaskOutputs taskOutputs) { super(taskOutputs); }
public AbstractTaskOutputsDeprecatingTaskPropertyBuilder(TaskOutputs taskOutputs) { this.taskOutputs = taskOutputs; }
private TaskOutputs getTaskOutputs(String method) { DeprecationLogger.nagUserOfDiscontinuedMethod("chaining of the " + method, String.format("Use '%s' on TaskOutputs directly instead.", method)); return taskOutputs; }
public NonCacheableTaskOutputPropertySpec(TaskOutputs taskOutputs, String taskName, CompositeTaskOutputPropertySpec parent, FileResolver resolver, Object paths) { super(taskOutputs); this.parent = parent; this.files = new TaskPropertyFileCollection(taskName, "output", this, resolver, paths); }
private <T> List<T> doResolve(Converter<? extends T> converter) { List<T> result = new ArrayList<T>(); while (!queue.isEmpty()) { Object element = queue.remove(0); if (element instanceof DefaultFileCollectionResolveContext) { DefaultFileCollectionResolveContext nestedContext = (DefaultFileCollectionResolveContext) element; converter.convertInto(nestedContext, result, fileResolver); } else if (element instanceof FileCollectionContainer) { FileCollectionContainer fileCollection = (FileCollectionContainer) element; resolveNested(fileCollection); } else if (element instanceof FileCollection || element instanceof MinimalFileCollection) { converter.convertInto(element, result, fileResolver); } else if (element instanceof Task) { Task task = (Task) element; queue.add(0, task.getOutputs().getFiles()); } else if (element instanceof TaskOutputs) { TaskOutputs outputs = (TaskOutputs) element; queue.add(0, outputs.getFiles()); } else if (element instanceof Closure) { Closure closure = (Closure) element; Object closureResult = closure.call(); if (closureResult != null) { queue.add(0, closureResult); } } else if (element instanceof Callable) { Callable callable = (Callable) element; Object callableResult; try { callableResult = callable.call(); } catch (Exception e) { throw UncheckedException.throwAsUncheckedException(e); } if (callableResult != null) { queue.add(0, callableResult); } } else if (element instanceof Iterable) { Iterable<?> iterable = (Iterable) element; GUtil.addToCollection(queue.subList(0, 0), iterable); } else if (element instanceof Object[]) { Object[] array = (Object[]) element; GUtil.addToCollection(queue.subList(0, 0), Arrays.asList(array)); } else { converter.convertInto(element, result, fileResolver); } } return result; }
public TaskOutputs files(Object... paths) { taskStatusNagger.nagIfTaskNotInConfigurableState("TaskOutputs.files(Object...)"); outputFiles.from(paths); return this; }
public TaskOutputs file(Object path) { taskStatusNagger.nagIfTaskNotInConfigurableState("TaskOutputs.file(Object)"); files(path); return this; }
public TaskOutputs dir(final Object path) { taskStatusNagger.nagIfTaskNotInConfigurableState("TaskOutputs.dir(Object)"); outputFiles.from(path); return this; }
/** * <p>Returns the outputs of this task.</p> * * @return The outputs. Never returns null. */ TaskOutputs getOutputs();