Search in sources :

Example 6 with ConfigurationVariant

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

the class ConfigurationVariantMapping method collectUsageContexts.

public void collectUsageContexts(final ImmutableCollection.Builder<UsageContext> outgoing) {
    if (!outgoingConfiguration.isTransitive()) {
        DeprecationLogger.warnOfChangedBehaviour("Publication ignores 'transitive = false' at configuration level.", "Consider using 'transitive = false' at the dependency level if you need this to be published.").withUserManual("publishing_ivy", "configurations_marked_as_non_transitive").nagUser();
    }
    Set<String> seen = Sets.newHashSet();
    ConfigurationVariant defaultConfigurationVariant = instantiator.newInstance(DefaultConfigurationVariant.class, outgoingConfiguration);
    ConfigurationVariantDetailsInternal details = instantiator.newInstance(DefaultConfigurationVariantDetails.class, defaultConfigurationVariant);
    action.execute(details);
    String outgoingConfigurationName = outgoingConfiguration.getName();
    if (details.shouldPublish()) {
        registerUsageContext(outgoing, seen, defaultConfigurationVariant, outgoingConfigurationName, details.getMavenScope(), details.isOptional());
    }
    NamedDomainObjectContainer<ConfigurationVariant> extraVariants = outgoingConfiguration.getOutgoing().getVariants();
    for (ConfigurationVariant variant : extraVariants) {
        details = new DefaultConfigurationVariantDetails(variant);
        action.execute(details);
        if (details.shouldPublish()) {
            String name = outgoingConfigurationName + StringUtils.capitalize(variant.getName());
            registerUsageContext(outgoing, seen, variant, name, details.getMavenScope(), details.isOptional());
        }
    }
}
Also used : ConfigurationVariant(org.gradle.api.artifacts.ConfigurationVariant)

Aggregations

ConfigurationVariant (org.gradle.api.artifacts.ConfigurationVariant)6 File (java.io.File)4 ConfigurationPublications (org.gradle.api.artifacts.ConfigurationPublications)4 Usage (org.gradle.api.attributes.Usage)3 Configuration (org.gradle.api.artifacts.Configuration)1 LibraryElements (org.gradle.api.attributes.LibraryElements)1 ConfigurationVariantInternal (org.gradle.api.internal.artifacts.ConfigurationVariantInternal)1 JvmPluginsHelper (org.gradle.api.plugins.internal.JvmPluginsHelper)1 SourceSet (org.gradle.api.tasks.SourceSet)1 JavaCompile (org.gradle.api.tasks.compile.JavaCompile)1