11import common.properties
2- import org.jetbrains.changelog.date
32import org.jetbrains.changelog.markdownToHTML
43import org.jetbrains.intellij.tasks.ListProductsReleasesTask
4+ import org.jetbrains.changelog.exceptions.MissingVersionException
55import java.util.EnumSet
66
77fun properties (key : String ) = properties(key,project)
@@ -12,7 +12,7 @@ fun properties(key: String) = properties(key,project)
1212)
1313plugins {
1414 id(" plugin-project" )
15- id(" org.jetbrains.changelog" ) version " 1.3.1 "
15+ id(" org.jetbrains.changelog" ) version " 2.0.0 "
1616 id(" org.jetbrains.qodana" ) version " 0.1.13"
1717 id(" common-kotlin" )
1818}
@@ -44,16 +44,6 @@ intellij {
4444 }
4545}
4646
47- // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
48- changelog {
49- version.set(project.semanticVersion.version.get().toString())
50- path.set(" ${project.projectDir} /CHANGELOG.md" )
51- // groups.set(listOf("Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"))
52- groups.set(emptyList())
53- header.set(provider { " [${version.get()} ] - ${date()} " })
54- keepUnreleasedSection.set(false )
55- }
56-
5747
5848// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
5949qodana {
@@ -119,11 +109,18 @@ tasks {
119109 }.joinToString(" \n " ).run { markdownToHTML(this ) }
120110 )
121111
122- // Get the latest available change notes from the changelog file
112+ val latestChangelog = try {
113+ changelog.getUnreleased()
114+ } catch (_: MissingVersionException ) {
115+ changelog.getLatest()
116+ }
123117 changeNotes.set(provider {
124- changelog.run {
125- getOrNull(project.semanticVersion.version.get().toString()) ? : getLatest()
126- }.toHTML()
118+ changelog.renderItem(
119+ latestChangelog
120+ .withHeader(false )
121+ .withEmptySections(false ),
122+ org.jetbrains.changelog.Changelog .OutputType .HTML
123+ )
127124 })
128125 }
129126
0 commit comments