Search in sources :

Example 6 with BinarySpecInternal

use of org.gradle.platform.base.internal.BinarySpecInternal in project gradle by gradle.

the class NativeComponents method wireBuildDependentTasks.

public static void wireBuildDependentTasks(final ModelMap<Task> tasks, BinaryContainer binaries, final DependentBinariesResolver dependentsResolver, final ProjectModelResolver projectModelResolver) {
    final ModelMap<NativeBinarySpecInternal> nativeBinaries = binaries.withType(NativeBinarySpecInternal.class);
    for (final BinarySpecInternal binary : nativeBinaries) {
        Task assembleDependents = tasks.get(binary.getNamingScheme().getTaskName(ASSEMBLE_DEPENDENTS_TASK_NAME));
        Task buildDependents = tasks.get(binary.getNamingScheme().getTaskName(BUILD_DEPENDENTS_TASK_NAME));
        // Wire build dependent components tasks dependencies
        Task assembleDependentComponents = tasks.get(getAssembleDependentComponentsTaskName(binary.getComponent()));
        if (assembleDependentComponents != null) {
            assembleDependentComponents.dependsOn(assembleDependents);
        }
        Task buildDependentComponents = tasks.get(getBuildDependentComponentsTaskName(binary.getComponent()));
        if (buildDependentComponents != null) {
            buildDependentComponents.dependsOn(buildDependents);
        }
        // Wire build dependent binaries tasks dependencies
        // Defer dependencies gathering as we need to resolve across project's boundaries
        assembleDependents.dependsOn(new Callable<Iterable<Task>>() {

            @Override
            public Iterable<Task> call() {
                return getDependentTaskDependencies(ASSEMBLE_DEPENDENTS_TASK_NAME, binary, dependentsResolver, projectModelResolver);
            }
        });
        buildDependents.dependsOn(new Callable<Iterable<Task>>() {

            @Override
            public Iterable<Task> call() {
                return getDependentTaskDependencies(BUILD_DEPENDENTS_TASK_NAME, binary, dependentsResolver, projectModelResolver);
            }
        });
    }
}
Also used : Task(org.gradle.api.Task) DefaultTask(org.gradle.api.DefaultTask) BinarySpecInternal(org.gradle.platform.base.internal.BinarySpecInternal)

Example 7 with BinarySpecInternal

use of org.gradle.platform.base.internal.BinarySpecInternal in project gradle by gradle.

the class DependentComponentsRenderer method getRenderableDependencyOf.

private DependentComponentsRenderableDependency getRenderableDependencyOf(final ComponentSpec componentSpec, ComponentSpecInternal internalProtocol) {
    if (resolver != null && componentSpec instanceof VariantComponentSpec) {
        VariantComponentSpec variantComponentSpec = (VariantComponentSpec) componentSpec;
        LinkedHashSet<DependentComponentsRenderableDependency> children = Sets.newLinkedHashSet();
        for (BinarySpecInternal binarySpec : variantComponentSpec.getBinaries().withType(BinarySpecInternal.class)) {
            DependentBinariesResolutionResult resolvedBinary = resolver.resolve(binarySpec);
            children.add(DependentComponentsRenderableDependency.of(resolvedBinary.getRoot()));
        }
        return DependentComponentsRenderableDependency.of(componentSpec, internalProtocol, children);
    } else {
        return DependentComponentsRenderableDependency.of(componentSpec, internalProtocol);
    }
}
Also used : VariantComponentSpec(org.gradle.platform.base.VariantComponentSpec) BinarySpecInternal(org.gradle.platform.base.internal.BinarySpecInternal) DependentBinariesResolutionResult(org.gradle.platform.base.internal.dependents.DependentBinariesResolutionResult)

Example 8 with BinarySpecInternal

use of org.gradle.platform.base.internal.BinarySpecInternal in project gradle by gradle.

the class JvmTestSuiteBasePlugin method configureRuntimeClasspath.

@Finalize
public void configureRuntimeClasspath(@Each JvmTestSuiteBinarySpecInternal testBinary, ServiceRegistry serviceRegistry, ModelSchemaStore modelSchemaStore) {
    ArtifactDependencyResolver dependencyResolver = serviceRegistry.get(ArtifactDependencyResolver.class);
    RepositoryHandler repositories = serviceRegistry.get(RepositoryHandler.class);
    List<ResolutionAwareRepository> resolutionAwareRepositories = CollectionUtils.collect(repositories, Transformers.cast(ResolutionAwareRepository.class));
    ModelSchema<? extends JvmTestSuiteBinarySpec> schema = Cast.uncheckedCast(modelSchemaStore.getSchema(((BinarySpecInternal) testBinary).getPublicType()));
    AttributesSchema attributesSchema = serviceRegistry.get(AttributesSchema.class);
    ImmutableModuleIdentifierFactory moduleIdentifierFactory = serviceRegistry.get(ImmutableModuleIdentifierFactory.class);
    ModuleExclusions moduleExclusions = serviceRegistry.get(ModuleExclusions.class);
    BuildOperationProcessor buildOperationProcessor = serviceRegistry.get(BuildOperationProcessor.class);
    testBinary.setRuntimeClasspath(configureRuntimeClasspath(testBinary, dependencyResolver, resolutionAwareRepositories, schema, attributesSchema, moduleIdentifierFactory, moduleExclusions, buildOperationProcessor));
}
Also used : ArtifactDependencyResolver(org.gradle.api.internal.artifacts.ArtifactDependencyResolver) ImmutableModuleIdentifierFactory(org.gradle.api.internal.artifacts.ImmutableModuleIdentifierFactory) ModuleExclusions(org.gradle.api.internal.artifacts.ivyservice.resolveengine.excludes.ModuleExclusions) BinarySpecInternal(org.gradle.platform.base.internal.BinarySpecInternal) JvmBinarySpecInternal(org.gradle.jvm.internal.JvmBinarySpecInternal) JvmTestSuiteBinarySpecInternal(org.gradle.jvm.test.internal.JvmTestSuiteBinarySpecInternal) ResolutionAwareRepository(org.gradle.api.internal.artifacts.repositories.ResolutionAwareRepository) BuildOperationProcessor(org.gradle.internal.operations.BuildOperationProcessor) RepositoryHandler(org.gradle.api.artifacts.dsl.RepositoryHandler) AttributesSchema(org.gradle.api.attributes.AttributesSchema)

Aggregations

BinarySpecInternal (org.gradle.platform.base.internal.BinarySpecInternal)8 BinarySpec (org.gradle.platform.base.BinarySpec)4 Binary (org.gradle.platform.base.Binary)3 Joiner (com.google.common.base.Joiner)1 ArrayList (java.util.ArrayList)1 TreeSet (java.util.TreeSet)1 DefaultTask (org.gradle.api.DefaultTask)1 Named (org.gradle.api.Named)1 Task (org.gradle.api.Task)1 LibraryBinaryIdentifier (org.gradle.api.artifacts.component.LibraryBinaryIdentifier)1 RepositoryHandler (org.gradle.api.artifacts.dsl.RepositoryHandler)1 AttributesSchema (org.gradle.api.attributes.AttributesSchema)1 ArtifactDependencyResolver (org.gradle.api.internal.artifacts.ArtifactDependencyResolver)1 ImmutableModuleIdentifierFactory (org.gradle.api.internal.artifacts.ImmutableModuleIdentifierFactory)1 ModuleExclusions (org.gradle.api.internal.artifacts.ivyservice.resolveengine.excludes.ModuleExclusions)1 ResolutionAwareRepository (org.gradle.api.internal.artifacts.repositories.ResolutionAwareRepository)1 BuildOperationProcessor (org.gradle.internal.operations.BuildOperationProcessor)1 TreeFormatter (org.gradle.internal.text.TreeFormatter)1 JvmBinarySpecInternal (org.gradle.jvm.internal.JvmBinarySpecInternal)1 JvmTestSuiteBinarySpecInternal (org.gradle.jvm.test.internal.JvmTestSuiteBinarySpecInternal)1