Skip to content

Commit

Permalink
Merge pull request #394 from octylFractal
Browse files Browse the repository at this point in the history
* gh-394:
  Check for ModuleComponentIdentifier explicitly

Closes gh-394
  • Loading branch information
wilkinsona committed Sep 2, 2024
2 parents e85cd28 + 09853a2 commit 0d1b43d
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
import io.spring.gradle.dependencymanagement.internal.pom.Pom;
import io.spring.gradle.dependencymanagement.internal.pom.PomReference;
import io.spring.gradle.dependencymanagement.internal.pom.PomResolver;
import org.gradle.api.artifacts.ModuleVersionIdentifier;
import org.gradle.api.artifacts.component.ProjectComponentIdentifier;
import org.gradle.api.artifacts.component.ModuleComponentIdentifier;
import org.gradle.api.artifacts.result.ResolvedComponentResult;

/**
Expand All @@ -58,17 +57,16 @@ Map<String, Exclusions> resolveExclusions(Collection<ResolvedComponentResult> re
List<PomReference> pomReferences = new ArrayList<>();
Map<String, Exclusions> exclusionsById = new HashMap<>();
for (ResolvedComponentResult resolvedComponent : resolvedComponents) {
ModuleVersionIdentifier moduleVersion = resolvedComponent.getModuleVersion();
if (!(resolvedComponent.getId() instanceof ProjectComponentIdentifier) && moduleVersion.getGroup() != null
&& moduleVersion.getName() != null) {
String id = moduleVersion.getGroup() + ":" + moduleVersion.getName();
if (resolvedComponent.getId() instanceof ModuleComponentIdentifier) {
ModuleComponentIdentifier identifier = (ModuleComponentIdentifier) resolvedComponent.getId();
String id = identifier.getGroup() + ":" + identifier.getModule();
Exclusions exclusions = this.exclusionsCache.get(id);
if (exclusions != null) {
exclusionsById.put(id, exclusions);
}
else {
pomReferences.add(new PomReference(new Coordinates(moduleVersion.getGroup(),
moduleVersion.getName(), moduleVersion.getVersion())));
pomReferences.add(new PomReference(
new Coordinates(identifier.getGroup(), identifier.getModule(), identifier.getVersion())));
}
}
}
Expand Down

0 comments on commit 0d1b43d

Please sign in to comment.