public static DependentComponentsRenderableDependency of( ComponentSpec componentSpec, ComponentSpecInternal internalProtocol, LinkedHashSet<DependentComponentsRenderableDependency> children) { ComponentSpecIdentifier id = internalProtocol.getIdentifier(); String name = DependentComponentsUtils.getBuildScopedTerseName(id); String description = componentSpec.getDisplayName(); boolean buildable = true; if (componentSpec instanceof VariantComponentSpec) { // Consider variant aware components with no buildable binaries as non-buildables VariantComponentSpec variantComponentSpec = (VariantComponentSpec) componentSpec; buildable = Iterables.any( variantComponentSpec.getBinaries().values(), new Predicate<BinarySpec>() { @Override public boolean apply(BinarySpec binarySpec) { return binarySpec.isBuildable(); } }); } boolean testSuite = false; return new DependentComponentsRenderableDependency( id, name, description, buildable, testSuite, children); }
public static DependentComponentsRenderableDependency of( DependentBinariesResolvedResult resolvedResult) { LibraryBinaryIdentifier id = resolvedResult.getId(); String name = DependentComponentsUtils.getBuildScopedTerseName(id); String description = id.getDisplayName(); boolean buildable = resolvedResult.isBuildable(); boolean testSuite = resolvedResult.isTestSuite(); LinkedHashSet<DependentComponentsRenderableDependency> children = Sets.newLinkedHashSet(); for (DependentBinariesResolvedResult childResolutionResult : resolvedResult.getChildren()) { children.add(of(childResolutionResult)); } return new DependentComponentsRenderableDependency( id, name, description, buildable, testSuite, children); }