public CollectionFilter(Class<T> type) { this(type, Specs.<T>satisfyAll()); }
/** * Returns a spec that selects the intersection of those items selected by the given specs. Returns a spec that selects everything when no specs provided. */ public static <T> Spec<T> intersect(Collection<? extends Spec<? super T>> specs) { if (specs.size() == 0) { return satisfyAll(); } return doIntersect(specs); }
/** * Returns a spec that selects the union of those items selected by the provided spec. Selects everything when no specs provided. */ public static <T> Spec<T> union(Collection<? extends Spec<? super T>> specs) { if (specs.size() == 0) { return satisfyAll(); } return doUnion(specs); }
/** * Finds projects in the included builds. You have to run `gradlew eclipse` before running `gradle ide` for this to work, because * it relies on pre-existing `.project` files to determine the paths to subprojects. * * Supports root projects and subprojects, but not subsubprojects. */ public void findProjectsInIncludedBuilds() { findProjectsInIncludedBuilds(Specs.satisfyAll()); }
public static <T> NodeInitializerContext<T> forType(ModelType<T> type) { return new NodeInitializerContext<T>(type, Specs.<ModelType<?>>satisfyAll(), Optional.<PropertyContext>absent()); }
/** Adds all eclipse projects from all gradle projects. */ public void addAllProjects() { addAllProjects(Specs.satisfyAll()); }
/** * Returns a spec that selects the intersection of those items selected by the given specs. Returns a spec that selects everything when no specs provided. */ public static <T> Spec<T> intersect(Spec<? super T>... specs) { if (specs.length == 0) { return satisfyAll(); } if (specs.length == 1) { return Cast.uncheckedCast(specs[0]); } return doIntersect(Arrays.asList(specs)); }
/** * Returns a spec that selects the union of those items selected by the provided spec. Selects everything when no specs provided. */ public static <T> Spec<T> union(Spec<? super T>... specs) { if (specs.length == 0) { return satisfyAll(); } if (specs.length == 1) { return Cast.uncheckedCast(specs[0]); } return doUnion(Arrays.asList(specs)); }
private static <T> Spec<T> doUnion(Collection<? extends Spec<? super T>> specs) { List<Spec<? super T>> filtered = new ArrayList<Spec<? super T>>(specs.size()); for (Spec<? super T> spec : specs) { if (spec == SATISFIES_ALL) { return satisfyAll(); } if (spec != SATISFIES_NONE) { filtered.add(spec); } } if (filtered.size() == 0) { return satisfyNone(); } if (filtered.size() == 1) { return Cast.uncheckedCast(filtered.get(0)); } return new OrSpec<T>(filtered); }
private static <T> Spec<T> doIntersect(Collection<? extends Spec<? super T>> specs) { List<Spec<? super T>> filtered = new ArrayList<Spec<? super T>>(specs.size()); for (Spec<? super T> spec : specs) { if (spec == SATISFIES_NONE) { return satisfyNone(); } if (spec != SATISFIES_ALL) { filtered.add(spec); } } if (filtered.size() == 0) { return satisfyAll(); } if (filtered.size() == 1) { return Cast.uncheckedCast(filtered.get(0)); } return new AndSpec<T>(filtered); }
/** Adds an eclipse project from the given included build. */ public void addIncludedProject(String includedBuild, String projectPath) { IncludedBuild included = project.getGradle().includedBuild(includedBuild); File projectDir = new File(included.getProjectDir(), projectPath.substring(1).replace(':', '/')); Preconditions.checkArgument(addProjectIfExists(included, projectDir, Specs.satisfyAll())); }
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); } } }
/** * Returns a spec that selects everything that is not selected by the given spec. */ public static <T> Spec<T> negate(Spec<? super T> spec) { if (spec == SATISFIES_ALL) { return satisfyNone(); } if (spec == SATISFIES_NONE) { return satisfyAll(); } if (spec instanceof NotSpec) { NotSpec<? super T> notSpec = (NotSpec<? super T>) spec; return Cast.uncheckedCast(notSpec.getSourceSpec()); } return new NotSpec<T>(spec); }
public static <T> NodeInitializerContext<T> forProperty(ModelType<T> type, ManagedProperty<?> property, ModelType<?> containingType) { return new NodeInitializerContext<T>(type, Specs.<ModelType<?>>satisfyAll(), Optional.of(new PropertyContext(property.getName(), property.getType(), property.isWritable(), property.isDeclaredAsHavingUnmanagedType(), containingType))); }
@Override public void create(final Action<? super T> action) { state.assertCanMutate(); String name = String.valueOf(modelNode.getLinkCount(ModelNodes.withType(elementType))); ModelPath childPath = modelNode.getPath().child(name); final ModelRuleDescriptor descriptor = this.descriptor.append("create()"); NodeInitializer nodeInitializer = creatorStrategy.initializer(elementType, Specs.<ModelType<?>>satisfyAll()); ModelRegistration registration = ModelRegistrations.of(childPath, nodeInitializer) .descriptor(descriptor) .action(ModelActionRole.Initialize, NoInputsModelAction.of(ModelReference.of(childPath, elementType), descriptor, action)) .build(); modelNode.addLink(registration); }
allArtifacts = configurationCopy.getResolvedConfiguration() .getLenientConfiguration() .getArtifacts(Specs.satisfyAll()); } else { allArtifacts = configurationCopy.getResolvedConfiguration()