Skip to content

Commit

Permalink
Merge branch '3.3.x'
Browse files Browse the repository at this point in the history
Closes gh-43221
  • Loading branch information
mhalbritter committed Nov 19, 2024
2 parents c934d8f + 63edd3d commit 9f6b25e
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.gradle.api.DefaultTask;
import org.gradle.api.GradleException;
import org.gradle.api.artifacts.ConfigurationContainer;
import org.gradle.api.artifacts.ResolvedArtifact;
import org.gradle.api.artifacts.dsl.DependencyHandler;
import org.gradle.api.tasks.TaskAction;

Expand All @@ -46,6 +47,7 @@
* Checks the validity of a bom.
*
* @author Andy Wilkinson
* @author Wick Dynex
*/
public abstract class CheckBom extends DefaultTask {

Expand Down Expand Up @@ -209,14 +211,15 @@ private void checkDependencyManagementAlignment(Library library, List<String> er

private File resolveBom(Library library, String alignsWithBom) {
String coordinates = alignsWithBom + ":" + library.getVersion().getVersion() + "@pom";
Set<File> files = this.configurations.detachedConfiguration(this.dependencies.create(coordinates))
Set<ResolvedArtifact> artifacts = this.configurations
.detachedConfiguration(this.dependencies.create(coordinates))
.getResolvedConfiguration()
.getFiles();
if (files.size() != 1) {
throw new IllegalStateException(
"Expected a single file but '" + coordinates + "' resolved to " + files.size());
.getResolvedArtifacts();
if (artifacts.size() != 1) {
throw new IllegalStateException("Expected a single file but '%s' resolved to %d artifacts"
.formatted(coordinates, artifacts.size()));
}
return files.iterator().next();
return artifacts.iterator().next().getFile();
}

}

0 comments on commit 9f6b25e

Please sign in to comment.