Search in sources :

Example 1 with VariantVersionMappingStrategyInternal

use of org.gradle.api.publish.internal.versionmapping.VariantVersionMappingStrategyInternal in project gradle by gradle.

the class ModuleMetadataSpecBuilder method dependencyConstraintsFor.

private List<ModuleMetadataSpec.DependencyConstraint> dependencyConstraintsFor(UsageContext variant) {
    if (variant.getDependencyConstraints().isEmpty()) {
        return emptyList();
    }
    VariantVersionMappingStrategyInternal versionMappingStrategy = versionMappingStrategyFor(variant);
    ArrayList<ModuleMetadataSpec.DependencyConstraint> dependencyConstraints = new ArrayList<>();
    for (DependencyConstraint dependencyConstraint : variant.getDependencyConstraints()) {
        dependencyConstraints.add(dependencyConstraintFor(dependencyConstraint, versionMappingStrategy, variant.getName()));
    }
    return dependencyConstraints;
}
Also used : VariantVersionMappingStrategyInternal(org.gradle.api.publish.internal.versionmapping.VariantVersionMappingStrategyInternal) ArrayList(java.util.ArrayList) DependencyConstraint(org.gradle.api.artifacts.DependencyConstraint) DefaultProjectDependencyConstraint(org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependencyConstraint)

Example 2 with VariantVersionMappingStrategyInternal

use of org.gradle.api.publish.internal.versionmapping.VariantVersionMappingStrategyInternal in project gradle by gradle.

the class ModuleMetadataSpecBuilder method dependenciesOf.

private List<ModuleMetadataSpec.Dependency> dependenciesOf(UsageContext variant) {
    if (variant.getDependencies().isEmpty()) {
        return emptyList();
    }
    ArrayList<ModuleMetadataSpec.Dependency> dependencies = new ArrayList<>();
    Set<ExcludeRule> additionalExcludes = variant.getGlobalExcludes();
    VariantVersionMappingStrategyInternal versionMappingStrategy = versionMappingStrategyFor(variant);
    for (ModuleDependency moduleDependency : variant.getDependencies()) {
        if (moduleDependency.getArtifacts().isEmpty()) {
            dependencies.add(dependencyFor(moduleDependency, additionalExcludes, versionMappingStrategy, null, variant.getName()));
        } else {
            for (DependencyArtifact dependencyArtifact : moduleDependency.getArtifacts()) {
                dependencies.add(dependencyFor(moduleDependency, additionalExcludes, versionMappingStrategy, dependencyArtifact, variant.getName()));
            }
        }
    }
    return dependencies;
}
Also used : ModuleDependency(org.gradle.api.artifacts.ModuleDependency) VariantVersionMappingStrategyInternal(org.gradle.api.publish.internal.versionmapping.VariantVersionMappingStrategyInternal) DependencyArtifact(org.gradle.api.artifacts.DependencyArtifact) ArrayList(java.util.ArrayList) ExternalDependency(org.gradle.api.artifacts.ExternalDependency) ModuleDependency(org.gradle.api.artifacts.ModuleDependency) ProjectDependency(org.gradle.api.artifacts.ProjectDependency) DefaultExcludeRule(org.gradle.api.internal.artifacts.DefaultExcludeRule) ExcludeRule(org.gradle.api.artifacts.ExcludeRule)

Aggregations

ArrayList (java.util.ArrayList)2 VariantVersionMappingStrategyInternal (org.gradle.api.publish.internal.versionmapping.VariantVersionMappingStrategyInternal)2 DependencyArtifact (org.gradle.api.artifacts.DependencyArtifact)1 DependencyConstraint (org.gradle.api.artifacts.DependencyConstraint)1 ExcludeRule (org.gradle.api.artifacts.ExcludeRule)1 ExternalDependency (org.gradle.api.artifacts.ExternalDependency)1 ModuleDependency (org.gradle.api.artifacts.ModuleDependency)1 ProjectDependency (org.gradle.api.artifacts.ProjectDependency)1 DefaultExcludeRule (org.gradle.api.internal.artifacts.DefaultExcludeRule)1 DefaultProjectDependencyConstraint (org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependencyConstraint)1