Skip to content

Commit

Permalink
fix: remove the deplicated SpotBugsRunnerForWorker API
Browse files Browse the repository at this point in the history
Signed-off-by: Kengo TODA <skypencil@gmail.com>
  • Loading branch information
KengoTODA committed Oct 15, 2023
1 parent 5abbf2d commit aa75fbc
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 178 deletions.
1 change: 1 addition & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- beta
pull_request: {}
workflow_dispatch: {}

Expand Down
3 changes: 0 additions & 3 deletions detekt-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@
<ID>MaxLineLength:SpotBugsExtension.kt$SpotBugsExtension$* Property to specify the name of project. Some reporting formats use this property. Default value is the name of your Gradle project.</ID>
<ID>MaxLineLength:SpotBugsHtmlReport.kt$SpotBugsHtmlReport$configuration.files { dependency: Dependency -> dependency.group == "com.github.spotbugs" &amp;&amp; dependency.name == "spotbugs" }</ID>
<ID>MaxLineLength:SpotBugsRunnerForHybrid.kt$SpotBugsRunnerForHybrid.Companion$*</ID>
<ID>MaxLineLength:SpotBugsRunnerForWorker.kt$SpotBugsRunnerForWorker$"Spotbugs will be executed using Java Toolchain configuration: Vendor: {} | Version: {}"</ID>
<ID>MaxLineLength:SpotBugsTask.kt$SpotBugsTask$*</ID>
<ID>MaxLineLength:SpotBugsTask.kt$SpotBugsTask$* Property to set the directory to generate report files. Default is {@code "$buildDir/reports/spotbugs/$taskName"}.</ID>
<ID>MaxLineLength:SpotBugsTask.kt$SpotBugsTask$* Property to specify the extra arguments for JVM process. Default value is empty so JVM process will get no extra argument.</ID>
<ID>MaxLineLength:SpotBugsTask.kt$SpotBugsTask$* Property to specify the extra arguments for SpotBugs. Default value is empty so SpotBugs will get no extra argument.</ID>
<ID>MaxLineLength:SpotBugsTask.kt$SpotBugsTask$* Property to specify the release identifier of project. Some reporting formats use this property. Default value is the version of your Gradle project.</ID>
<ID>MaxLineLength:SpotBugsTask.kt$SpotBugsTask$fun</ID>
<ID>NestedBlockDepth:SpotBugsRunnerForWorker.kt$SpotBugsRunnerForWorker.SpotBugsExecutor$override fun execute()</ID>
<ID>TooGenericExceptionCaught:SpotBugsRunner.kt$SpotBugsRunner$e: Exception</ID>
<ID>TooGenericExceptionCaught:SpotBugsRunnerForWorker.kt$SpotBugsRunnerForWorker.SpotBugsExecutor$e: Exception</ID>
<ID>TooManyFunctions:SpotBugsReport.kt$SpotBugsReport : SingleFileReportCustomizableHtmlReport</ID>
</CurrentIssues>
</SmellBaseline>
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ task spotbugsMain(type: com.github.spotbugs.snom.SpotBugsTask) {
}
def runner = gradleRunner
.withArguments(arguments)
.withDebug(true)
def result = runner.buildAndFail()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ plugins {
processConfiguration | processConfigurationArgument
'javaexec' | '-Pcom.github.spotbugs.snom.worker=false'
'worker-api' | '-Pcom.github.spotbugs.snom.worker=true'
'javaexec-in-worker' | '-Pcom.github.spotbugs.snom.javaexec-in-worker=true'
}
@Unroll
Expand Down Expand Up @@ -105,6 +104,5 @@ plugins {
processConfiguration | processConfigurationArgument
'javaexec' | '-Pcom.github.spotbugs.snom.worker=false'
'worker-api' | '-Pcom.github.spotbugs.snom.worker=true'
'javaexec-in-worker' | '-Pcom.github.spotbugs.snom.javaexec-in-worker=true'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ dependencies {

when:
def result = gradleRunner
.withArguments('check', "-Pcom.github.spotbugs.snom.javaexec-in-worker=false")
.withArguments('check', "-Pcom.github.spotbugs.snom.worker=false")
.build()

then:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ spotbugsMain {
TaskOutcome.UP_TO_DATE == result.task(":spotbugsMain").outcome
}
def 'ignore missing classes (Hybrid API? #isHybridApi)'() {
def 'ignore missing classes'() {
given:
def code = new File(rootDir, 'src/main/java/Bar.java')
code << '''
Expand All @@ -191,17 +191,13 @@ spotbugsMain {
':spotbugsMain',
'-is'
]
arguments.add('-Pcom.github.spotbugs.snom.javaexec-in-worker=' + isHybridApi)
def runner = gradleRunner
.withArguments(arguments)
def result = runner.build()
then:
result.task(':spotbugsMain').outcome == SUCCESS
where:
isHybridApi << [true, false]
}
@Unroll
Expand Down Expand Up @@ -420,7 +416,7 @@ dependencies{
}"""
when:
BuildResult result = gradleRunner
.withArguments("spotbugsMain", "-Pcom.github.spotbugs.snom.javaexec-in-worker=false")
.withArguments("spotbugsMain", "-Pcom.github.spotbugs.snom.worker=false")
.build()
then:
Expand Down Expand Up @@ -450,7 +446,7 @@ public class FooTest {
}"""
when:
BuildResult result = gradleRunner
.withArguments("spotbugsMain", "spotbugsTest", "-Pcom.github.spotbugs.snom.javaexec-in-worker=false")
.withArguments("spotbugsMain", "spotbugsTest", "-Pcom.github.spotbugs.snom.worker=false")
.build()
then:
Expand Down Expand Up @@ -585,7 +581,6 @@ spotbugsMain {
}
def runner = gradleRunner
.withArguments(arguments)
.withDebug(true)
def result = runner.buildAndFail()
Expand Down Expand Up @@ -653,7 +648,6 @@ spotbugs {
}
def runner = gradleRunner
.withArguments(arguments)
.withDebug(true)
def result = runner.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,13 @@ class SpotBugsBasePlugin : Plugin<Project> {
createConfiguration(project, extension)
createPluginConfiguration(project.configurations)
val enableWorkerApi = getPropertyOrDefault(project, FEATURE_FLAG_WORKER_API, "true")
val enableHybridWorker = getPropertyOrDefault(project, FEATURE_FLAG_HYBRID_WORKER, "true")
project
.tasks
.withType(SpotBugsTask::class.java)
.configureEach { task ->
task.init(
extension,
enableWorkerApi.toBoolean(),
enableHybridWorker.toBoolean(),
)
}
}
Expand Down Expand Up @@ -163,7 +161,6 @@ class SpotBugsBasePlugin : Plugin<Project> {

companion object {
private const val FEATURE_FLAG_WORKER_API = "com.github.spotbugs.snom.worker"
private const val FEATURE_FLAG_HYBRID_WORKER = "com.github.spotbugs.snom.javaexec-in-worker"
private const val DEFAULT_REPORTS_DIR_NAME = "spotbugs"

/**
Expand Down
13 changes: 3 additions & 10 deletions src/main/kotlin/com/github/spotbugs/snom/SpotBugsTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package com.github.spotbugs.snom
import com.github.spotbugs.snom.internal.SpotBugsHtmlReport
import com.github.spotbugs.snom.internal.SpotBugsRunnerForHybrid
import com.github.spotbugs.snom.internal.SpotBugsRunnerForJavaExec
import com.github.spotbugs.snom.internal.SpotBugsRunnerForWorker
import com.github.spotbugs.snom.internal.SpotBugsSarifReport
import com.github.spotbugs.snom.internal.SpotBugsTextReport
import com.github.spotbugs.snom.internal.SpotBugsXmlReport
Expand Down Expand Up @@ -282,7 +281,6 @@ abstract class SpotBugsTask : DefaultTask(), VerificationTask {
}

private var enableWorkerApi: Boolean = true
private var enableHybridWorker: Boolean = true

@get:Internal
abstract val pluginJarFiles: ConfigurableFileCollection
Expand Down Expand Up @@ -327,7 +325,6 @@ abstract class SpotBugsTask : DefaultTask(), VerificationTask {
fun init(
extension: SpotBugsExtension,
enableWorkerApi: Boolean,
enableHybridWorker: Boolean,
) {
this.auxclasspathFile.convention(project.layout.buildDirectory.file("spotbugs/auxclasspath/$name"))

Expand Down Expand Up @@ -356,7 +353,6 @@ abstract class SpotBugsTask : DefaultTask(), VerificationTask {
}

this.enableWorkerApi = enableWorkerApi
this.enableHybridWorker = enableHybridWorker

analyseClassFile.set(project.layout.buildDirectory.file("${this.name}-analyse-class-file.txt"))

Expand Down Expand Up @@ -386,15 +382,12 @@ abstract class SpotBugsTask : DefaultTask(), VerificationTask {

@TaskAction
fun run() {
if (!enableWorkerApi) {
log.info("Running SpotBugs by JavaExec...")
SpotBugsRunnerForJavaExec(launcher).run(this)
} else if (enableHybridWorker) {
if (enableWorkerApi) {
log.info("Running SpotBugs by Gradle no-isolated Worker...")
SpotBugsRunnerForHybrid(workerExecutor, launcher).run(this)
} else {
log.info("Running SpotBugs by Gradle process-isolated Worker...")
SpotBugsRunnerForWorker(workerExecutor, launcher).run(this)
log.info("Running SpotBugs by JavaExec...")
SpotBugsRunnerForJavaExec(launcher).run(this)
}
}

Expand Down

This file was deleted.

0 comments on commit aa75fbc

Please sign in to comment.