From f9006f164c644673321fc1b22c32dc6bcaf9453a Mon Sep 17 00:00:00 2001 From: Kengo TODA Date: Wed, 4 Mar 2020 09:21:16 +0800 Subject: [PATCH] chore: enhance logging for better tracability --- src/main/groovy/com/github/spotbugs/snom/SpotBugsPlugin.java | 5 +++++ .../github/spotbugs/snom/internal/SpotBugsTaskFactory.java | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/groovy/com/github/spotbugs/snom/SpotBugsPlugin.java b/src/main/groovy/com/github/spotbugs/snom/SpotBugsPlugin.java index 29c282aa..d196d358 100644 --- a/src/main/groovy/com/github/spotbugs/snom/SpotBugsPlugin.java +++ b/src/main/groovy/com/github/spotbugs/snom/SpotBugsPlugin.java @@ -18,6 +18,8 @@ import org.gradle.api.Plugin; import org.gradle.api.Project; import org.gradle.api.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SpotBugsPlugin implements Plugin { public static final String CONFIG_NAME = "spotbugs"; @@ -25,6 +27,8 @@ public class SpotBugsPlugin implements Plugin { public static final String SLF4J_CONFIG_NAME = "spotbugsSlf4j"; public static final String EXTENSION_NAME = "spotbugs"; + private final Logger log = LoggerFactory.getLogger(SpotBugsPlugin.class); + @Override public void apply(Project project) { project.getPluginManager().apply(SpotBugsBasePlugin.class); @@ -34,6 +38,7 @@ public void apply(Project project) { private void createTasks(Project project, SpotBugsExtension extension) { @Nullable Task check = project.getTasks().findByName("check"); + log.debug("check task {}", check == null ? "not found" : "found"); new SpotBugsTaskFactory() .generate( project, diff --git a/src/main/groovy/com/github/spotbugs/snom/internal/SpotBugsTaskFactory.java b/src/main/groovy/com/github/spotbugs/snom/internal/SpotBugsTaskFactory.java index 4ff3a9b1..f3c138ed 100644 --- a/src/main/groovy/com/github/spotbugs/snom/internal/SpotBugsTaskFactory.java +++ b/src/main/groovy/com/github/spotbugs/snom/internal/SpotBugsTaskFactory.java @@ -44,7 +44,7 @@ private void generateForJava(Project project, Action confi .all( sourceSet -> { String name = sourceSet.getTaskName("spotbugs", null); - log.debug("Creating SpotBugsTaskForJava for {}", sourceSet); + log.debug("Creating SpotBugsTask for {}", sourceSet); project .getTasks() .create( @@ -74,7 +74,7 @@ private void generateForAndroid( .all( task -> { String name = GUtil.toLowerCamelCase("spotbugs " + task.getVariantName()); - log.debug("Creating SpotBugsTaskForAndroid for {}", task); + log.debug("Creating SpotBugsTask for {}", task); project .getTasks() .register(