Search in sources :

Example 31 with Configuration

use of org.gradle.api.artifacts.Configuration in project gradle by gradle.

the class DefaultLocalComponentMetadataBuilder method addConfiguration.

private BuildableLocalConfigurationMetadata addConfiguration(BuildableLocalComponentMetadata metaData, ConfigurationInternal configuration) {
    configuration.preventFromFurtherMutation();
    Set<String> hierarchy = Configurations.getNames(configuration.getHierarchy());
    Set<String> extendsFrom = Configurations.getNames(configuration.getExtendsFrom());
    // Presence of capabilities is bound to the definition of a capabilities extension to the project
    ImmutableCapabilities capabilities = asImmutable(Configurations.collectCapabilities(configuration, Sets.<Capability>newHashSet(), Sets.<Configuration>newHashSet()));
    return metaData.addConfiguration(configuration.getName(), configuration.getDescription(), extendsFrom, hierarchy, configuration.isVisible(), configuration.isTransitive(), configuration.getAttributes().asImmutable(), configuration.isCanBeConsumed(), configuration.isCanBeResolved(), capabilities);
}
Also used : ImmutableCapability(org.gradle.internal.component.external.model.ImmutableCapability) Capability(org.gradle.api.capabilities.Capability) Configuration(org.gradle.api.artifacts.Configuration) ImmutableCapabilities(org.gradle.internal.component.external.model.ImmutableCapabilities)

Example 32 with Configuration

use of org.gradle.api.artifacts.Configuration in project gradle by gradle.

the class DefaultConfiguration method initAllDependencies.

private synchronized void initAllDependencies() {
    if (allDependencies != null) {
        return;
    }
    inheritedDependencies = CompositeDomainObjectSet.create(Dependency.class, ownDependencies);
    for (Configuration configuration : this.extendsFrom) {
        inheritedDependencies.addCollection(configuration.getAllDependencies());
    }
    allDependencies = new DefaultDependencySet(Describables.of(displayName, "all dependencies"), this, inheritedDependencies);
}
Also used : ResolvedConfiguration(org.gradle.api.artifacts.ResolvedConfiguration) ResolvedProjectConfiguration(org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedProjectConfiguration) DefaultLenientConfiguration(org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration) Configuration(org.gradle.api.artifacts.Configuration) DefaultDependencySet(org.gradle.api.internal.artifacts.DefaultDependencySet) Dependency(org.gradle.api.artifacts.Dependency) TaskDependency(org.gradle.api.tasks.TaskDependency) FileCollectionDependency(org.gradle.api.artifacts.FileCollectionDependency) AbstractTaskDependency(org.gradle.api.internal.tasks.AbstractTaskDependency)

Example 33 with Configuration

use of org.gradle.api.artifacts.Configuration in project gradle by gradle.

the class DefaultConfiguration method initAllArtifacts.

private synchronized void initAllArtifacts() {
    if (allArtifacts != null) {
        return;
    }
    this.inheritedArtifacts = CompositeDomainObjectSet.create(PublishArtifact.class, ownArtifacts);
    for (Configuration configuration : this.extendsFrom) {
        inheritedArtifacts.addCollection(configuration.getAllArtifacts());
    }
    this.allArtifacts = new DefaultPublishArtifactSet(Describables.of(displayName, "all artifacts"), inheritedArtifacts, fileCollectionFactory);
}
Also used : DefaultPublishArtifactSet(org.gradle.api.internal.artifacts.DefaultPublishArtifactSet) ResolvedConfiguration(org.gradle.api.artifacts.ResolvedConfiguration) ResolvedProjectConfiguration(org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedProjectConfiguration) DefaultLenientConfiguration(org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration) Configuration(org.gradle.api.artifacts.Configuration) ConfigurablePublishArtifact(org.gradle.api.artifacts.ConfigurablePublishArtifact) PublishArtifact(org.gradle.api.artifacts.PublishArtifact)

Example 34 with Configuration

use of org.gradle.api.artifacts.Configuration in project gradle by gradle.

the class DefaultConfiguration method initAllDependencyConstraints.

private synchronized void initAllDependencyConstraints() {
    if (allDependencyConstraints != null) {
        return;
    }
    inheritedDependencyConstraints = CompositeDomainObjectSet.create(DependencyConstraint.class, ownDependencyConstraints);
    for (Configuration configuration : this.extendsFrom) {
        inheritedDependencyConstraints.addCollection(configuration.getAllDependencyConstraints());
    }
    allDependencyConstraints = new DefaultDependencyConstraintSet(Describables.of(displayName, "all dependency constraints"), inheritedDependencyConstraints);
}
Also used : DefaultDependencyConstraintSet(org.gradle.api.internal.artifacts.DefaultDependencyConstraintSet) ResolvedConfiguration(org.gradle.api.artifacts.ResolvedConfiguration) ResolvedProjectConfiguration(org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedProjectConfiguration) DefaultLenientConfiguration(org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration) Configuration(org.gradle.api.artifacts.Configuration) DefaultDependencyConstraint(org.gradle.api.internal.artifacts.dependencies.DefaultDependencyConstraint) DependencyConstraint(org.gradle.api.artifacts.DependencyConstraint)

Example 35 with Configuration

use of org.gradle.api.artifacts.Configuration in project gradle by gradle.

the class DefaultConfiguration method setExtendsFrom.

public Configuration setExtendsFrom(Iterable<Configuration> extendsFrom) {
    validateMutation(MutationType.DEPENDENCIES);
    for (Configuration configuration : this.extendsFrom) {
        if (inheritedArtifacts != null) {
            inheritedArtifacts.removeCollection(configuration.getAllArtifacts());
        }
        if (inheritedDependencies != null) {
            inheritedDependencies.removeCollection(configuration.getAllDependencies());
        }
        if (inheritedDependencyConstraints != null) {
            inheritedDependencyConstraints.removeCollection(configuration.getAllDependencyConstraints());
        }
        ((ConfigurationInternal) configuration).removeMutationValidator(parentMutationValidator);
    }
    this.extendsFrom = new LinkedHashSet<Configuration>();
    for (Configuration configuration : extendsFrom) {
        extendsFrom(configuration);
    }
    return this;
}
Also used : ResolvedConfiguration(org.gradle.api.artifacts.ResolvedConfiguration) ResolvedProjectConfiguration(org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedProjectConfiguration) DefaultLenientConfiguration(org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration) Configuration(org.gradle.api.artifacts.Configuration)

Aggregations

Configuration (org.gradle.api.artifacts.Configuration)85 Project (org.gradle.api.Project)11 ConfigurationContainer (org.gradle.api.artifacts.ConfigurationContainer)11 File (java.io.File)10 Dependency (org.gradle.api.artifacts.Dependency)10 Callable (java.util.concurrent.Callable)9 ResolvedConfiguration (org.gradle.api.artifacts.ResolvedConfiguration)9 ResolvedProjectConfiguration (org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedProjectConfiguration)9 DependencySet (org.gradle.api.artifacts.DependencySet)8 DefaultLenientConfiguration (org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration)7 LinkedHashSet (java.util.LinkedHashSet)6 Usage (org.gradle.api.attributes.Usage)6 Action (org.gradle.api.Action)5 ConventionMapping (org.gradle.api.internal.ConventionMapping)5 PublishArtifact (org.gradle.api.artifacts.PublishArtifact)4 IConventionAware (org.gradle.api.internal.IConventionAware)4 ArchivePublishArtifact (org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact)4 DefaultUsageContext (org.gradle.language.cpp.internal.DefaultUsageContext)4 Set (java.util.Set)3 FileCollectionDependency (org.gradle.api.artifacts.FileCollectionDependency)3