Skip to content

Commit

Permalink
fix: replace deprecated API to support Gradle 9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KengoTODA committed Jun 3, 2024
1 parent f7614f6 commit bd76a5e
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import com.github.spotbugs.snom.SpotBugsTask
import javax.inject.Inject
import org.gradle.api.InvalidUserDataException
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.component.ModuleComponentIdentifier
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Property
import org.gradle.api.resources.TextResource
Expand Down Expand Up @@ -49,9 +50,15 @@ internal abstract class SpotBugsHtmlReport @Inject constructor(
configuration: Configuration,
textResourceFactory: TextResourceFactory,
): TextResource {
val spotbugsJar = configuration.files {
it.group == "com.github.spotbugs" && it.name == "spotbugs"
}.find { it.isFile }
val spotbugsJar = configuration.incoming.artifactView {
it.componentFilter { identifier ->
when (identifier) {
is ModuleComponentIdentifier ->
identifier.group == "com.github.spotbugs" && identifier.module == "spotbugs"
else -> false
}
}
}.files
return if (spotbugsJar != null) {
textResourceFactory.fromArchiveEntry(spotbugsJar, path)
} else {
Expand Down

0 comments on commit bd76a5e

Please sign in to comment.