Skip to content

Commit

Permalink
Gracefully create a copy configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
OdysseusLives committed Apr 11, 2024
1 parent e082c1a commit d09fc96
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ public void execute(Configuration configuration) {
* will be not only a different instance, but also may return different deprecation values.
*/
private DefaultConfiguration createCopy(Set<Dependency> dependencies, Set<DependencyConstraint> dependencyConstraints) {
DefaultConfiguration copiedConfiguration = (DefaultConfiguration) project.getConfigurations().create(getNameWithCopySuffix());
copiedConfiguration.setVisible(false);
copiedConfiguration.setCanBeResolved(false);
copiedConfiguration.setCanBeConsumed(bom.isCanBeConsumed());
copiedConfiguration.setTransitive(bom.isTransitive());
copiedConfiguration.setDescription(bom.getDescription());
DefaultConfiguration copiedConfiguration = (DefaultConfiguration) project.getConfigurations().findByName(getNameWithCopySuffix());
if (copiedConfiguration == null) {
copiedConfiguration = (DefaultConfiguration) project.getConfigurations().create(getNameWithCopySuffix());
copiedConfiguration.setVisible(false);
copiedConfiguration.setCanBeResolved(false);
copiedConfiguration.setCanBeConsumed(bom.isCanBeConsumed());
copiedConfiguration.setTransitive(bom.isTransitive());
copiedConfiguration.setDescription(bom.getDescription());
}
copiedConfiguration.getArtifacts().addAll(bom.getAllArtifacts());
for (ExcludeRule excludeRule : bom.getExcludeRules()) {
copiedConfiguration.getExcludeRules().add(new DefaultExcludeRule(excludeRule.getGroup(), excludeRule.getModule()));
Expand Down

0 comments on commit d09fc96

Please sign in to comment.