From 122692bd8bd706f1e3973ae6fa95f2270e9e5172 Mon Sep 17 00:00:00 2001 From: Goooler Date: Sun, 1 Oct 2023 13:16:11 +0800 Subject: [PATCH 1/2] Replace deprecated ClosureBackedAction --- .../com/github/spotbugs/snom/SpotBugsTask.groovy | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/main/groovy/com/github/spotbugs/snom/SpotBugsTask.groovy b/src/main/groovy/com/github/spotbugs/snom/SpotBugsTask.groovy index bf85dde6..ed0c1a4e 100644 --- a/src/main/groovy/com/github/spotbugs/snom/SpotBugsTask.groovy +++ b/src/main/groovy/com/github/spotbugs/snom/SpotBugsTask.groovy @@ -13,7 +13,6 @@ */ package com.github.spotbugs.snom -import com.github.spotbugs.snom.internal.SemanticVersion; import com.github.spotbugs.snom.internal.SpotBugsHtmlReport import com.github.spotbugs.snom.internal.SpotBugsRunnerForHybrid; import com.github.spotbugs.snom.internal.SpotBugsRunnerForJavaExec; @@ -23,7 +22,7 @@ import com.github.spotbugs.snom.internal.SpotBugsTextReport; import com.github.spotbugs.snom.internal.SpotBugsXmlReport; import edu.umd.cs.findbugs.annotations.NonNull import edu.umd.cs.findbugs.annotations.Nullable -import org.gradle.api.artifacts.Dependency; +import org.gradle.api.Action import org.gradle.api.file.DirectoryProperty import org.gradle.api.file.RegularFileProperty import org.gradle.api.plugins.JavaPluginExtension @@ -32,7 +31,6 @@ import org.gradle.api.provider.Provider import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.SkipWhenEmpty -import org.gradle.api.Action; import org.gradle.api.DefaultTask; import org.gradle.api.InvalidUserDataException; import org.gradle.api.NamedDomainObjectContainer; @@ -54,7 +52,6 @@ import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.VerificationTask import org.gradle.jvm.toolchain.JavaLauncher import org.gradle.jvm.toolchain.JavaToolchainService; -import org.gradle.util.ClosureBackedAction import org.gradle.workers.WorkerExecutor; import org.slf4j.Logger; import org.slf4j.LoggerFactory @@ -428,12 +425,6 @@ abstract class SpotBugsTask extends DefaultTask implements VerificationTask { } } - final NamedDomainObjectContainer reports( - Closure> closure) { - return reports( - new ClosureBackedAction>(closure)) - } - final NamedDomainObjectContainer reports( Action> configureAction) { configureAction.execute(reports) From 7c31c857aa6ec91e9597c1ca8117a73fab222403 Mon Sep 17 00:00:00 2001 From: Goooler Date: Tue, 3 Oct 2023 01:36:49 +0800 Subject: [PATCH 2/2] Replace deprecated ConfigureUtil --- .../com/github/spotbugs/snom/SpotBugsReport.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/groovy/com/github/spotbugs/snom/SpotBugsReport.java b/src/main/groovy/com/github/spotbugs/snom/SpotBugsReport.java index 7ffbc99c..0de45688 100644 --- a/src/main/groovy/com/github/spotbugs/snom/SpotBugsReport.java +++ b/src/main/groovy/com/github/spotbugs/snom/SpotBugsReport.java @@ -19,6 +19,7 @@ import java.io.File; import javax.annotation.Nullable; import javax.inject.Inject; +import org.gradle.api.Action; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.model.ObjectFactory; import org.gradle.api.provider.Property; @@ -29,7 +30,6 @@ import org.gradle.api.resources.TextResource; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.Internal; -import org.gradle.util.ConfigureUtil; public abstract class SpotBugsReport implements SingleFileReport, @@ -118,7 +118,15 @@ public void setDestination(Provider provider) { @Override public Report configure(Closure closure) { - ConfigureUtil.configureSelf(closure, this); + return configure( + report -> { + closure.setDelegate(report); + closure.call(report); + }); + } + + public Report configure(Action action) { + action.execute(this); return this; }