@@ -4,7 +4,7 @@ fun properties(key: String) = project.findProperty(key).toString()
44
55plugins {
66 id(" org.jetbrains.kotlin.jvm" ) version " 2.2.20"
7- id(" org.jetbrains.intellij" ) version " 1.17.4 "
7+ id(" org.jetbrains.intellij.platform " ) version " 2.9.0 "
88 kotlin(" plugin.serialization" ) version " 2.2.20"
99
1010 // Gradle Changelog Plugin
@@ -14,88 +14,36 @@ plugins {
1414group = properties(" pluginGroup" )
1515version = properties(" pluginVersion" )
1616
17- // Configure project's dependencies
18- repositories {
19- mavenCentral()
20- }
21-
2217// Set the JVM language level used to build the project.
2318kotlin {
2419 jvmToolchain(properties(" javaVersion" ).toInt())
2520}
2621
27- // Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
28- intellij {
29- pluginName.set(properties(" pluginName" ))
30- version.set(properties(" platformVersion" ))
31- type.set(properties(" platformType" ))
32- updateSinceUntilBuild.set(false )
33-
34- plugins.set(
35- properties(" platformPlugins" ).split(' ,' )
36- .map(String ::trim)
37- .filter(String ::isNotEmpty)
38- )
39- }
22+ // Configure project's dependencies
23+ repositories {
24+ mavenCentral()
4025
41- changelog {
42- // version.set(properties("pluginVersion"))
43- groups.empty()
44- repositoryUrl.set(properties(" pluginRepositoryUrl" ))
26+ intellijPlatform {
27+ defaultRepositories()
28+ }
4529}
4630
47- tasks {
48- wrapper {
49- gradleVersion = properties(" gradleVersion" )
50- }
31+ dependencies {
32+ intellijPlatform {
33+ create(providers.gradleProperty(" platformType" ), providers.gradleProperty(" platformVersion" ))
5134
52- patchPluginXml {
53- version.set(properties(" pluginVersion" ))
54- sinceBuild.set(properties(" pluginSinceBuild" ))
55- // untilBuild.set(properties("pluginUntilBuild"))
35+ // Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
36+ bundledPlugins(providers.gradleProperty(" platformBundledPlugins" ).map { it.split(' ,' ) })
5637
57- // Get the latest available change notes from the changelog file
58- changeNotes.set(provider {
59- with (changelog) {
60- renderItem(
61- getOrNull(properties(" pluginVersion" )) ? : getUnreleased()
62- .withHeader(false )
63- .withEmptySections(false ),
64- Changelog .OutputType .HTML ,
65- )
66- }
67- })
68- }
38+ // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
39+ plugins(providers.gradleProperty(" platformPlugins" ).map { it.split(' ,' ) })
6940
70- signPlugin {
71- certificateChain.set(System .getenv(" CERTIFICATE_CHAIN" ))
72- privateKey.set(System .getenv(" PRIVATE_KEY" ))
73- password.set(System .getenv(" PRIVATE_KEY_PASSWORD" ))
74- }
41+ // Module Dependencies. Uses `platformBundledModules` property from the gradle.properties file for bundled IntelliJ Platform modules.
42+ bundledModules(providers.gradleProperty(" platformBundledModules" ).map { it.split(' ,' ) })
7543
76- publishPlugin {
77- dependsOn(" patchChangelog" )
78- token.set(System .getenv(" PUBLISH_TOKEN" ))
44+ // testFramework(TestFrameworkType.Platform)
7945 }
80- }
8146
82- tasks.test {
83- useJUnitPlatform()
84- }
85-
86- dependencies {
87- // implementation("com.aallam.openai:openai-client:3.7.2") {
88- // exclude(group = "org.slf4j", module = "slf4j-api")
89- // // Prevents java.lang.LinkageError: java.lang.LinkageError: loader constraint violation:when resolving method 'long kotlin.time.Duration.toLong-impl(long, kotlin.time.DurationUnit)'
90- // exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
91- // }
92- // implementation("io.ktor:ktor-client-cio:2.3.11") {
93- // exclude(group = "org.slf4j", module = "slf4j-api")
94- // // Prevents java.lang.LinkageError: java.lang.LinkageError: loader constraint violation: when resolving method 'long kotlin.time.Duration.toLong-impl(long, kotlin.time.DurationUnit)'
95- // exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
96- // }
97- //
98- // implementation("com.knuddels:jtokkit:1.0.0")
9947
10048 implementation(" org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0" )
10149
@@ -122,3 +70,67 @@ dependencies {
12270 testImplementation(" org.junit.jupiter:junit-jupiter:6.0.0" )
12371 testRuntimeOnly(" org.junit.platform:junit-platform-launcher" )
12472}
73+ // Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
74+ intellijPlatform {
75+ pluginConfiguration {
76+ name = providers.gradleProperty(" pluginName" )
77+ version = providers.gradleProperty(" platformVersion" )
78+
79+ val changelog = project.changelog // local variable for configuration cache compatibility
80+ // Get the latest available change notes from the changelog file
81+ changeNotes = providers.gradleProperty(" pluginVersion" ).map { pluginVersion ->
82+ with (changelog) {
83+ renderItem(
84+ (getOrNull(pluginVersion) ? : getUnreleased())
85+ .withHeader(false )
86+ .withEmptySections(false ),
87+ Changelog .OutputType .HTML ,
88+ )
89+ }
90+ }
91+
92+ ideaVersion {
93+ sinceBuild.set(providers.gradleProperty(" pluginSinceBuild" ))
94+ }
95+ }
96+
97+ signing {
98+ certificateChain = providers.environmentVariable(" CERTIFICATE_CHAIN" )
99+ privateKey = providers.environmentVariable(" PRIVATE_KEY" )
100+ password = providers.environmentVariable(" PRIVATE_KEY_PASSWORD" )
101+ }
102+
103+ publishing {
104+ token = providers.environmentVariable(" PUBLISH_TOKEN" )
105+ // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
106+ // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
107+ // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
108+ channels = providers.gradleProperty(" pluginVersion" ).map { listOf (it.substringAfter(' -' , " " ).substringBefore(' .' ).ifEmpty { " default" }) }
109+ }
110+
111+ pluginVerification {
112+ ides {
113+ recommended()
114+ }
115+ }
116+ }
117+
118+ changelog {
119+ // version.set(properties("pluginVersion"))
120+ groups.empty()
121+ repositoryUrl.set(properties(" pluginRepositoryUrl" ))
122+ }
123+
124+ tasks {
125+ wrapper {
126+ gradleVersion = properties(" gradleVersion" )
127+ }
128+
129+ publishPlugin {
130+ dependsOn(" patchChangelog" )
131+ }
132+
133+ test {
134+ useJUnitPlatform()
135+ }
136+ }
0 commit comments