Skip to content

Commit 031efad

Browse files
authored
Update build.gradle.kts
1 parent 94a4496 commit 031efad

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

build.gradle.kts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import org.jetbrains.intellij.platform.gradle.TestFrameworkType
22
import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform
33
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
44

5+
import org.jetbrains.changelog.Changelog
6+
import org.jetbrains.changelog.markdownToHTML
7+
58
plugins {
69
java
710
alias(libs.plugins.kotlin)
@@ -47,6 +50,29 @@ dependencies {
4750
intellijPlatform {
4851
pluginConfiguration {
4952
version = providers.gradleProperty("plugin.version")
53+
54+
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
55+
val start = "<!-- plugin description -->"
56+
val end = "<!-- plugin description end -->"
57+
58+
with (it.lines()) {
59+
if (!containsAll(listOf(start, end))) {
60+
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
61+
}
62+
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
63+
}
64+
}
65+
66+
val changelog = project.changelog
67+
changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
68+
with(changelog) {
69+
renderItem(
70+
(getOrNull(pluginVersion) ?: getUnreleased())
71+
.withHeader(false)
72+
.withEmptySections(false),
73+
Changelog.OutputType.HTML,
74+
)
75+
}
5076
}
5177

5278
signing {
@@ -71,6 +97,11 @@ intellijPlatform {
7197
}
7298
}
7399

100+
changelog {
101+
groups.empty()
102+
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
103+
}
104+
74105
intellijPlatformTesting {
75106
runIde {
76107
register("runIdeForUiTests") {
@@ -100,4 +131,8 @@ tasks {
100131
wrapper {
101132
gradleVersion = providers.gradleProperty("gradle.version").get()
102133
}
134+
135+
publishPlugin {
136+
dependsOn("patchChangelog")
137+
}
103138
}

0 commit comments

Comments
 (0)