Skip to content

Commit

Permalink
fix: pluginJarFiles.from() can accept a Configuration directly. (#1311)
Browse files Browse the repository at this point in the history
* fix: pluginJarFiles.from() can accept a Configuration directly.

* fix: spotbugsClasspath probably should follow the same pattern as pluginJarFiles.

Done for consistency. Have not tested.
  • Loading branch information
autonomousapps authored Jan 17, 2025
1 parent a56c065 commit e1d960a
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/main/kotlin/com/github/spotbugs/snom/SpotBugsTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,10 @@ abstract class SpotBugsTask : DefaultTask(), VerificationTask {

private var enableWorkerApi: Boolean = true

@get:Internal
@get:Classpath
abstract val pluginJarFiles: ConfigurableFileCollection

@get:Internal
@get:Classpath
abstract val spotbugsClasspath: ConfigurableFileCollection

@get:Nested
Expand Down Expand Up @@ -372,18 +372,11 @@ abstract class SpotBugsTask : DefaultTask(), VerificationTask {

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

val pluginConfiguration = project.configurations.getByName(SpotBugsPlugin.PLUGINS_CONFIG_NAME)
pluginJarFiles.from(
project.provider { pluginConfiguration.files },
)
val configuration = project.configurations.getByName(SpotBugsPlugin.CONFIG_NAME)
val spotbugsSlf4j = project.configurations.getByName(SpotBugsPlugin.SLF4J_CONFIG_NAME)
spotbugsClasspath.from(
project.layout.files(
project.provider { spotbugsSlf4j.files },
project.provider { configuration.files },
),
)
val pluginConfiguration = project.configurations.named(SpotBugsPlugin.PLUGINS_CONFIG_NAME)
pluginJarFiles.from(pluginConfiguration)
val configuration = project.configurations.named(SpotBugsPlugin.CONFIG_NAME)
val spotbugsSlf4j = project.configurations.named(SpotBugsPlugin.SLF4J_CONFIG_NAME)
spotbugsClasspath.from(configuration, spotbugsSlf4j)
}

/**
Expand Down

0 comments on commit e1d960a

Please sign in to comment.