File tree 1 file changed +11
-12
lines changed
src/main/groovy/com/github/spotbugs/snom
1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change 14
14
package com .github .spotbugs .snom ;
15
15
16
16
import com .github .spotbugs .snom .internal .SpotBugsTaskFactory ;
17
- import edu .umd .cs .findbugs .annotations .Nullable ;
18
17
import org .gradle .api .Plugin ;
19
18
import org .gradle .api .Project ;
20
19
import org .gradle .api .Task ;
@@ -33,20 +32,20 @@ public class SpotBugsPlugin implements Plugin<Project> {
33
32
public void apply (Project project ) {
34
33
project .getPluginManager ().apply (SpotBugsBasePlugin .class );
35
34
SpotBugsExtension extension = project .getExtensions ().findByType (SpotBugsExtension .class );
35
+ project
36
+ .getPluginManager ()
37
+ .withPlugin (
38
+ "java-base" ,
39
+ javaBase -> {
40
+ log .debug (
41
+ "The javaBase plugin has been applied, so making the check task depending on all of SpotBugsTask" );
42
+ Task check = project .getTasks ().getByName ("check" );
43
+ project .getTasks ().withType (SpotBugsTask .class , check ::dependsOn );
44
+ });
36
45
createTasks (project , extension );
37
46
}
38
47
39
48
private void createTasks (Project project , SpotBugsExtension extension ) {
40
- @ Nullable Task check = project .getTasks ().findByName ("check" );
41
- log .debug ("check task {}" , check == null ? "not found" : "found" );
42
- new SpotBugsTaskFactory ()
43
- .generate (
44
- project ,
45
- task -> {
46
- if (check != null ) {
47
- check .dependsOn (task );
48
- }
49
- task .init (extension );
50
- });
49
+ new SpotBugsTaskFactory ().generate (project , task -> task .init (extension ));
51
50
}
52
51
}
You can’t perform that action at this time.
0 commit comments