use of org.gradle.internal.component.model.Exclude in project gradle by gradle.
the class ModuleExclusions method excludeAny.
/**
* Returns a spec that excludes those modules and artifacts that are excluded by _any_ of the given exclude rules.
*/
public ModuleExclusion excludeAny(List<Exclude> excludes) {
if (excludes.isEmpty()) {
return EXCLUDE_NONE;
}
AbstractModuleExclusion exclusion = excludeAnyCache.get(excludes);
if (exclusion != null) {
return exclusion;
}
Set<AbstractModuleExclusion> exclusions = Sets.newHashSetWithExpectedSize(excludes.size());
for (Exclude exclude : excludes) {
exclusions.add(forExclude(exclude));
}
exclusion = new IntersectionExclusion(asImmutable(exclusions));
excludeAnyCache.put(excludes, exclusion);
return exclusion;
}
use of org.gradle.internal.component.model.Exclude in project gradle by gradle.
the class IvyModuleDescriptorConverter method addDependency.
private void addDependency(List<IvyDependencyMetadata> result, DependencyDescriptor dependencyDescriptor) {
ModuleRevisionId revisionId = dependencyDescriptor.getDependencyRevisionId();
ModuleVersionSelector requested = DefaultModuleVersionSelector.newSelector(revisionId.getOrganisation(), revisionId.getName(), revisionId.getRevision());
ListMultimap<String, String> configMappings = ArrayListMultimap.create();
for (Map.Entry<String, List<String>> entry : readConfigMappings(dependencyDescriptor).entrySet()) {
configMappings.putAll(entry.getKey(), entry.getValue());
}
List<Artifact> artifacts = Lists.newArrayList();
for (DependencyArtifactDescriptor ivyArtifact : dependencyDescriptor.getAllDependencyArtifacts()) {
IvyArtifactName ivyArtifactName = new DefaultIvyArtifactName(ivyArtifact.getName(), ivyArtifact.getType(), ivyArtifact.getExt(), (String) ivyArtifact.getExtraAttributes().get(CLASSIFIER));
artifacts.add(new Artifact(ivyArtifactName, Sets.newHashSet(ivyArtifact.getConfigurations())));
}
List<Exclude> excludes = Lists.newArrayList();
for (ExcludeRule excludeRule : dependencyDescriptor.getAllExcludeRules()) {
excludes.add(forIvyExclude(excludeRule));
}
result.add(new IvyDependencyMetadata(requested, dependencyDescriptor.getDynamicConstraintDependencyRevisionId().getRevision(), false, dependencyDescriptor.isChanging(), dependencyDescriptor.isTransitive(), configMappings, artifacts, excludes));
}
use of org.gradle.internal.component.model.Exclude 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);
}
use of org.gradle.internal.component.model.Exclude in project gradle by gradle.
the class RealisedIvyModuleResolveMetadataSerializationHelper method readDependencyExcludes.
private List<Exclude> readDependencyExcludes(Decoder decoder) throws IOException {
int len = decoder.readSmallInt();
List<Exclude> result = Lists.newArrayListWithCapacity(len);
for (int i = 0; i < len; i++) {
DefaultExclude rule = readExcludeRule(decoder);
result.add(rule);
}
return result;
}
use of org.gradle.internal.component.model.Exclude in project gradle by gradle.
the class RealisedIvyModuleResolveMetadataSerializationHelper method readIvyDependency.
private IvyDependencyDescriptor readIvyDependency(Decoder decoder) throws IOException {
ModuleComponentSelector requested = getComponentSelectorSerializer().read(decoder);
SetMultimap<String, String> configMappings = readDependencyConfigurationMapping(decoder);
List<Artifact> artifacts = readDependencyArtifactDescriptors(decoder);
List<Exclude> excludes = readDependencyExcludes(decoder);
String dynamicConstraintVersion = decoder.readString();
boolean changing = decoder.readBoolean();
boolean transitive = decoder.readBoolean();
boolean optional = decoder.readBoolean();
return new IvyDependencyDescriptor(requested, dynamicConstraintVersion, changing, transitive, optional, configMappings, artifacts, excludes);
}
Aggregations