Search in sources :

Example 1 with HasConfigurableAttributes

use of org.gradle.api.attributes.HasConfigurableAttributes in project gradle by gradle.

the class DefaultDependencyHandler method platform.

@Override
public Dependency platform(Object notation) {
    Dependency dependency = create(notation);
    if (dependency instanceof ModuleDependency) {
        ModuleDependency moduleDependency = (ModuleDependency) dependency;
        moduleDependency.endorseStrictVersions();
        platformSupport.addPlatformAttribute(moduleDependency, toCategory(Category.REGULAR_PLATFORM));
    } else if (dependency instanceof HasConfigurableAttributes) {
        platformSupport.addPlatformAttribute((HasConfigurableAttributes<?>) dependency, toCategory(Category.REGULAR_PLATFORM));
    }
    return dependency;
}
Also used : ExternalModuleDependency(org.gradle.api.artifacts.ExternalModuleDependency) ModuleDependency(org.gradle.api.artifacts.ModuleDependency) MinimalExternalModuleDependency(org.gradle.api.artifacts.MinimalExternalModuleDependency) HasConfigurableAttributes(org.gradle.api.attributes.HasConfigurableAttributes) ExternalModuleDependency(org.gradle.api.artifacts.ExternalModuleDependency) ModuleDependency(org.gradle.api.artifacts.ModuleDependency) MinimalExternalModuleDependency(org.gradle.api.artifacts.MinimalExternalModuleDependency) ProjectDependency(org.gradle.api.artifacts.ProjectDependency) Dependency(org.gradle.api.artifacts.Dependency)

Example 2 with HasConfigurableAttributes

use of org.gradle.api.attributes.HasConfigurableAttributes in project gradle by gradle.

the class DefaultDependencyHandler method enforcedPlatform.

@Override
@SuppressWarnings("deprecation")
public Dependency enforcedPlatform(Object notation) {
    Dependency platformDependency = create(notation);
    if (platformDependency instanceof ExternalModuleDependency) {
        ExternalModuleDependency externalModuleDependency = (ExternalModuleDependency) platformDependency;
        DeprecationLogger.whileDisabled(() -> externalModuleDependency.setForce(true));
        platformSupport.addPlatformAttribute(externalModuleDependency, toCategory(Category.ENFORCED_PLATFORM));
    } else if (platformDependency instanceof HasConfigurableAttributes) {
        platformSupport.addPlatformAttribute((HasConfigurableAttributes<?>) platformDependency, toCategory(Category.ENFORCED_PLATFORM));
    }
    return platformDependency;
}
Also used : HasConfigurableAttributes(org.gradle.api.attributes.HasConfigurableAttributes) ExternalModuleDependency(org.gradle.api.artifacts.ExternalModuleDependency) ModuleDependency(org.gradle.api.artifacts.ModuleDependency) MinimalExternalModuleDependency(org.gradle.api.artifacts.MinimalExternalModuleDependency) ProjectDependency(org.gradle.api.artifacts.ProjectDependency) Dependency(org.gradle.api.artifacts.Dependency) ExternalModuleDependency(org.gradle.api.artifacts.ExternalModuleDependency) MinimalExternalModuleDependency(org.gradle.api.artifacts.MinimalExternalModuleDependency)

Aggregations

Dependency (org.gradle.api.artifacts.Dependency)2 ExternalModuleDependency (org.gradle.api.artifacts.ExternalModuleDependency)2 MinimalExternalModuleDependency (org.gradle.api.artifacts.MinimalExternalModuleDependency)2 ModuleDependency (org.gradle.api.artifacts.ModuleDependency)2 ProjectDependency (org.gradle.api.artifacts.ProjectDependency)2 HasConfigurableAttributes (org.gradle.api.attributes.HasConfigurableAttributes)2