private void executeAction(TaskInternal task, ContextAwareTaskAction action, TaskExecutionContext context) { action.contextualise(context); try { action.execute(task); } finally { action.contextualise(null); } }
@Override public Set<ClassLoader> getActionClassLoaders() { Set<ClassLoader> actionLoaders = Sets.newLinkedHashSet(); for (ContextAwareTaskAction action : actions) { actionLoaders.add(action.getClassLoader()); } return actionLoaders; }
private Collection<ContextAwareTaskAction> transformToContextAwareTaskActions(Collection<Object> c) { return Collections2.transform(c, new Function<Object, ContextAwareTaskAction>() { public ContextAwareTaskAction apply(@Nullable Object input) { return wrap((Action<? super Task>) input); } }); }
private void setupTasks(MergeResources mergeResources) { List<ContextAwareTaskAction> tasks = mergeResources.getTaskActions(); List<ContextAwareTaskAction> newTasks = new ArrayList<>(tasks.size()); for (ContextAwareTaskAction action : tasks) { newTasks.add(new IgnoreResFilesTaskActionWrapper(action, mResFiles)); } mergeResources.deleteAllActions(); mergeResources.getTaskActions().addAll(newTasks); }
public List<ContextAwareTaskAction> getTaskActions() { return observableActionList; }
private ContextAwareTaskAction convertClosureToAction(Closure actionClosure) { return new ClosureTaskAction(actionClosure); }
private ContextAwareTaskAction wrap(final Action<? super Task> action) { if (action instanceof ContextAwareTaskAction) { return (ContextAwareTaskAction) action; } return new TaskActionWrapper(action); }
public void contextualise(TaskExecutionContext context) { if (action instanceof ContextAwareTaskAction) { ((ContextAwareTaskAction) action).contextualise(context); } }
public IgnoreResFilesTaskActionWrapper(ContextAwareTaskAction task, Set<File> resFiles) { mTask = task; mResFiles = resFiles; }
List<ContextAwareTaskAction> getTaskActions();