Merge pull request #12784 from Danny Hyun

* gh-12784:
  Polish “Only analyze configurations that we've registered to check”
  Only analyze configurations that we've registered to check
pull/12960/head
Andy Wilkinson 7 years ago
commit 5ce0e07c2b

@ -30,6 +30,7 @@ import org.gradle.api.GradleException;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.ResolvableDependencies;
import org.gradle.util.GradleVersion; import org.gradle.util.GradleVersion;
import org.springframework.boot.gradle.dsl.SpringBootExtension; import org.springframework.boot.gradle.dsl.SpringBootExtension;
@ -42,6 +43,7 @@ import org.springframework.boot.gradle.tasks.bundling.BootWar;
* @author Phillip Webb * @author Phillip Webb
* @author Dave Syer * @author Dave Syer
* @author Andy Wilkinson * @author Andy Wilkinson
* @author Danny Hyun
*/ */
public class SpringBootPlugin implements Plugin<Project> { public class SpringBootPlugin implements Plugin<Project> {
@ -120,11 +122,16 @@ public class SpringBootPlugin implements Plugin<Project> {
private void unregisterUnresolvedDependenciesAnalyzer(Project project) { private void unregisterUnresolvedDependenciesAnalyzer(Project project) {
UnresolvedDependenciesAnalyzer unresolvedDependenciesAnalyzer = new UnresolvedDependenciesAnalyzer(); UnresolvedDependenciesAnalyzer unresolvedDependenciesAnalyzer = new UnresolvedDependenciesAnalyzer();
project.getConfigurations().all((configuration) -> configuration.getIncoming() project.getConfigurations().all((configuration) -> {
.afterResolve((resolvableDependencies) -> unresolvedDependenciesAnalyzer ResolvableDependencies incoming = configuration.getIncoming();
.analyze(configuration.getResolvedConfiguration() incoming.afterResolve((resolvableDependencies) -> {
.getLenientConfiguration() if (incoming.equals(resolvableDependencies)) {
.getUnresolvedModuleDependencies()))); unresolvedDependenciesAnalyzer.analyze(configuration
.getResolvedConfiguration().getLenientConfiguration()
.getUnresolvedModuleDependencies());
}
});
});
project.getGradle().buildFinished( project.getGradle().buildFinished(
(buildResult) -> unresolvedDependenciesAnalyzer.buildFinished(project)); (buildResult) -> unresolvedDependenciesAnalyzer.buildFinished(project));
} }

Loading…
Cancel
Save