Search in sources :

Example 1 with DependentBinariesResolvedResult

use of org.gradle.platform.base.internal.dependents.DependentBinariesResolvedResult in project gradle by gradle.

the class NativeDependentBinariesResolutionStrategy method doBuildResolvedResult.

private List<DependentBinariesResolvedResult> doBuildResolvedResult(final NativeBinarySpecInternal target, State state, Deque<NativeBinarySpecInternal> stack) {
    if (stack.contains(target)) {
        onCircularDependencies(state, stack, target);
    }
    List<DependentBinariesResolvedResult> result = resultsCache.getIfPresent(target);
    if (result != null) {
        return result;
    }
    stack.push(target);
    result = Lists.newArrayList();
    List<NativeBinarySpecInternal> dependents = state.getDependents(target);
    for (NativeBinarySpecInternal dependent : dependents) {
        List<DependentBinariesResolvedResult> children = doBuildResolvedResult(dependent, state, stack);
        result.add(new DefaultDependentBinariesResolvedResult(dependent.getId(), dependent.getProjectScopedName(), dependent.isBuildable(), isTestSuite(dependent), children));
    }
    stack.pop();
    resultsCache.put(target, result);
    return result;
}
Also used : DependentBinariesResolvedResult(org.gradle.platform.base.internal.dependents.DependentBinariesResolvedResult) DefaultDependentBinariesResolvedResult(org.gradle.platform.base.internal.dependents.DefaultDependentBinariesResolvedResult) DefaultDependentBinariesResolvedResult(org.gradle.platform.base.internal.dependents.DefaultDependentBinariesResolvedResult)

Example 2 with DependentBinariesResolvedResult

use of org.gradle.platform.base.internal.dependents.DependentBinariesResolvedResult in project gradle by gradle.

the class NativeComponents method getDependentTaskDependencies.

private static List<Task> getDependentTaskDependencies(String dependedOnBinaryTaskName, BinarySpecInternal binary, DependentBinariesResolver dependentsResolver, ProjectModelResolver projectModelResolver) {
    List<Task> dependencies = Lists.newArrayList();
    DependentBinariesResolvedResult result = dependentsResolver.resolve(binary).getRoot();
    for (DependentBinariesResolvedResult dependent : result.getChildren()) {
        if (dependent.isBuildable()) {
            ModelRegistry modelRegistry = projectModelResolver.resolveProjectModel(dependent.getId().getProjectPath());
            ModelMap<NativeBinarySpecInternal> projectBinaries = modelRegistry.realize("binaries", ModelTypes.modelMap(NativeBinarySpecInternal.class));
            ModelMap<Task> projectTasks = modelRegistry.realize("tasks", ModelTypes.modelMap(Task.class));
            NativeBinarySpecInternal dependentBinary = projectBinaries.get(dependent.getProjectScopedName());
            dependencies.add(projectTasks.get(dependentBinary.getNamingScheme().getTaskName(dependedOnBinaryTaskName)));
        }
    }
    return dependencies;
}
Also used : Task(org.gradle.api.Task) DefaultTask(org.gradle.api.DefaultTask) ModelRegistry(org.gradle.model.internal.registry.ModelRegistry) DependentBinariesResolvedResult(org.gradle.platform.base.internal.dependents.DependentBinariesResolvedResult)

Example 3 with DependentBinariesResolvedResult

use of org.gradle.platform.base.internal.dependents.DependentBinariesResolvedResult in project gradle by gradle.

the class DependentComponentsRenderableDependency method of.

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);
}
Also used : DependentBinariesResolvedResult(org.gradle.platform.base.internal.dependents.DependentBinariesResolvedResult) LibraryBinaryIdentifier(org.gradle.api.artifacts.component.LibraryBinaryIdentifier)

Aggregations

DependentBinariesResolvedResult (org.gradle.platform.base.internal.dependents.DependentBinariesResolvedResult)3 DefaultTask (org.gradle.api.DefaultTask)1 Task (org.gradle.api.Task)1 LibraryBinaryIdentifier (org.gradle.api.artifacts.component.LibraryBinaryIdentifier)1 ModelRegistry (org.gradle.model.internal.registry.ModelRegistry)1 DefaultDependentBinariesResolvedResult (org.gradle.platform.base.internal.dependents.DefaultDependentBinariesResolvedResult)1