org.gradle.api.specs.Specs Java Examples
The following examples show how to use
org.gradle.api.specs.Specs.
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: DefaultLenientConfiguration.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
/** * Recursive, includes unsuccessfully resolved artifacts * * @param dependencySpec dependency spec */ public Set<ResolvedArtifact> getAllArtifacts(Spec<? super Dependency> dependencySpec) { //this is not very nice might be good enough until we get rid of ResolvedConfiguration and friends //avoid traversing the graph causing the full ResolvedDependency graph to be loaded for the most typical scenario if (dependencySpec == Specs.SATISFIES_ALL) { return results.getArtifacts(); } CachingDirectedGraphWalker<ResolvedDependency, ResolvedArtifact> walker = new CachingDirectedGraphWalker<ResolvedDependency, ResolvedArtifact>(new ResolvedDependencyArtifactsGraph()); Set<ResolvedDependency> firstLevelModuleDependencies = getFirstLevelModuleDependencies(dependencySpec); Set<ResolvedArtifact> artifacts = new LinkedHashSet<ResolvedArtifact>(); for (ResolvedDependency resolvedDependency : firstLevelModuleDependencies) { artifacts.addAll(resolvedDependency.getParentArtifacts(results.more().getRoot())); walker.add(resolvedDependency); } artifacts.addAll(walker.findValues()); return artifacts; }
Example #2
Source File: PluginResolutionServiceResolver.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private ClassPath resolvePluginDependencies(final PluginUseMetaData metadata) { DependencyResolutionServices resolution = dependencyResolutionServicesFactory.create(); RepositoryHandler repositories = resolution.getResolveRepositoryHandler(); final String repoUrl = metadata.implementation.get("repo"); repositories.maven(new Action<MavenArtifactRepository>() { public void execute(MavenArtifactRepository mavenArtifactRepository) { mavenArtifactRepository.setUrl(repoUrl); } }); Dependency dependency = resolution.getDependencyHandler().create(metadata.implementation.get("gav")); ConfigurationContainerInternal configurations = (ConfigurationContainerInternal) resolution.getConfigurationContainer(); ConfigurationInternal configuration = configurations.detachedConfiguration(dependency); try { Set<File> files = configuration.getResolvedConfiguration().getFiles(Specs.satisfyAll()); return new DefaultClassPath(files); } catch (ResolveException e) { throw new DependencyResolutionException("Failed to resolve all plugin dependencies from " + repoUrl, e.getCause()); } }
Example #3
Source File: DefaultLenientConfiguration.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
/** * Recursive, includes unsuccessfully resolved artifacts * * @param dependencySpec dependency spec */ public Set<ResolvedArtifact> getAllArtifacts(Spec<? super Dependency> dependencySpec) { //this is not very nice might be good enough until we get rid of ResolvedConfiguration and friends //avoid traversing the graph causing the full ResolvedDependency graph to be loaded for the most typical scenario if (dependencySpec == Specs.SATISFIES_ALL) { return results.getArtifacts(); } CachingDirectedGraphWalker<ResolvedDependency, ResolvedArtifact> walker = new CachingDirectedGraphWalker<ResolvedDependency, ResolvedArtifact>(new ResolvedDependencyArtifactsGraph()); Set<ResolvedDependency> firstLevelModuleDependencies = getFirstLevelModuleDependencies(dependencySpec); Set<ResolvedArtifact> artifacts = new LinkedHashSet<ResolvedArtifact>(); for (ResolvedDependency resolvedDependency : firstLevelModuleDependencies) { artifacts.addAll(resolvedDependency.getParentArtifacts(results.more().getRoot())); walker.add(resolvedDependency); } artifacts.addAll(walker.findValues()); return artifacts; }
Example #4
Source File: DefaultLenientConfiguration.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
/** * Recursive, includes unsuccessfully resolved artifacts * * @param dependencySpec dependency spec */ public Set<ResolvedArtifact> getAllArtifacts(Spec<? super Dependency> dependencySpec) { //this is not very nice might be good enough until we get rid of ResolvedConfiguration and friends //avoid traversing the graph causing the full ResolvedDependency graph to be loaded for the most typical scenario if (dependencySpec == Specs.SATISFIES_ALL) { return results.getArtifacts(); } CachingDirectedGraphWalker<ResolvedDependency, ResolvedArtifact> walker = new CachingDirectedGraphWalker<ResolvedDependency, ResolvedArtifact>(new ResolvedDependencyArtifactsGraph()); Set<ResolvedDependency> firstLevelModuleDependencies = getFirstLevelModuleDependencies(dependencySpec); Set<ResolvedArtifact> artifacts = new LinkedHashSet<ResolvedArtifact>(); for (ResolvedDependency resolvedDependency : firstLevelModuleDependencies) { artifacts.addAll(resolvedDependency.getParentArtifacts(results.more().getRoot())); walker.add(resolvedDependency); } artifacts.addAll(walker.findValues()); return artifacts; }
Example #5
Source File: DefaultLenientConfiguration.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
/** * Recursive, includes unsuccessfully resolved artifacts * * @param dependencySpec dependency spec */ public Set<ResolvedArtifact> getAllArtifacts(Spec<? super Dependency> dependencySpec) { //this is not very nice might be good enough until we get rid of ResolvedConfiguration and friends //avoid traversing the graph causing the full ResolvedDependency graph to be loaded for the most typical scenario if (dependencySpec == Specs.SATISFIES_ALL) { return results.getArtifacts(); } CachingDirectedGraphWalker<ResolvedDependency, ResolvedArtifact> walker = new CachingDirectedGraphWalker<ResolvedDependency, ResolvedArtifact>(new ResolvedDependencyArtifactsGraph()); Set<ResolvedDependency> firstLevelModuleDependencies = getFirstLevelModuleDependencies(dependencySpec); Set<ResolvedArtifact> artifacts = new LinkedHashSet<ResolvedArtifact>(); for (ResolvedDependency resolvedDependency : firstLevelModuleDependencies) { artifacts.addAll(resolvedDependency.getParentArtifacts(results.more().getRoot())); walker.add(resolvedDependency); } artifacts.addAll(walker.findValues()); return artifacts; }
Example #6
Source File: GenerateIvyDescriptor.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Inject public GenerateIvyDescriptor(FileResolver fileResolver) { this.fileResolver = fileResolver; // Never up to date; we don't understand the data structures. getOutputs().upToDateWhen(Specs.satisfyNone()); }
Example #7
Source File: GenerateIvyDescriptor.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Inject public GenerateIvyDescriptor(FileResolver fileResolver) { this.fileResolver = fileResolver; // Never up to date; we don't understand the data structures. getOutputs().upToDateWhen(Specs.satisfyNone()); }
Example #8
Source File: ExcludedTaskFilteringBuildConfigurationAction.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public void configure(BuildExecutionContext context) { GradleInternal gradle = context.getGradle(); Set<String> excludedTaskNames = gradle.getStartParameter().getExcludedTaskNames(); if (!excludedTaskNames.isEmpty()) { final Set<Spec<Task>> filters = new HashSet<Spec<Task>>(); for (String taskName : excludedTaskNames) { filters.add(taskSelector.getFilter(taskName)); } gradle.getTaskGraph().useFilter(Specs.and(filters)); } context.proceed(); }
Example #9
Source File: AtlasDepTreeParser.java From atlas with Apache License 2.0 | 5 votes |
private void collectArtifacts(Configuration configuration, Map<ModuleVersionIdentifier, List<ResolvedArtifact>> artifacts) { Set<ResolvedArtifact> allArtifacts; if (configuration.getState().equals(Configuration.State.UNRESOLVED) && !configuration.getName().equals(AtlasPlugin.BUNDLE_COMPILE)) { configuration.setCanBeResolved(true); } if (!extraModelInfo.getMode().equals(STANDARD)) { allArtifacts = configuration.getResolvedConfiguration().getLenientConfiguration().getArtifacts( Specs.satisfyAll()); } else { allArtifacts = configuration.getResolvedConfiguration().getResolvedArtifacts(); } for (ResolvedArtifact artifact : allArtifacts) { ModuleVersionIdentifier id = artifact.getModuleVersion().getId(); List<ResolvedArtifact> moduleArtifacts = artifacts.get(id); if (moduleArtifacts == null) { moduleArtifacts = Lists.newArrayList(); artifacts.put(id, moduleArtifacts); } if (!moduleArtifacts.contains(artifact)) { moduleArtifacts.add(artifact); } } }
Example #10
Source File: DependencyManager.java From javaide with GNU General Public License v3.0 | 5 votes |
private void collectArtifacts( Configuration configuration, Map<ModuleVersionIdentifier, List<ResolvedArtifact>> artifacts) { Set<ResolvedArtifact> allArtifacts; if (extraModelInfo.getMode() != STANDARD) { allArtifacts = configuration.getResolvedConfiguration().getLenientConfiguration().getArtifacts( Specs.satisfyAll()); } else { allArtifacts = configuration.getResolvedConfiguration().getResolvedArtifacts(); } for (ResolvedArtifact artifact : allArtifacts) { ModuleVersionIdentifier id = artifact.getModuleVersion().getId(); List<ResolvedArtifact> moduleArtifacts = artifacts.get(id); if (moduleArtifacts == null) { moduleArtifacts = Lists.newArrayList(); artifacts.put(id, moduleArtifacts); } if (!moduleArtifacts.contains(artifact)) { moduleArtifacts.add(artifact); } } }
Example #11
Source File: GenerateMavenPom.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Inject public GenerateMavenPom(FileResolver fileResolver) { this.fileResolver = fileResolver; // Never up to date; we don't understand the data structures. getOutputs().upToDateWhen(Specs.satisfyNone()); }
Example #12
Source File: ExcludedTaskFilteringBuildConfigurationAction.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void configure(BuildExecutionContext context) { GradleInternal gradle = context.getGradle(); Set<String> excludedTaskNames = gradle.getStartParameter().getExcludedTaskNames(); if (!excludedTaskNames.isEmpty()) { final Set<Spec<Task>> filters = new HashSet<Spec<Task>>(); for (String taskName : excludedTaskNames) { filters.add(taskSelector.getFilter(taskName)); } gradle.getTaskGraph().useFilter(Specs.and(filters)); } context.proceed(); }
Example #13
Source File: DefaultDomainObjectCollection.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
protected <S extends Collection<? super T>> S findAll(Closure cl, S matches) { for (T t : filteredStore(createFilter(Specs.<Object>convertClosureToSpec(cl)))) { matches.add(t); } return matches; }
Example #14
Source File: DefaultDomainObjectCollection.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public DomainObjectCollection<T> matching(Closure spec) { return matching(Specs.<T>convertClosureToSpec(spec)); }
Example #15
Source File: DefaultNamedDomainObjectList.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
@Override public NamedDomainObjectList<T> matching(Closure spec) { return matching(Specs.<T>convertClosureToSpec(spec)); }
Example #16
Source File: CollectionEventRegister.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public <K extends S> CollectionEventRegister<K> filtered(CollectionFilter<K> filter) { return super.filtered(new CollectionFilter<K>(filter.getType(), Specs.<K>and(filter, this.filter))); }
Example #17
Source File: AbstractFileCollection.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public FileCollection filter(Closure filterClosure) { return filter(Specs.convertClosureToSpec(filterClosure)); }
Example #18
Source File: PersistentCachingPluginResolutionServiceClient.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
private <K, V extends Response<?>> V maybeFetch(String operationName, final PersistentIndexedCache<K, V> cache, final K key, Factory<V> factory) { return maybeFetch(operationName, cache, key, factory, Specs.SATISFIES_NONE); }
Example #19
Source File: SingleIncludePatternFileTree.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public SingleIncludePatternFileTree(File baseDir, String includePattern) { this(baseDir, includePattern, Specs.<FileTreeElement>satisfyNone()); }
Example #20
Source File: StatementExtractingScriptTransformer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public Transformer invert() { return new Inverse("no_" + StatementExtractingScriptTransformer.this.getId(), Specs.not(transformer.getSpec())); }
Example #21
Source File: GenerateMavenPom.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public GenerateMavenPom() { // Never up to date; we don't understand the data structures. getOutputs().upToDateWhen(Specs.satisfyNone()); }
Example #22
Source File: DefaultConfiguration.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public Configuration copyRecursive(Closure dependencySpec) { return copyRecursive(Specs.<Dependency>convertClosureToSpec(dependencySpec)); }
Example #23
Source File: StatementExtractingScriptTransformer.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public Transformer invert() { return new Inverse("no_" + StatementExtractingScriptTransformer.this.getId(), Specs.not(transformer.getSpec())); }
Example #24
Source File: DefaultPluginCollection.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public PluginCollection<T> matching(Closure spec) { return matching(Specs.<T>convertClosureToSpec(spec)); }
Example #25
Source File: DefaultNamedDomainObjectList.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
@Override public NamedDomainObjectList<T> matching(Closure spec) { return matching(Specs.<T>convertClosureToSpec(spec)); }
Example #26
Source File: AbstractFileCollection.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public FileCollection filter(Closure filterClosure) { return filter(Specs.convertClosureToSpec(filterClosure)); }
Example #27
Source File: SingleIncludePatternFileTree.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public SingleIncludePatternFileTree(File baseDir, String includePattern) { this(baseDir, includePattern, Specs.<FileTreeElement>satisfyNone()); }
Example #28
Source File: CollectionFilter.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public CollectionFilter(Class<T> type) { this(type, Specs.<T>satisfyAll()); }
Example #29
Source File: CollectionEventRegister.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public <K extends S> CollectionEventRegister<K> filtered(CollectionFilter<K> filter) { return super.filtered(new CollectionFilter<K>(filter.getType(), Specs.<K>and(filter, this.filter))); }
Example #30
Source File: StatementExtractingScriptTransformer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public Transformer invert() { return new Inverse("no_" + StatementExtractingScriptTransformer.this.getId(), Specs.not(transformer.getSpec())); }