Skip to content

Commit 4130770

Browse files
authored
impl: migrate platform plugin to latest 2.x (#50)
* chore: update gitignore * impl: migrate platform plugin to latest 2.x IntelliJ Platform Gradle Plugin 2.x is the build system that supersedes the Gradle IntelliJ Plugin 1.x, and this is the version that also comes with the ability to provide unlimited until build support. This is a major overhaul of the DSL, I've tested these changes locally with IntelliJ Community 2022 (the minimum supported version), and I've also compared the plugin.xml and the zip content with a previous version to make sure it is generated correctly. * impl: add support for IDEA 2025.2 This PR adds support for all 2025.2 IDEs * fix: plugin verifier task was renamed in the new build system * chore: next version is 0.1.0 * fix: plugin name was the same as the artifact name
1 parent f6783a2 commit 4130770

File tree

6 files changed

+136
-62
lines changed

6 files changed

+136
-62
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
echo "$CHANGELOG" >> $GITHUB_OUTPUT
7474
echo "EOF" >> $GITHUB_OUTPUT
7575
76-
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
76+
./gradlew printProductsReleases # prepare list of IDEs for Plugin Verifier
7777
7878
# Build plugin
7979
- name: Build plugin
@@ -214,7 +214,7 @@ jobs:
214214

215215
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
216216
- name: Run Plugin Verification tasks
217-
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{needs.build.outputs.pluginVerifierHomeDir }} --info
217+
run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{needs.build.outputs.pluginVerifierHomeDir }} --info
218218
# Getting "no ComponentUI class for:
219219
# com.intellij.util.ui.tree.PerFileConfigurableBase$PerFileConfigurableComboBoxAction$1"
220220
# but it does not seem related to anything the plugin is doing...

.gitignore

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
.gradle
1+
## Intellij IDEA
2+
*.iml
3+
*.eml
4+
*.ipr
5+
*.iws
26
.idea
3-
.qodana
7+
*java.orig
8+
**/out/*
9+
10+
## Eclipse
11+
*.classpath
12+
*.project
13+
14+
## Gradle
15+
.gradle
416
build
17+
jvm/
18+
19+
## Qodana
20+
.qodana

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
### Added
88

99
- Allow specifying port forwarding behavior in devcontainer.json
10+
- support for IntelliJ 2025.2
1011

1112
## [0.0.4] - 2025-02-21
1213

build.gradle.kts

Lines changed: 104 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import org.jetbrains.changelog.Changelog
22
import org.jetbrains.changelog.markdownToHTML
3+
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
34

45
fun properties(key: String) = providers.gradleProperty(key)
56
fun environment(key: String) = providers.environmentVariable(key)
@@ -17,68 +18,58 @@ plugins {
1718
group = properties("pluginGroup").get()
1819
version = properties("pluginVersion").get()
1920

21+
// Set the JVM language level used to build the project.
22+
kotlin {
23+
jvmToolchain(17)
24+
}
25+
2026
// Configure project's dependencies
2127
repositories {
2228
mavenCentral()
29+
// IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
30+
intellijPlatform {
31+
defaultRepositories()
32+
}
2333
}
2434

2535
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
2636
dependencies {
27-
// implementation(libs.annotations)
37+
// implementation(libs.annotations)
2838
// We need kotlinx-serialization-json >= 1.7.0 to support allowComments, as
2939
// devcontainer.json files often have comments and therefore use
3040
// nonstandard JSON syntax. This dependency should be marked compileOnly
3141
// once the minimum IDE version we support (pluginSinceBuild in
3242
// gradle.properties) is at least 251, which includes version 1.7.2.
3343
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
34-
}
3544

36-
// Set the JVM language level used to build the project.
37-
kotlin {
38-
jvmToolchain(17)
39-
}
45+
testImplementation("junit:junit:4.13.2")
4046

41-
// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
42-
intellij {
43-
pluginName = properties("pluginName")
44-
version = properties("platformVersion")
45-
type = properties("platformType")
47+
// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
48+
intellijPlatform {
49+
intellijIdeaCommunity(providers.gradleProperty("platformVersion"))
4650

47-
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
48-
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
49-
}
50-
51-
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
52-
changelog {
53-
groups.empty()
54-
repositoryUrl = properties("pluginRepositoryUrl")
55-
}
51+
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
52+
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
5653

57-
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
58-
koverReport {
59-
defaults {
60-
xml {
61-
onCheck = true
62-
}
54+
pluginVerifier()
6355
}
6456
}
6557

66-
tasks {
67-
wrapper {
68-
gradleVersion = properties("gradleVersion").get()
69-
}
58+
// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
59+
intellijPlatform {
60+
buildSearchableOptions = true
61+
instrumentCode = true
7062

71-
patchPluginXml {
72-
version = properties("pluginVersion")
73-
sinceBuild = properties("pluginSinceBuild")
74-
untilBuild = properties("pluginUntilBuild")
63+
pluginConfiguration {
64+
name = providers.gradleProperty("pluginName")
65+
version = providers.gradleProperty("pluginVersion")
7566

7667
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
77-
pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
68+
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
7869
val start = "<!-- Plugin description -->"
7970
val end = "<!-- Plugin description end -->"
8071

81-
with (it.lines()) {
72+
with(it.lines()) {
8273
if (!containsAll(listOf(start, end))) {
8374
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
8475
}
@@ -88,7 +79,7 @@ tasks {
8879

8980
val changelog = project.changelog // local variable for configuration cache compatibility
9081
// Get the latest available change notes from the changelog file
91-
changeNotes = properties("pluginVersion").map { pluginVersion ->
82+
changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
9283
with(changelog) {
9384
renderItem(
9485
(getOrNull(pluginVersion) ?: getUnreleased())
@@ -98,29 +89,93 @@ tasks {
9889
)
9990
}
10091
}
92+
93+
ideaVersion {
94+
sinceBuild = providers.gradleProperty("pluginSinceBuild")
95+
untilBuild = providers.gradleProperty("pluginUntilBuild")
96+
}
10197
}
10298

103-
// Configure UI tests plugin
104-
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
105-
runIdeForUiTests {
106-
systemProperty("robot-server.port", "8082")
107-
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
108-
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
109-
systemProperty("jb.consents.confirmation.enabled", "false")
99+
pluginVerification {
100+
ides {
101+
providers.gradleProperty("verifyVersions").get().split(',').map(String::trim).forEach { version ->
102+
ide(IntelliJPlatformType.IntellijIdeaCommunity, version)
103+
}
104+
}
110105
}
111106

112-
signPlugin {
107+
signing {
113108
certificateChain = environment("CERTIFICATE_CHAIN")
114109
privateKey = environment("PRIVATE_KEY")
115110
password = environment("PRIVATE_KEY_PASSWORD")
116111
}
117112

118-
publishPlugin {
119-
dependsOn("patchChangelog")
120-
token = environment("PUBLISH_TOKEN")
113+
publishing {
114+
token = providers.environmentVariable("PUBLISH_TOKEN")
121115
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
122116
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
123117
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
124-
channels = properties("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
118+
channels = providers.gradleProperty("pluginVersion")
119+
.map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
120+
}
121+
}
122+
123+
124+
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
125+
changelog {
126+
version.set(properties("pluginVersion"))
127+
groups.set(emptyList())
128+
}
129+
130+
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
131+
kover {
132+
reports {
133+
total {
134+
xml {
135+
onCheck = true
136+
}
137+
}
138+
}
139+
}
140+
141+
// Configure Gradle Qodana Plugin - read more: https://github.com/JetBrains/gradle-qodana-plugin
142+
qodana {
143+
cachePath.set(projectDir.resolve(".qodana").canonicalPath)
144+
resultsPath.set(projectDir.resolve("build/reports/inspections").canonicalPath)
145+
}
146+
147+
tasks {
148+
wrapper {
149+
gradleVersion = properties("gradleVersion").get()
150+
}
151+
152+
buildPlugin {
153+
archiveBaseName = providers.gradleProperty("pluginArtifactName").get()
154+
// exclude { "coroutines" in it.name }
155+
}
156+
157+
publishPlugin {
158+
dependsOn(patchChangelog)
125159
}
126160
}
161+
162+
intellijPlatformTesting {
163+
runIde {
164+
register("runIdeForUiTests") {
165+
task {
166+
jvmArgumentProviders += CommandLineArgumentProvider {
167+
listOf(
168+
"-Drobot-server.port=8082",
169+
"-Dide.mac.message.dialogs.as.sheets=false",
170+
"-Djb.privacy.policy.text=<!--999.999-->",
171+
"-Djb.consents.confirmation.enabled=false",
172+
)
173+
}
174+
}
175+
176+
plugins {
177+
robotServerPlugin()
178+
}
179+
}
180+
}
181+
}

gradle.properties

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
22

33
pluginGroup = com.coder.jetbrains
4-
pluginName = coder-gateway-backend
4+
pluginName = Coder Gateway Backend
5+
pluginArtifactName = coder-gateway-backend
56
pluginRepositoryUrl = https://github.com/coder/jetbrains-backend-coder
67
# SemVer format -> https://semver.org
7-
pluginVersion = 0.0.4
8+
pluginVersion = 0.1.0
89

910
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
1011
pluginSinceBuild = 223
11-
pluginUntilBuild = 251.*
12+
pluginUntilBuild = 252.*
1213

1314
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
1415
platformType = IC
1516
platformVersion = 2022.3.3
16-
17+
# available releases listed at: https://data.services.jetbrains.com/products?code=IC
18+
verifyVersions=2025.1,2025.2
1719
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
1820
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
19-
platformPlugins=com.jetbrains.codeWithMe, org.jetbrains.plugins.terminal
21+
platformBundledPlugins=com.jetbrains.codeWithMe, org.jetbrains.plugins.terminal
2022

2123
# Gradle Releases -> https://github.com/gradle/gradle/releases
2224
gradleVersion = 8.6

gradle/libs.versions.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ annotations = "24.1.0"
55
# plugins
66
kotlin = "2.0.0"
77
changelog = "2.2.0"
8-
gradleIntelliJPlugin = "1.17.2"
9-
qodana = "2024.1.5"
10-
kover = "0.7.6"
8+
gradleIntelliJPlugin = "2.6.0"
9+
qodana = "2025.1.1"
10+
kover = "0.9.1"
1111

1212
[libraries]
1313
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
1414

1515
[plugins]
1616
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
17-
gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" }
17+
gradleIntelliJPlugin = { id = "org.jetbrains.intellij.platform", version.ref = "gradleIntelliJPlugin" }
1818
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
1919
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
2020
qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }

0 commit comments

Comments
 (0)