Skip to content

Commit d3fd606

Browse files
authored
feat: migrate to IntelliJ Platform Gradle Plugin (#77)
* feat: migrate to IntelliJ Platform Gradle Plugin * feat: aligned build.gradle.kts to plugin template
1 parent 223fb0b commit d3fd606

File tree

8 files changed

+121
-84
lines changed

8 files changed

+121
-84
lines changed

.gitignore

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

.run/Run Verifications.run.xml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
<component name="ProjectRunConfigurationManager">
22
<configuration default="false" name="Run Verifications" type="GradleRunConfiguration" factoryName="Gradle">
3-
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log"/>
3+
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
44
<ExternalSystemSettings>
5-
<option name="executionName"/>
6-
<option name="externalProjectPath" value="$PROJECT_DIR$"/>
7-
<option name="externalSystemIdString" value="GRADLE"/>
8-
<option name="scriptParameters" value=""/>
5+
<option name="executionName" />
6+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
7+
<option name="externalSystemIdString" value="GRADLE" />
8+
<option name="scriptParameters" value="" />
99
<option name="taskDescriptions">
10-
<list/>
10+
<list />
1111
</option>
1212
<option name="taskNames">
1313
<list>
14-
<option value="runPluginVerifier"/>
14+
<option value="verifyPlugin" />
1515
</list>
1616
</option>
17-
<option name="vmOptions" value=""/>
17+
<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=""
24-
scriptParameters=""/>
25-
</method>
22+
<RunAsTest>false</RunAsTest>
23+
<method v="2" />
2624
</configuration>
27-
</component>
25+
</component>

build.gradle.kts

Lines changed: 83 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
1-
import java.net.URI
1+
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
22

3-
fun properties(key: String) = providers.gradleProperty(key)
4-
fun environment(key: String) = providers.environmentVariable(key)
53
val remoteRobotVersion = "0.11.21"
64

75
plugins {
86
id("java") // Java support
97
alias(libs.plugins.kotlin) // Kotlin support
10-
alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin
8+
alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
119
}
1210

13-
group = properties("pluginGroup").get()
14-
version = properties("pluginVersion").get()
11+
group = providers.gradleProperty("pluginGroup").get()
12+
version = providers.gradleProperty("pluginVersion").get()
1513

1614
// Configure project's dependencies
1715
repositories {
1816
mavenCentral()
19-
maven { url = URI("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies") }
17+
18+
// IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
19+
intellijPlatform {
20+
defaultRepositories()
21+
}
2022
}
2123

2224
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
2325
dependencies {
26+
testImplementation(libs.junit)
2427
testImplementation("com.intellij.remoterobot:remote-robot:$remoteRobotVersion")
2528
testImplementation("com.intellij.remoterobot:remote-fixtures:$remoteRobotVersion")
2629
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
@@ -29,6 +32,22 @@ dependencies {
2932

3033
// Logging Network Calls
3134
testImplementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
35+
36+
// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
37+
intellijPlatform {
38+
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))
39+
40+
// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
41+
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
42+
43+
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
44+
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
45+
46+
instrumentationTools()
47+
pluginVerifier()
48+
zipSigner()
49+
testFramework(TestFrameworkType.Platform)
50+
}
3251
}
3352

3453
// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
@@ -37,64 +56,76 @@ kotlin {
3756
}
3857

3958
// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
40-
intellij {
41-
pluginName = properties("pluginName")
42-
version = properties("platformVersion")
43-
type = properties("platformType")
44-
45-
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
46-
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
47-
}
59+
intellijPlatform {
60+
pluginConfiguration {
61+
version = providers.gradleProperty("pluginVersion")
62+
63+
ideaVersion {
64+
sinceBuild = providers.gradleProperty("pluginSinceBuild")
65+
untilBuild = providers.gradleProperty("pluginUntilBuild")
66+
}
67+
}
4868

49-
tasks {
50-
wrapper {
51-
gradleVersion = properties("gradleVersion").get()
69+
signing {
70+
certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN")
71+
privateKey = providers.environmentVariable("PRIVATE_KEY")
72+
password = providers.environmentVariable("PRIVATE_KEY_PASSWORD")
5273
}
5374

54-
patchPluginXml {
55-
version = properties("pluginVersion")
56-
sinceBuild = properties("pluginSinceBuild")
57-
untilBuild = properties("pluginUntilBuild")
75+
publishing {
76+
token = providers.environmentVariable("PUBLISH_TOKEN")
77+
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
78+
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
79+
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
80+
channels = providers.gradleProperty("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) }
5881
}
5982

60-
downloadRobotServerPlugin {
61-
version.set(remoteRobotVersion)
83+
pluginVerification {
84+
ides {
85+
recommended()
86+
}
6287
}
88+
}
6389

64-
// Configure UI tests plugin
65-
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
66-
runIdeForUiTests {
67-
systemProperty("robot-server.port", "8082")
68-
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
69-
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
70-
systemProperty("jb.consents.confirmation.enabled", "false")
71-
systemProperty("ide.mac.file.chooser.native", "false")
72-
systemProperty("jbScreenMenuBar.enabled", "false")
73-
systemProperty("apple.laf.useScreenMenuBar", "false")
74-
systemProperty("idea.trust.all.projects", "true")
75-
systemProperty("ide.show.tips.on.startup.default.value", "false")
76-
systemProperty("eap.require.license", "false")
90+
tasks {
91+
wrapper {
92+
gradleVersion = providers.gradleProperty("gradleVersion").get()
93+
}
7794

95+
patchPluginXml {
96+
version = providers.gradleProperty("pluginVersion")
97+
sinceBuild = providers.gradleProperty("pluginSinceBuild")
98+
untilBuild = providers.gradleProperty("pluginUntilBuild")
7899
}
79100

80101
test {
81102
useJUnitPlatform()
82103
}
104+
}
83105

84-
signPlugin {
85-
certificateChain = environment("CERTIFICATE_CHAIN")
86-
privateKey = environment("PRIVATE_KEY")
87-
password = environment("PRIVATE_KEY_PASSWORD")
88-
}
89-
90-
publishPlugin {
91-
token = environment("PUBLISH_TOKEN")
92-
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
93-
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
94-
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
95-
channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) }
106+
intellijPlatformTesting {
107+
runIde {
108+
register("runIdeForUiTests") {
109+
task {
110+
jvmArgumentProviders += CommandLineArgumentProvider {
111+
listOf(
112+
"-Drobot-server.port=8082",
113+
"-Dide.mac.message.dialogs.as.sheets=false",
114+
"-Djb.privacy.policy.text=<!--999.999-->",
115+
"-Djb.consents.confirmation.enabled=false",
116+
"-Dide.mac.file.chooser.native=false",
117+
"-DjbScreenMenuBar.enabled=false",
118+
"-Dapple.laf.useScreenMenuBar=false",
119+
"-Didea.trust.all.projects=true",
120+
"-Dide.show.tips.on.startup.default.value=false",
121+
"-Deap.require.license=false"
122+
)
123+
}
124+
}
125+
126+
plugins {
127+
robotServerPlugin()
128+
}
129+
}
96130
}
97131
}
98-
99-
100-

gradle.properties

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,29 @@ pluginName=Biome
44
pluginRepositoryUrl=https://github.com/biomejs/biome
55
# SemVer format -> https://semver.org
66
pluginVersion=1.2.1
7+
78
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
8-
pluginSinceBuild=241
9-
pluginUntilBuild=241.*
9+
pluginSinceBuild = 241
10+
pluginUntilBuild = 242.*
11+
1012
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
11-
platformType=IU
12-
platformVersion=2024.1
13+
platformType = WS
14+
platformVersion = 2024.1.1
15+
1316
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
14-
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
15-
platformPlugins=JavaScript
17+
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
18+
platformPlugins =
19+
# Example: platformBundledPlugins = com.intellij.java
20+
platformBundledPlugins = JavaScript
21+
1622
# Gradle Releases -> https://github.com/gradle/gradle/releases
17-
gradleVersion=8.5
23+
gradleVersion = 8.9
24+
1825
# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
19-
kotlin.stdlib.default.dependency=false
26+
kotlin.stdlib.default.dependency = false
27+
2028
# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
21-
org.gradle.configuration-cache=true
29+
org.gradle.configuration-cache = true
30+
2231
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
23-
org.gradle.caching=true
24-
# Enable Gradle Kotlin DSL Lazy Property Assignment -> https://docs.gradle.org/current/userguide/kotlin_dsl.html#kotdsl:assignment
25-
systemProp.org.gradle.unsafe.kotlin.assignment=true
32+
org.gradle.caching = true

gradle/libs.versions.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[versions]
22
# libraries
3-
annotations = "24.1.0"
3+
junit = "4.13.2"
44

55
# plugins
6-
kotlin = "1.9.21"
7-
gradleIntelliJPlugin = "1.16.1"
6+
intelliJPlatform = "2.0.1"
7+
kotlin = "1.9.25"
88

99
[libraries]
10-
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
10+
junit = { group = "junit", name = "junit", version.ref = "junit" }
1111

1212
[plugins]
13-
gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" }
13+
intelliJPlatform = { id = "org.jetbrains.intellij.platform", version.ref = "intelliJPlatform" }
1414
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }

gradle/wrapper/gradle-wrapper.jar

-19.4 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

src/main/kotlin/com/github/biomejs/intellijbiome/actions/BiomeCheckOnSaveAction.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import com.intellij.openapi.editor.Document
66
import com.intellij.openapi.project.Project
77

88

9-
class BiomeCheckOnSaveAction() :
9+
class BiomeCheckOnSaveAction :
1010
ActionsOnSaveFileDocumentManagerListener.ActionOnSave() {
1111
override fun isEnabledForProject(project: Project): Boolean {
1212
val settings = BiomeSettings.getInstance(project)

0 commit comments

Comments
 (0)