Skip to content

Commit

Permalink
Switch from detached to named configurations in plugin-gradle (#848, …
Browse files Browse the repository at this point in the history
…shallow fix for #815)
  • Loading branch information
nedtwigg authored Apr 21, 2021
2 parents 395a3fa + b4e5f8a commit 66c6dd9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.27.0`).

## [Unreleased]
### Fixed
* Dependency configurations are now named rather than detached, attempt to fix #815.

## [5.12.3] - 2021-04-21
### Fixed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 DiffPlug
* Copyright 2016-2021 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -26,7 +26,6 @@

import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.Dependency;

import com.diffplug.common.base.Preconditions;
import com.diffplug.common.collect.ImmutableList;
Expand Down Expand Up @@ -64,11 +63,11 @@ static Provisioner fromRootBuildscript(Project project) {
Objects.requireNonNull(project);
return (withTransitives, mavenCoords) -> {
try {
Dependency[] deps = mavenCoords.stream()
Configuration config = project.getRootProject().getBuildscript().getConfigurations().create("spotless"
+ new Request(withTransitives, mavenCoords).hashCode());
mavenCoords.stream()
.map(project.getBuildscript().getDependencies()::create)
.toArray(Dependency[]::new);

Configuration config = project.getRootProject().getBuildscript().getConfigurations().detachedConfiguration(deps);
.forEach(config.getDependencies()::add);
config.setDescription(mavenCoords.toString());
config.setTransitive(withTransitives);
return config.resolve();
Expand Down

0 comments on commit 66c6dd9

Please sign in to comment.