Skip to content

Commit 0b3a5f2

Browse files
committed
Ensure that check for unnecessary exclusions runs on classpath change
Closes spring-projectsgh-37307
1 parent 5bbd4bb commit 0b3a5f2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

buildSrc/src/main/java/org/springframework/boot/build/classpath/CheckClasspathForUnnecessaryExclusions.java

+10
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
import org.gradle.api.artifacts.component.ModuleComponentIdentifier;
3939
import org.gradle.api.artifacts.dsl.DependencyHandler;
4040
import org.gradle.api.artifacts.result.ResolvedArtifactResult;
41+
import org.gradle.api.file.FileCollection;
42+
import org.gradle.api.tasks.Classpath;
4143
import org.gradle.api.tasks.Input;
4244
import org.gradle.api.tasks.TaskAction;
4345

@@ -61,6 +63,8 @@ public class CheckClasspathForUnnecessaryExclusions extends DefaultTask {
6163

6264
private final ConfigurationContainer configurations;
6365

66+
private Configuration classpath;
67+
6468
@Inject
6569
public CheckClasspathForUnnecessaryExclusions(DependencyHandler dependencyHandler,
6670
ConfigurationContainer configurations) {
@@ -72,11 +76,17 @@ public CheckClasspathForUnnecessaryExclusions(DependencyHandler dependencyHandle
7276
}
7377

7478
public void setClasspath(Configuration classpath) {
79+
this.classpath = classpath;
7580
this.exclusionsByDependencyId.clear();
7681
this.dependencyById.clear();
7782
classpath.getAllDependencies().all(this::processDependency);
7883
}
7984

85+
@Classpath
86+
public FileCollection getClasspath() {
87+
return this.classpath;
88+
}
89+
8090
private void processDependency(Dependency dependency) {
8191
if (dependency instanceof ModuleDependency) {
8292
processDependency((ModuleDependency) dependency);

0 commit comments

Comments
 (0)