Skip to content

Commit

Permalink
fix: changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Lekanich committed Oct 6, 2023
1 parent 31ed457 commit 49ac9e3
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.date
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
Expand Down Expand Up @@ -92,27 +93,30 @@ tasks {
patchPluginXml {
version.set(properties("pluginVersion"))
sinceBuild.set(properties("pluginSinceBuild"))
if (project.hasProperty("pluginUntilBuild")) {
if (project.hasProperty("pluginUntilBuild")) {
untilBuild.set(properties("pluginUntilBuild"))
}

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
pluginDescription.set(
File(projectDir, "README.md").readText().lines().run {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
subList(indexOf(start) + 1, indexOf(end))
}.joinToString("\n").run { markdownToHTML(this) }
File(projectDir, "README.md").readText().lines().run {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
subList(indexOf(start) + 1, indexOf(end))
}.joinToString("\n").run { markdownToHTML(this) }
)

// Get the latest available change notes from the changelog file
changeNotes.set(provider {
changelog.getAll().filterKeys { it != "[Unreleased]" }
.values.joinToString("") { it.withHeader(true).toHTML() }
changelog.getAll()
.filterKeys { it != "[Unreleased]" }
.values.joinToString("") {
changelog.renderItem(it.withHeader(true), Changelog.OutputType.HTML)
}
})
}

Expand Down

0 comments on commit 49ac9e3

Please sign in to comment.