Skip to content

Commit 0eafb27

Browse files
Merge pull request #22 from strangelookingnerd/migrate_gradle_plugin_2_0
Migrate to IntelliJ Platform Gradle Plugin 2.0
2 parents 9c7d2b7 + 0569d06 commit 0eafb27

10 files changed

Lines changed: 131 additions & 90 deletions

File tree

.github/workflows/build.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
3737
steps:
3838

39-
# Check out current repository
39+
# Check out the current repository
4040
- name: Fetch Sources
4141
uses: actions/checkout@v4
4242

@@ -73,8 +73,6 @@ jobs:
7373
echo "$CHANGELOG" >> $GITHUB_OUTPUT
7474
echo "EOF" >> $GITHUB_OUTPUT
7575
76-
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
77-
7876
# Build plugin
7977
- name: Build plugin
8078
run: ./gradlew buildPlugin
@@ -104,7 +102,7 @@ jobs:
104102
runs-on: ubuntu-latest
105103
steps:
106104

107-
# Check out current repository
105+
# Check out the current repository
108106
- name: Fetch Sources
109107
uses: actions/checkout@v4
110108

@@ -137,7 +135,7 @@ jobs:
137135
- name: Upload Code Coverage Report
138136
uses: codecov/codecov-action@v4
139137
with:
140-
token: ${{secrets.CODECOV_TOKEN}}
138+
token: ${{ secrets.CODECOV_TOKEN }}
141139
files: ${{ github.workspace }}/build/reports/kover/report.xml
142140

143141
# Run Qodana inspections and provide report
@@ -159,7 +157,7 @@ jobs:
159157
tool-cache: false
160158
large-packages: false
161159

162-
# Check out current repository
160+
# Check out the current repository
163161
- name: Fetch Sources
164162
uses: actions/checkout@v4
165163

@@ -196,7 +194,7 @@ jobs:
196194
tool-cache: false
197195
large-packages: false
198196

199-
# Check out current repository
197+
# Check out the current repository
200198
- name: Fetch Sources
201199
uses: actions/checkout@v4
202200

@@ -222,7 +220,7 @@ jobs:
222220

223221
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
224222
- name: Run Plugin Verification tasks
225-
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
223+
run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
226224

227225
# Collect Plugin Verifier Result
228226
- name: Collect Plugin Verifier Result
@@ -243,7 +241,7 @@ jobs:
243241
contents: write
244242
steps:
245243

246-
# Check out current repository
244+
# Check out the current repository
247245
- name: Fetch Sources
248246
uses: actions/checkout@v4
249247

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
pull-requests: write
1919
steps:
2020

21-
# Check out current repository
21+
# Check out the current repository
2222
- name: Fetch Sources
2323
uses: actions/checkout@v4
2424
with:
@@ -51,7 +51,7 @@ jobs:
5151
echo "$CHANGELOG" >> $GITHUB_OUTPUT
5252
echo "EOF" >> $GITHUB_OUTPUT
5353
54-
# Update Unreleased section with the current release note
54+
# Update the Unreleased section with the current release note
5555
- name: Patch Changelog
5656
if: ${{ steps.properties.outputs.changelog != '' }}
5757
env:

.github/workflows/run-ui-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131

3232
steps:
3333

34-
# Check out current repository
34+
# Check out the current repository
3535
- name: Fetch Sources
3636
uses: actions/checkout@v4
3737

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.gradle
22
.idea
3+
.intellijPlatform
34
.qodana
45
build

.run/Run Verifications.run.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@
1111
</option>
1212
<option name="taskNames">
1313
<list>
14-
<option value="runPluginVerifier" />
14+
<option value="verifyPlugin" />
1515
</list>
1616
</option>
1717
<option name="vmOptions" value="" />
1818
</ExternalSystemSettings>
1919
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
2020
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
2121
<DebugAllEnabled>false</DebugAllEnabled>
22-
<method v="2">
23-
<option name="Gradle.BeforeRunTask" enabled="true" tasks="clean" externalProjectPath="$PROJECT_DIR$" vmOptions="" scriptParameters="" />
24-
</method>
22+
<RunAsTest>false</RunAsTest>
23+
<method v="2" />
2524
</configuration>
2625
</component>

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
## [Unreleased]
66

7+
### Added
8+
9+
- Migrate to IntelliJ Platform Gradle Plugin 2.0
10+
- Various dependency updates
11+
712
## [0.0.3] - 2024-06-26
813

914
### Added

build.gradle.kts

Lines changed: 100 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,64 @@
11
import org.jetbrains.changelog.Changelog
22
import org.jetbrains.changelog.markdownToHTML
3-
4-
fun properties(key: String) = providers.gradleProperty(key)
5-
fun environment(key: String) = providers.environmentVariable(key)
3+
import org.jetbrains.intellij.platform.gradle.Constants.Constraints
4+
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
65

76
plugins {
87
id("java") // Java support
98
alias(libs.plugins.kotlin) // Kotlin support
10-
alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin
9+
alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
1110
alias(libs.plugins.changelog) // Gradle Changelog Plugin
1211
alias(libs.plugins.qodana) // Gradle Qodana Plugin
1312
alias(libs.plugins.kover) // Gradle Kover Plugin
1413
}
1514

16-
group = properties("pluginGroup").get()
17-
version = properties("pluginVersion").get()
15+
group = providers.gradleProperty("pluginGroup").get()
16+
version = providers.gradleProperty("pluginVersion").get()
17+
18+
// Set the JVM language level used to build the project.
19+
kotlin {
20+
jvmToolchain(17)
21+
}
1822

1923
// Configure project's dependencies
2024
repositories {
2125
mavenCentral()
26+
27+
// IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
28+
intellijPlatform {
29+
defaultRepositories()
30+
}
2231
}
2332

2433
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
2534
dependencies {
35+
testImplementation(libs.junit)
2636
testImplementation(libs.junit5)
27-
}
28-
29-
// Set the JVM language level used to build the project.
30-
kotlin {
31-
jvmToolchain(17)
32-
}
3337

34-
// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
35-
intellij {
36-
pluginName = properties("pluginName")
37-
version = properties("platformVersion")
38-
type = properties("platformType")
38+
// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
39+
intellijPlatform {
40+
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))
3941

40-
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
41-
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
42-
}
42+
// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
43+
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
4344

44-
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
45-
changelog {
46-
groups.empty()
47-
repositoryUrl = properties("pluginRepositoryUrl")
48-
}
45+
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
46+
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
4947

50-
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
51-
kover {
52-
reports {
53-
total {
54-
xml {
55-
onCheck = true
56-
}
57-
}
48+
instrumentationTools()
49+
pluginVerifier()
50+
zipSigner()
51+
testFramework(TestFrameworkType.Platform)
5852
}
5953
}
6054

61-
tasks {
62-
wrapper {
63-
gradleVersion = properties("gradleVersion").get()
64-
}
65-
66-
buildSearchableOptions {
67-
enabled = false
68-
}
69-
70-
patchPluginXml {
71-
version = properties("pluginVersion")
72-
sinceBuild = properties("pluginSinceBuild")
73-
untilBuild = properties("pluginUntilBuild")
55+
// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
56+
intellijPlatform {
57+
pluginConfiguration {
58+
version = providers.gradleProperty("pluginVersion")
7459

7560
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
76-
pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
61+
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
7762
val start = "<!-- Plugin description -->"
7863
val end = "<!-- Plugin description end -->"
7964

@@ -87,7 +72,7 @@ tasks {
8772

8873
val changelog = project.changelog // local variable for configuration cache compatibility
8974
// Get the latest available change notes from the changelog file
90-
changeNotes = properties("pluginVersion").map { pluginVersion ->
75+
changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
9176
with(changelog) {
9277
renderItem(
9378
(getOrNull(pluginVersion) ?: getUnreleased())
@@ -97,33 +82,82 @@ tasks {
9782
)
9883
}
9984
}
85+
86+
ideaVersion {
87+
sinceBuild = providers.gradleProperty("pluginSinceBuild")
88+
untilBuild = providers.gradleProperty("pluginUntilBuild")
89+
}
10090
}
10191

102-
// Configure UI tests plugin
103-
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
104-
runIdeForUiTests {
105-
systemProperty("robot-server.port", "8082")
106-
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
107-
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
108-
systemProperty("jb.consents.confirmation.enabled", "false")
92+
signing {
93+
certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN")
94+
privateKey = providers.environmentVariable("PRIVATE_KEY")
95+
password = providers.environmentVariable("PRIVATE_KEY_PASSWORD")
96+
}
97+
98+
publishing {
99+
token = providers.environmentVariable("PUBLISH_TOKEN")
100+
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
101+
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
102+
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
103+
channels = providers.gradleProperty("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
104+
}
105+
106+
pluginVerification {
107+
ides {
108+
recommended()
109+
}
110+
}
111+
}
112+
113+
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
114+
changelog {
115+
groups.empty()
116+
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
117+
}
118+
119+
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
120+
kover {
121+
reports {
122+
total {
123+
xml {
124+
onCheck = true
125+
}
126+
}
127+
}
128+
}
129+
130+
tasks {
131+
wrapper {
132+
gradleVersion = providers.gradleProperty("gradleVersion").get()
133+
}
134+
135+
buildSearchableOptions {
136+
enabled = false
109137
}
110138

111139
test {
112140
useJUnitPlatform()
113141
}
114142

115-
signPlugin {
116-
certificateChain = environment("CERTIFICATE_CHAIN")
117-
privateKey = environment("PRIVATE_KEY")
118-
password = environment("PRIVATE_KEY_PASSWORD")
143+
publishPlugin {
144+
dependsOn(patchChangelog)
119145
}
146+
}
120147

121-
publishPlugin {
122-
dependsOn("patchChangelog")
123-
token = environment("PUBLISH_TOKEN")
124-
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
125-
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
126-
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
127-
channels = properties("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
148+
val runIdeForUiTests by intellijPlatformTesting.runIde.registering {
149+
task {
150+
jvmArgumentProviders += CommandLineArgumentProvider {
151+
listOf(
152+
"-Drobot-server.port=8082",
153+
"-Dide.mac.message.dialogs.as.sheets=false",
154+
"-Djb.privacy.policy.text=<!--999.999-->",
155+
"-Djb.consents.confirmation.enabled=false",
156+
)
157+
}
158+
}
159+
160+
plugins {
161+
robotServerPlugin(Constraints.LATEST_VERSION)
128162
}
129163
}

gradle.properties

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ pluginUntilBuild = 242.*
1212

1313
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
1414
platformType = IC
15-
platformVersion = 2023.2.6
15+
platformVersion = 2023.2.7
1616

1717
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
18-
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
18+
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
1919
platformPlugins =
20+
# Example: platformBundledPlugins = com.intellij.java
21+
platformBundledPlugins =
2022

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

0 commit comments

Comments
 (0)