1+ import org.jetbrains.changelog.Changelog
2+ import org.jetbrains.changelog.markdownToHTML
3+
14plugins {
25 id(" java" )
3- id(" org.jetbrains.kotlin.jvm" ) version " 1.9.20"
4- id(" org.jetbrains.intellij" ) version " 1.16.0"
6+ alias(libs.plugins.kotlin) // Kotlin support
7+ alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
8+ alias(libs.plugins.changelog) // Gradle Changelog Plugin
59}
610
7- group = " io.maliboot.devkit.idea"
8- version = " 1.0.0-rc.5"
11+ group = providers.gradleProperty(" pluginGroup" ).get()
12+ version = providers.gradleProperty(" pluginVersion" ).get()
13+
14+ kotlin {
15+ jvmToolchain(providers.gradleProperty(" javaVersion" ).get().toInt())
16+ }
917
1018repositories {
1119 mavenCentral()
12- }
1320
14- intellij {
15- pluginName.set( " Hyperf Support " )
16- version.set( " 2023.1 " )
17- type.set( " PS " )
21+ intellijPlatform {
22+ defaultRepositories( )
23+ }
24+ }
1825
19- plugins.set(listOf (" com.jetbrains.php" ))
26+ dependencies {
27+ intellijPlatform {
28+ create(providers.gradleProperty(" platformType" ), providers.gradleProperty(" platformVersion" ))
29+ bundledPlugins(providers.gradleProperty(" platformBundledPlugins" ).map { it.split(' ,' ) })
30+ plugins(providers.gradleProperty(" platformPlugins" ).map { it.split(' ,' ) })
31+ }
2032}
2133
22- tasks {
34+ intellijPlatform {
35+ pluginConfiguration {
36+ name = providers.gradleProperty(" pluginName" )
37+ version = providers.gradleProperty(" pluginVersion" )
38+ description = providers.fileContents(layout.projectDirectory.file(" README.md" )).asText.map {
39+ val start = " <!-- Plugin description -->"
40+ val end = " <!-- Plugin description end -->"
41+
42+ with (it.lines()) {
43+ if (! containsAll(listOf (start, end))) {
44+ throw GradleException (" Plugin description section not found in README.md:\n $start ... $end " )
45+ }
46+ subList(indexOf(start) + 1 , indexOf(end)).joinToString(" \n " ).let (::markdownToHTML)
47+ }
48+ }
2349
24- compileKotlin {
25- kotlinOptions.jvmTarget = " 17"
50+ val changelog = project.changelog // local variable for configuration cache compatibility
51+ // Get the latest available change notes from the changelog file
52+ changeNotes = providers.gradleProperty(" pluginVersion" ).map { pluginVersion ->
53+ with (changelog) {
54+ renderItem(
55+ (getOrNull(pluginVersion) ? : getUnreleased())
56+ .withHeader(false )
57+ .withEmptySections(false ),
58+ Changelog .OutputType .HTML ,
59+ )
60+ }
61+ }
62+
63+ ideaVersion {
64+ sinceBuild = providers.gradleProperty(" pluginSinceBuild" )
65+ untilBuild = providers.gradleProperty(" pluginUntilBuild" )
66+ }
67+ }
68+
69+ signing {
70+ certificateChain = providers.environmentVariable(" CERTIFICATE_CHAIN" )
71+ privateKey = providers.environmentVariable(" PRIVATE_KEY" )
72+ password = providers.environmentVariable(" PRIVATE_KEY_PASSWORD" )
2673 }
2774
28- compileJava {
29- sourceCompatibility = " 17 "
30- targetCompatibility = " 17 "
75+ publishing {
76+ token = providers.environmentVariable( " PUBLISH_TOKEN " )
77+ channels = providers.gradleProperty( " pluginVersion " ).map { listOf (it.substringAfter( ' - ' , " " ).substringBefore( ' . ' ).ifEmpty { " default " }) }
3178 }
3279
33- patchPluginXml {
34- sinceBuild.set( " 231 " )
35- untilBuild.set( " 233.* " )
36- changeNotes.set(file( " src/main/resources/META-INF/change-notes.html " ).readText().replace( " <html> " , " " ).replace( " </html> " , " " ))
80+ pluginVerification {
81+ ides {
82+ recommended( )
83+ }
3784 }
85+ }
3886
39- signPlugin {
40- certificateChain.set(System .getenv(" CERTIFICATE_CHAIN" ))
41- privateKey.set(System .getenv(" PRIVATE_KEY" ))
42- password.set(System .getenv(" PRIVATE_KEY_PASSWORD" ))
87+ // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
88+ changelog {
89+ groups.empty()
90+ repositoryUrl = providers.gradleProperty(" pluginRepositoryUrl" )
91+ }
92+
93+ tasks {
94+ wrapper {
95+ gradleVersion = providers.gradleProperty(" gradleVersion" ).get()
4396 }
4497
4598 publishPlugin {
46- token.set( System .getenv( " PUBLISH_TOKEN " ) )
99+ dependsOn(patchChangelog )
47100 }
48- }
101+ }
0 commit comments