Skip to content

Commit

Permalink
Use apply
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Dec 6, 2023
1 parent bbb1101 commit f7e5ea1
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/main/kotlin/com/github/spotbugs/snom/SpotBugsBasePlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,28 @@ class SpotBugsBasePlugin : Plugin<Project> {
}

private fun createExtension(project: Project): SpotBugsExtension {
val extension = project.extensions.create(SpotBugsPlugin.EXTENSION_NAME, SpotBugsExtension::class.java)
extension.ignoreFailures.convention(false)
extension.showStackTraces.convention(false)
extension.projectName.convention(project.provider { project.name })
extension.release.convention(
project.provider {
project.version.toString()
},
)
return project.extensions.create(SpotBugsPlugin.EXTENSION_NAME, SpotBugsExtension::class.java).apply {
ignoreFailures.convention(false)
showStackTraces.convention(false)
projectName.convention(project.provider { project.name })
release.convention(
project.provider {
project.version.toString()
},
)

// ReportingBasePlugin should be applied before we create this SpotBugsExtension instance
val baseReportsDir = project.extensions.getByType(ReportingExtension::class.java).baseDirectory
extension.reportsDir.convention(
baseReportsDir.map { directory: Directory ->
directory.dir(
DEFAULT_REPORTS_DIR_NAME,
)
},
)
extension.useAuxclasspathFile.convention(true)
extension.useJavaToolchains.convention(true)
return extension
// ReportingBasePlugin should be applied before we create this SpotBugsExtension instance
val baseReportsDir = project.extensions.getByType(ReportingExtension::class.java).baseDirectory
reportsDir.convention(
baseReportsDir.map { directory: Directory ->
directory.dir(
DEFAULT_REPORTS_DIR_NAME,
)
},
)
useAuxclasspathFile.convention(true)
useJavaToolchains.convention(true)
}
}

private fun createConfiguration(
Expand Down

0 comments on commit f7e5ea1

Please sign in to comment.