diff --git a/build.gradle.kts b/build.gradle.kts index 8eaf6bbce6..199807b291 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,6 +23,7 @@ import groovy.xml.XmlParser import org.gradle.api.JavaVersion.VERSION_17 +import org.jetbrains.changelog.Changelog import org.jetbrains.intellij.tasks.PatchPluginXmlTask import org.jetbrains.intellij.tasks.PublishPluginTask import org.jetbrains.intellij.tasks.RunIdeTask @@ -266,6 +267,27 @@ project(":plugin") { withType { pluginDescription.set(provider { file("description.html").readText() }) + + changelog { + version.set(properties("pluginVersion")) + groups.empty() + path.set(rootProject.file("CHANGELOG.md").toString()) + repositoryUrl.set(properties("pluginRepositoryUrl")) + } + + val changelog = project.changelog + // Get the latest available change notes from the changelog file + changeNotes.set(properties("pluginVersion").map { pluginVersion -> + with(changelog) { + renderItem( + (getOrNull(pluginVersion) ?: getUnreleased()) + .withHeader(false) + .withEmptySections(false), + + Changelog.OutputType.HTML, + ) + } + }); } withType { @@ -323,13 +345,6 @@ project(":") { .forEach { it.resolve() } } } - - changelog { - version.set(properties("pluginVersion")) - groups.empty() - path.set(layout.projectDirectory.file("CHANGELOG.md").toString()) - repositoryUrl.set(properties("pluginRepositoryUrl")) - } } project(":pycharm") {