Search in sources :

Example 1 with ExternalModuleDependency

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

the class ExternalModuleIvyDependencyDescriptorFactory method createDependencyDescriptor.

public DslOriginDependencyMetadata createDependencyDescriptor(String clientConfiguration, AttributeContainer clientAttributes, ModuleDependency dependency) {
    ExternalModuleDependency externalModuleDependency = (ExternalModuleDependency) dependency;
    boolean force = externalModuleDependency.isForce();
    boolean changing = externalModuleDependency.isChanging();
    boolean transitive = externalModuleDependency.isTransitive();
    ModuleVersionSelector requested = new DefaultModuleVersionSelector(nullToEmpty(dependency.getGroup()), nullToEmpty(dependency.getName()), nullToEmpty(dependency.getVersion()));
    ModuleComponentSelector selector = DefaultModuleComponentSelector.newSelector(requested);
    List<Exclude> excludes = convertExcludeRules(clientConfiguration, dependency.getExcludeRules());
    LocalComponentDependencyMetadata dependencyMetaData = new LocalComponentDependencyMetadata(selector, requested, clientConfiguration, clientAttributes, dependency.getTargetConfiguration(), convertArtifacts(dependency.getArtifacts()), excludes, force, changing, transitive);
    return new DslOriginDependencyMetadataWrapper(dependencyMetaData, dependency);
}
Also used : DefaultModuleVersionSelector(org.gradle.api.internal.artifacts.DefaultModuleVersionSelector) ModuleVersionSelector(org.gradle.api.artifacts.ModuleVersionSelector) DefaultModuleVersionSelector(org.gradle.api.internal.artifacts.DefaultModuleVersionSelector) Exclude(org.gradle.internal.component.model.Exclude) DefaultModuleComponentSelector(org.gradle.internal.component.external.model.DefaultModuleComponentSelector) ModuleComponentSelector(org.gradle.api.artifacts.component.ModuleComponentSelector) DslOriginDependencyMetadataWrapper(org.gradle.internal.component.local.model.DslOriginDependencyMetadataWrapper) ExternalModuleDependency(org.gradle.api.artifacts.ExternalModuleDependency) LocalComponentDependencyMetadata(org.gradle.internal.component.model.LocalComponentDependencyMetadata)

Example 2 with ExternalModuleDependency

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

the class ExternalModuleIvyDependencyDescriptorFactory method createDependencyDescriptor.

@Override
public LocalOriginDependencyMetadata createDependencyDescriptor(ComponentIdentifier componentId, @Nullable String clientConfiguration, @Nullable AttributeContainer clientAttributes, ModuleDependency dependency) {
    ExternalModuleDependency externalModuleDependency = (ExternalModuleDependency) dependency;
    boolean force = externalModuleDependency.isForce();
    boolean changing = externalModuleDependency.isChanging();
    boolean transitive = externalModuleDependency.isTransitive();
    ModuleComponentSelector selector = DefaultModuleComponentSelector.newSelector(DefaultModuleIdentifier.newId(nullToEmpty(dependency.getGroup()), nullToEmpty(dependency.getName())), ((VersionConstraintInternal) externalModuleDependency.getVersionConstraint()).asImmutable(), dependency.getAttributes(), dependency.getRequestedCapabilities());
    List<ExcludeMetadata> excludes = convertExcludeRules(dependency.getExcludeRules());
    LocalComponentDependencyMetadata dependencyMetaData = new LocalComponentDependencyMetadata(componentId, selector, clientConfiguration, clientAttributes, dependency.getAttributes(), dependency.getTargetConfiguration(), convertArtifacts(dependency.getArtifacts()), excludes, force, changing, transitive, false, dependency.isEndorsingStrictVersions(), dependency.getReason());
    return new DslOriginDependencyMetadataWrapper(dependencyMetaData, dependency);
}
Also used : DefaultModuleComponentSelector(org.gradle.internal.component.external.model.DefaultModuleComponentSelector) ModuleComponentSelector(org.gradle.api.artifacts.component.ModuleComponentSelector) DslOriginDependencyMetadataWrapper(org.gradle.internal.component.local.model.DslOriginDependencyMetadataWrapper) ExternalModuleDependency(org.gradle.api.artifacts.ExternalModuleDependency) ExcludeMetadata(org.gradle.internal.component.model.ExcludeMetadata) LocalComponentDependencyMetadata(org.gradle.internal.component.model.LocalComponentDependencyMetadata)

Example 3 with ExternalModuleDependency

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

the class DependenciesAwareVersionCatalogBuilder method copyDependencyVersion.

private static void copyDependencyVersion(Dependency dependency, String group, String name, MutableVersionConstraint v) {
    if (dependency instanceof ExternalModuleDependency) {
        VersionConstraint vc = ((ExternalModuleDependency) dependency).getVersionConstraint();
        copyConstraint(vc, v);
    } else {
        String version = dependency.getVersion();
        if (version == null || version.isEmpty()) {
            throw new InvalidUserDataException("Version for dependency " + group + ":" + name + " must not be empty");
        }
        v.require(version);
    }
}
Also used : ImmutableVersionConstraint(org.gradle.api.internal.artifacts.ImmutableVersionConstraint) MutableVersionConstraint(org.gradle.api.artifacts.MutableVersionConstraint) VersionConstraint(org.gradle.api.artifacts.VersionConstraint) InvalidUserDataException(org.gradle.api.InvalidUserDataException) ExternalModuleDependency(org.gradle.api.artifacts.ExternalModuleDependency)

Example 4 with ExternalModuleDependency

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

the class DefaultComponentDependencies method implementation.

@Override
public void implementation(Object notation, Action<? super ExternalModuleDependency> action) {
    ExternalModuleDependency dependency = (ExternalModuleDependency) getDependencyHandler().create(notation);
    action.execute(dependency);
    implementation.getDependencies().add(dependency);
}
Also used : ExternalModuleDependency(org.gradle.api.artifacts.ExternalModuleDependency)

Example 5 with ExternalModuleDependency

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

the class DefaultLibraryDependencies method api.

@Override
public void api(Object notation, Action<? super ExternalModuleDependency> action) {
    ExternalModuleDependency dependency = (ExternalModuleDependency) getDependencyHandler().create(notation);
    action.execute(dependency);
    apiDependencies.getDependencies().add(dependency);
}
Also used : ExternalModuleDependency(org.gradle.api.artifacts.ExternalModuleDependency)

Aggregations

ExternalModuleDependency (org.gradle.api.artifacts.ExternalModuleDependency)6 ModuleComponentSelector (org.gradle.api.artifacts.component.ModuleComponentSelector)2 DefaultModuleComponentSelector (org.gradle.internal.component.external.model.DefaultModuleComponentSelector)2 DslOriginDependencyMetadataWrapper (org.gradle.internal.component.local.model.DslOriginDependencyMetadataWrapper)2 LocalComponentDependencyMetadata (org.gradle.internal.component.model.LocalComponentDependencyMetadata)2 InvalidUserDataException (org.gradle.api.InvalidUserDataException)1 Dependency (org.gradle.api.artifacts.Dependency)1 MinimalExternalModuleDependency (org.gradle.api.artifacts.MinimalExternalModuleDependency)1 ModuleDependency (org.gradle.api.artifacts.ModuleDependency)1 ModuleVersionSelector (org.gradle.api.artifacts.ModuleVersionSelector)1 MutableVersionConstraint (org.gradle.api.artifacts.MutableVersionConstraint)1 ProjectDependency (org.gradle.api.artifacts.ProjectDependency)1 VersionConstraint (org.gradle.api.artifacts.VersionConstraint)1 HasConfigurableAttributes (org.gradle.api.attributes.HasConfigurableAttributes)1 DefaultModuleVersionSelector (org.gradle.api.internal.artifacts.DefaultModuleVersionSelector)1 ImmutableVersionConstraint (org.gradle.api.internal.artifacts.ImmutableVersionConstraint)1 Exclude (org.gradle.internal.component.model.Exclude)1 ExcludeMetadata (org.gradle.internal.component.model.ExcludeMetadata)1