Skip to content

Commit

Permalink
Merge pull request #386 from staffanf/master
Browse files Browse the repository at this point in the history
Fix #372.  Synchronize access to rootProject.configurations to get around #372
  • Loading branch information
nedtwigg authored Mar 28, 2019
2 parents 0368773 + ee619f5 commit c23c9c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
### Version 3.21.0-SNAPSHOT - TBD ([javadoc](https://diffplug.github.io/spotless/javadoc/snapshot/), [snapshot](https://oss.sonatype.org/content/repositories/snapshots/com/diffplug/spotless/spotless-plugin-gradle/))
* Updated default eclipse-wtp from 4.7.3b to 4.8.0 ([#382](https://github.com/diffplug/spotless/pull/382)).
* Updated default eclipse-groovy from 4.8.1 to 4.10.0 ([#382](https://github.com/diffplug/spotless/pull/382)).

* Updated default eclipse-jdt from 4.10.0 to 4.11.0 ([#384](https://github.com/diffplug/spotless/pull/384))
* Fix intermittent error in multi-project builds ([#372](https://github.com/diffplug/spotless/issues/372))

### Version 3.20.0 - March 11th 2019 ([javadoc](https://diffplug.github.io/spotless/javadoc/spotless-plugin-gradle/3.20.0/), [jcenter](https://bintray.com/diffplug/opensource/spotless-plugin-gradle/3.20.0))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

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

import com.diffplug.common.base.StringPrinter;
Expand All @@ -37,7 +38,13 @@ public static Provisioner fromProject(Project project) {
Dependency[] deps = mavenCoords.stream()
.map(project.getBuildscript().getDependencies()::create)
.toArray(Dependency[]::new);
Configuration config = project.getRootProject().getBuildscript().getConfigurations().detachedConfiguration(deps);

// #372 workaround: Accessing rootProject.configurations from multiple projects is not thread-safe
ConfigurationContainer configContainer;
synchronized (project.getRootProject()) {
configContainer = project.getRootProject().getBuildscript().getConfigurations();
}
Configuration config = configContainer.detachedConfiguration(deps);
config.setDescription(mavenCoords.toString());
config.setTransitive(withTransitives);
return config.resolve();
Expand Down

0 comments on commit c23c9c7

Please sign in to comment.