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