org.gradle.api.Buildable Java Examples
The following examples show how to use
org.gradle.api.Buildable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CachingTaskDependencyResolveContext.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public void getNodeValues(Object node, Collection<? super Task> values, Collection<? super Object> connectedNodes) { if (node instanceof TaskDependencyInternal) { TaskDependencyInternal taskDependency = (TaskDependencyInternal) node; queue.clear(); taskDependency.resolve(CachingTaskDependencyResolveContext.this); connectedNodes.addAll(queue); } else if (node instanceof Buildable) { Buildable buildable = (Buildable) node; connectedNodes.add(buildable.getBuildDependencies()); } else if (node instanceof TaskDependency) { TaskDependency dependency = (TaskDependency) node; values.addAll(dependency.getDependencies(task)); } else if (node instanceof Task) { values.add((Task) node); } else { throw new IllegalArgumentException(String.format("Cannot resolve object of unknown type %s to a Task.", node.getClass().getSimpleName())); } }
Example #2
Source File: CachingTaskDependencyResolveContext.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public void getNodeValues(Object node, Collection<? super Task> values, Collection<? super Object> connectedNodes) { if (node instanceof TaskDependencyInternal) { TaskDependencyInternal taskDependency = (TaskDependencyInternal) node; queue.clear(); taskDependency.resolve(CachingTaskDependencyResolveContext.this); connectedNodes.addAll(queue); } else if (node instanceof Buildable) { Buildable buildable = (Buildable) node; connectedNodes.add(buildable.getBuildDependencies()); } else if (node instanceof TaskDependency) { TaskDependency dependency = (TaskDependency) node; values.addAll(dependency.getDependencies(task)); } else if (node instanceof Task) { values.add((Task) node); } else { throw new IllegalArgumentException(String.format("Cannot resolve object of unknown type %s to a Task.", node.getClass().getSimpleName())); } }
Example #3
Source File: CachingTaskDependencyResolveContext.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public void getNodeValues(Object node, Collection<? super Task> values, Collection<? super Object> connectedNodes) { if (node instanceof TaskDependencyInternal) { TaskDependencyInternal taskDependency = (TaskDependencyInternal) node; queue.clear(); taskDependency.resolve(CachingTaskDependencyResolveContext.this); connectedNodes.addAll(queue); } else if (node instanceof Buildable) { Buildable buildable = (Buildable) node; connectedNodes.add(buildable.getBuildDependencies()); } else if (node instanceof TaskDependency) { TaskDependency dependency = (TaskDependency) node; values.addAll(dependency.getDependencies(task)); } else if (node instanceof Task) { values.add((Task) node); } else { throw new IllegalArgumentException(String.format("Cannot resolve object of unknown type %s to a Task.", node.getClass().getSimpleName())); } }
Example #4
Source File: CachingTaskDependencyResolveContext.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public void getNodeValues(Object node, Collection<? super Task> values, Collection<? super Object> connectedNodes) { if (node instanceof TaskDependencyInternal) { TaskDependencyInternal taskDependency = (TaskDependencyInternal) node; queue.clear(); taskDependency.resolve(CachingTaskDependencyResolveContext.this); connectedNodes.addAll(queue); } else if (node instanceof Buildable) { Buildable buildable = (Buildable) node; connectedNodes.add(buildable.getBuildDependencies()); } else if (node instanceof TaskDependency) { TaskDependency dependency = (TaskDependency) node; values.addAll(dependency.getDependencies(task)); } else if (node instanceof Task) { values.add((Task) node); } else { throw new IllegalArgumentException(String.format("Cannot resolve object of unknown type %s to a Task.", node.getClass().getSimpleName())); } }
Example #5
Source File: BuildDependenciesOnlyFileCollectionResolveContext.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void convertInto(Object element, Collection<? super FileTree> result, FileResolver resolver) { if (element instanceof DefaultFileCollectionResolveContext) { DefaultFileCollectionResolveContext nestedContext = (DefaultFileCollectionResolveContext) element; result.addAll(nestedContext.resolveAsFileTrees()); } else if (element instanceof Buildable) { Buildable buildable = (Buildable) element; result.add(new FileTreeAdapter(new EmptyFileTree(buildable.getBuildDependencies()))); } else if (element instanceof TaskDependency) { TaskDependency dependency = (TaskDependency) element; result.add(new FileTreeAdapter(new EmptyFileTree(dependency))); } }
Example #6
Source File: FileCollectionAdapter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public TaskDependency getBuildDependencies() { if (fileCollection instanceof Buildable) { Buildable buildable = (Buildable) fileCollection; return buildable.getBuildDependencies(); } return super.getBuildDependencies(); }
Example #7
Source File: FileTreeAdapter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public TaskDependency getBuildDependencies() { if (tree instanceof Buildable) { Buildable buildable = (Buildable) tree; return buildable.getBuildDependencies(); } return super.getBuildDependencies(); }
Example #8
Source File: CompositeFileCollection.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
/** * Allows subclasses to add additional dependencies * @param context The context to add dependencies to. */ protected void addDependencies(TaskDependencyResolveContext context) { BuildDependenciesOnlyFileCollectionResolveContext fileContext = new BuildDependenciesOnlyFileCollectionResolveContext(); resolve(fileContext); for (Buildable buildable : fileContext.resolveAsBuildables()) { context.add(buildable); } }
Example #9
Source File: BuildDependenciesOnlyFileCollectionResolveContext.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void convertInto(Object element, Collection<? super FileTree> result, FileResolver resolver) { if (element instanceof DefaultFileCollectionResolveContext) { DefaultFileCollectionResolveContext nestedContext = (DefaultFileCollectionResolveContext) element; result.addAll(nestedContext.resolveAsFileTrees()); } else if (element instanceof Buildable) { Buildable buildable = (Buildable) element; result.add(new FileTreeAdapter(new EmptyFileTree(buildable.getBuildDependencies()))); } else if (element instanceof TaskDependency) { TaskDependency dependency = (TaskDependency) element; result.add(new FileTreeAdapter(new EmptyFileTree(dependency))); } }
Example #10
Source File: FileCollectionAdapter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public TaskDependency getBuildDependencies() { if (fileCollection instanceof Buildable) { Buildable buildable = (Buildable) fileCollection; return buildable.getBuildDependencies(); } return super.getBuildDependencies(); }
Example #11
Source File: FileTreeAdapter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public TaskDependency getBuildDependencies() { if (tree instanceof Buildable) { Buildable buildable = (Buildable) tree; return buildable.getBuildDependencies(); } return super.getBuildDependencies(); }
Example #12
Source File: CompositeFileCollection.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
/** * Allows subclasses to add additional dependencies * @param context The context to add dependencies to. */ protected void addDependencies(TaskDependencyResolveContext context) { BuildDependenciesOnlyFileCollectionResolveContext fileContext = new BuildDependenciesOnlyFileCollectionResolveContext(); resolve(fileContext); for (Buildable buildable : fileContext.resolveAsBuildables()) { context.add(buildable); } }
Example #13
Source File: BuildDependenciesOnlyFileCollectionResolveContext.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public void convertInto(Object element, Collection<? super FileTree> result, FileResolver resolver) { if (element instanceof DefaultFileCollectionResolveContext) { DefaultFileCollectionResolveContext nestedContext = (DefaultFileCollectionResolveContext) element; result.addAll(nestedContext.resolveAsFileTrees()); } else if (element instanceof Buildable) { Buildable buildable = (Buildable) element; result.add(new FileTreeAdapter(new EmptyFileTree(buildable.getBuildDependencies()))); } else if (element instanceof TaskDependency) { TaskDependency dependency = (TaskDependency) element; result.add(new FileTreeAdapter(new EmptyFileTree(dependency))); } }
Example #14
Source File: FileCollectionAdapter.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public TaskDependency getBuildDependencies() { if (fileCollection instanceof Buildable) { Buildable buildable = (Buildable) fileCollection; return buildable.getBuildDependencies(); } return super.getBuildDependencies(); }
Example #15
Source File: FileTreeAdapter.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public TaskDependency getBuildDependencies() { if (tree instanceof Buildable) { Buildable buildable = (Buildable) tree; return buildable.getBuildDependencies(); } return super.getBuildDependencies(); }
Example #16
Source File: CompositeFileCollection.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
/** * Allows subclasses to add additional dependencies * @param context The context to add dependencies to. */ protected void addDependencies(TaskDependencyResolveContext context) { BuildDependenciesOnlyFileCollectionResolveContext fileContext = new BuildDependenciesOnlyFileCollectionResolveContext(); resolve(fileContext); for (Buildable buildable : fileContext.resolveAsBuildables()) { context.add(buildable); } }
Example #17
Source File: BuildDependenciesOnlyFileCollectionResolveContext.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public void convertInto(Object element, Collection<? super FileTree> result, FileResolver resolver) { if (element instanceof DefaultFileCollectionResolveContext) { DefaultFileCollectionResolveContext nestedContext = (DefaultFileCollectionResolveContext) element; result.addAll(nestedContext.resolveAsFileTrees()); } else if (element instanceof Buildable) { Buildable buildable = (Buildable) element; result.add(new FileTreeAdapter(new EmptyFileTree(buildable.getBuildDependencies()))); } else if (element instanceof TaskDependency) { TaskDependency dependency = (TaskDependency) element; result.add(new FileTreeAdapter(new EmptyFileTree(dependency))); } }
Example #18
Source File: FileCollectionAdapter.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public TaskDependency getBuildDependencies() { if (fileCollection instanceof Buildable) { Buildable buildable = (Buildable) fileCollection; return buildable.getBuildDependencies(); } return super.getBuildDependencies(); }
Example #19
Source File: FileTreeAdapter.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public TaskDependency getBuildDependencies() { if (tree instanceof Buildable) { Buildable buildable = (Buildable) tree; return buildable.getBuildDependencies(); } return super.getBuildDependencies(); }
Example #20
Source File: CompositeFileCollection.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
/** * Allows subclasses to add additional dependencies * @param context The context to add dependencies to. */ protected void addDependencies(TaskDependencyResolveContext context) { BuildDependenciesOnlyFileCollectionResolveContext fileContext = new BuildDependenciesOnlyFileCollectionResolveContext(); resolve(fileContext); for (Buildable buildable : fileContext.resolveAsBuildables()) { context.add(buildable); } }
Example #21
Source File: BuildDependenciesOnlyFileCollectionResolveContext.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
/** * Resolves the contents of this context as a list of atomic {@link Buildable} instances. */ public List<? extends Buildable> resolveAsBuildables() { return resolveAsFileCollections(); }
Example #22
Source File: DefaultTaskDependency.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void resolve(TaskDependencyResolveContext context) { LinkedList<Object> queue = new LinkedList<Object>(values); while (!queue.isEmpty()) { Object dependency = queue.removeFirst(); if (dependency instanceof Buildable) { context.add(dependency); } else if (dependency instanceof Task) { context.add(dependency); } else if (dependency instanceof TaskDependency) { context.add(dependency); } else if (dependency instanceof Closure) { Closure closure = (Closure) dependency; Object closureResult = closure.call(context.getTask()); if (closureResult != null) { queue.add(0, closureResult); } } else if (dependency instanceof Iterable) { Iterable<?> iterable = (Iterable) dependency; queue.addAll(0, GUtil.addToCollection(new ArrayList<Object>(), iterable)); } else if (dependency instanceof Map) { Map<?, ?> map = (Map) dependency; queue.addAll(0, map.values()); } else if (dependency instanceof Object[]) { Object[] array = (Object[]) dependency; queue.addAll(0, Arrays.asList(array)); } else if (dependency instanceof Callable) { Callable callable = (Callable) dependency; Object callableResult; try { callableResult = callable.call(); } catch (Exception e) { throw UncheckedException.throwAsUncheckedException(e); } if (callableResult != null) { queue.add(0, callableResult); } } else if (resolver != null && dependency instanceof CharSequence) { context.add(resolver.resolveTask(dependency.toString())); } else { List<String> formats = new ArrayList<String>(); if (resolver != null) { formats.add("A String or CharSequence task name or path"); } formats.add("A Task instance"); formats.add("A Buildable instance"); formats.add("A TaskDependency instance"); formats.add("A Closure instance that returns any of the above types"); formats.add("A Callable instance that returns any of the above types"); formats.add("An Iterable, Collection, Map or array instance that contains any of the above types"); throw new UnsupportedNotationException(dependency, String.format("Cannot convert %s to a task.", dependency), null, formats); } } }
Example #23
Source File: DefaultTaskDependency.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void resolve(TaskDependencyResolveContext context) { LinkedList<Object> queue = new LinkedList<Object>(values); while (!queue.isEmpty()) { Object dependency = queue.removeFirst(); if (dependency instanceof Buildable) { context.add(dependency); } else if (dependency instanceof Task) { context.add(dependency); } else if (dependency instanceof TaskDependency) { context.add(dependency); } else if (dependency instanceof Closure) { Closure closure = (Closure) dependency; Object closureResult = closure.call(context.getTask()); if (closureResult != null) { queue.add(0, closureResult); } } else if (dependency instanceof Iterable) { Iterable<?> iterable = (Iterable) dependency; queue.addAll(0, GUtil.addToCollection(new ArrayList<Object>(), iterable)); } else if (dependency instanceof Map) { Map<?, ?> map = (Map) dependency; queue.addAll(0, map.values()); } else if (dependency instanceof Object[]) { Object[] array = (Object[]) dependency; queue.addAll(0, Arrays.asList(array)); } else if (dependency instanceof Callable) { Callable callable = (Callable) dependency; Object callableResult; try { callableResult = callable.call(); } catch (Exception e) { throw UncheckedException.throwAsUncheckedException(e); } if (callableResult != null) { queue.add(0, callableResult); } } else { context.add(resolver.resolveTask(dependency)); } } }
Example #24
Source File: BuildDependenciesOnlyFileCollectionResolveContext.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
/** * Resolves the contents of this context as a list of atomic {@link Buildable} instances. */ public List<? extends Buildable> resolveAsBuildables() { return resolveAsFileCollections(); }
Example #25
Source File: BuildDependenciesOnlyFileCollectionResolveContext.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
/** * Resolves the contents of this context as a list of atomic {@link Buildable} instances. */ public List<? extends Buildable> resolveAsBuildables() { return resolveAsFileCollections(); }
Example #26
Source File: DefaultTaskDependency.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void resolve(TaskDependencyResolveContext context) { LinkedList<Object> queue = new LinkedList<Object>(values); while (!queue.isEmpty()) { Object dependency = queue.removeFirst(); if (dependency instanceof Buildable) { context.add(dependency); } else if (dependency instanceof Task) { context.add(dependency); } else if (dependency instanceof TaskDependency) { context.add(dependency); } else if (dependency instanceof Closure) { Closure closure = (Closure) dependency; Object closureResult = closure.call(context.getTask()); if (closureResult != null) { queue.add(0, closureResult); } } else if (dependency instanceof Iterable) { Iterable<?> iterable = (Iterable) dependency; queue.addAll(0, GUtil.addToCollection(new ArrayList<Object>(), iterable)); } else if (dependency instanceof Map) { Map<?, ?> map = (Map) dependency; queue.addAll(0, map.values()); } else if (dependency instanceof Object[]) { Object[] array = (Object[]) dependency; queue.addAll(0, Arrays.asList(array)); } else if (dependency instanceof Callable) { Callable callable = (Callable) dependency; Object callableResult; try { callableResult = callable.call(); } catch (Exception e) { throw UncheckedException.throwAsUncheckedException(e); } if (callableResult != null) { queue.add(0, callableResult); } } else { context.add(resolver.resolveTask(dependency)); } } }
Example #27
Source File: BuildDependenciesOnlyFileCollectionResolveContext.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
/** * Resolves the contents of this context as a list of atomic {@link Buildable} instances. */ public List<? extends Buildable> resolveAsBuildables() { return resolveAsFileCollections(); }
Example #28
Source File: DefaultTaskDependency.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void resolve(TaskDependencyResolveContext context) { LinkedList<Object> queue = new LinkedList<Object>(values); while (!queue.isEmpty()) { Object dependency = queue.removeFirst(); if (dependency instanceof Buildable) { context.add(dependency); } else if (dependency instanceof Task) { context.add(dependency); } else if (dependency instanceof TaskDependency) { context.add(dependency); } else if (dependency instanceof Closure) { Closure closure = (Closure) dependency; Object closureResult = closure.call(context.getTask()); if (closureResult != null) { queue.add(0, closureResult); } } else if (dependency instanceof Iterable) { Iterable<?> iterable = (Iterable) dependency; queue.addAll(0, GUtil.addToCollection(new ArrayList<Object>(), iterable)); } else if (dependency instanceof Map) { Map<?, ?> map = (Map) dependency; queue.addAll(0, map.values()); } else if (dependency instanceof Object[]) { Object[] array = (Object[]) dependency; queue.addAll(0, Arrays.asList(array)); } else if (dependency instanceof Callable) { Callable callable = (Callable) dependency; Object callableResult; try { callableResult = callable.call(); } catch (Exception e) { throw UncheckedException.throwAsUncheckedException(e); } if (callableResult != null) { queue.add(0, callableResult); } } else if (resolver != null && dependency instanceof CharSequence) { context.add(resolver.resolveTask(dependency.toString())); } else { List<String> formats = new ArrayList<String>(); if (resolver != null) { formats.add("A String or CharSequence task name or path"); } formats.add("A Task instance"); formats.add("A Buildable instance"); formats.add("A TaskDependency instance"); formats.add("A Closure instance that returns any of the above types"); formats.add("A Callable instance that returns any of the above types"); formats.add("An Iterable, Collection, Map or array instance that contains any of the above types"); throw new UnsupportedNotationException(dependency, String.format("Cannot convert %s to a task.", dependency), null, formats); } } }