Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: migrate deprecated Gradle API usages #974

Merged
merged 2 commits into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/main/groovy/com/github/spotbugs/snom/SpotBugsReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -118,7 +118,15 @@ public void setDestination(Provider<File> provider) {

@Override
public Report configure(Closure closure) {
ConfigureUtil.configureSelf(closure, this);
return configure(
report -> {
closure.setDelegate(report);
closure.call(report);
});
}

public Report configure(Action<? super Report> action) {
action.execute(this);
return this;
}

Expand Down
11 changes: 1 addition & 10 deletions src/main/groovy/com/github/spotbugs/snom/SpotBugsTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -428,12 +425,6 @@ abstract class SpotBugsTask extends DefaultTask implements VerificationTask {
}
}

final NamedDomainObjectContainer<? extends SpotBugsReport> reports(
Closure<NamedDomainObjectContainer<? extends SpotBugsReport>> closure) {
return reports(
new ClosureBackedAction<NamedDomainObjectContainer<? extends SpotBugsReport>>(closure))
}

final NamedDomainObjectContainer<? extends SpotBugsReport> reports(
Action<NamedDomainObjectContainer<? extends SpotBugsReport>> configureAction) {
configureAction.execute(reports)
Expand Down