Skip to content

Commit 30e78c8

Browse files
committed
Build: update to IntelliJ Platform Gradle Plugin v2
1 parent b61eb92 commit 30e78c8

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/.intellijPlatform/
12
/src/main/gen-parser
23
/src/main/gen-lexer
34

build.gradle.kts

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import org.jetbrains.intellij.tasks.PrepareSandboxTask
1+
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
2+
import org.jetbrains.intellij.platform.gradle.tasks.PrepareSandboxTask
23
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
34
import java.security.MessageDigest
45
import java.util.zip.ZipFile
@@ -8,15 +9,14 @@ plugins {
89
alias(libs.plugins.changelog)
910
alias(libs.plugins.gradleJvmWrapper)
1011
alias(libs.plugins.grammarkit)
11-
alias(libs.plugins.intellij)
12+
alias(libs.plugins.intellijPlatform)
1213
alias(libs.plugins.kotlin)
1314
}
1415

15-
intellij {
16-
type.set("IC")
17-
version.set(libs.versions.intellij)
18-
plugins.set(listOf("org.intellij.intelliLang", "terminal"))
19-
pluginName.set("PowerShell")
16+
intellijPlatform {
17+
pluginConfiguration {
18+
name = "PowerShell"
19+
}
2020
}
2121

2222
sourceSets {
@@ -34,6 +34,10 @@ group = "com.intellij.plugin"
3434
version = "2.6.1"
3535

3636
repositories {
37+
intellijPlatform {
38+
defaultRepositories()
39+
}
40+
3741
mavenCentral()
3842
ivy {
3943
url = uri("https://github.com/PowerShell/PSScriptAnalyzer/releases/download/")
@@ -58,7 +62,15 @@ val psesSha256Hash: String by project
5862
val powerShellEditorServices: Configuration by configurations.creating
5963

6064
dependencies {
65+
intellijPlatform {
66+
intellijIdeaCommunity(libs.versions.intellij)
67+
bundledPlugins("org.intellij.intelliLang", "org.jetbrains.plugins.terminal")
68+
instrumentationTools()
69+
testFramework(TestFrameworkType.Bundled)
70+
}
71+
6172
implementation(libs.bundles.junixsocket)
73+
compileOnly(libs.jetBrainsAnnotations)
6274

6375
implementation(libs.lsp4j)
6476
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
@@ -154,11 +166,11 @@ tasks {
154166
}
155167
}
156168

157-
fun PrepareSandboxTask.unpackPsScriptAnalyzer(outDir: String) {
169+
fun PrepareSandboxTask.unpackPsScriptAnalyzer(outDir: Provider<String>) {
158170
dependsOn(psScriptAnalyzer, verifyPsScriptAnalyzer)
159171

160172
from(zipTree(psScriptAnalyzer.singleFile)) {
161-
into("$outDir/PSScriptAnalyzer")
173+
into(outDir.map { "$it/PSScriptAnalyzer" })
162174

163175
// NuGet stuff:
164176
exclude("_manifest/**", "_rels/**", "package/**", "[Content_Types].xml", "*.nuspec")
@@ -176,18 +188,18 @@ tasks {
176188
}
177189
}
178190

179-
fun PrepareSandboxTask.unpackPowerShellEditorServices(outDir: String) {
191+
fun PrepareSandboxTask.unpackPowerShellEditorServices(outDir: Provider<String>) {
180192
dependsOn(powerShellEditorServices, verifyPowerShellEditorServices)
181193

182194
from(zipTree(powerShellEditorServices.singleFile)) {
183-
into("$outDir/")
195+
into(outDir.map { "$it/" })
184196
// We only need this module and not anything else from the archive:
185197
include("PowerShellEditorServices/**")
186198
}
187199
}
188200

189201
withType<PrepareSandboxTask> {
190-
val outDir = "${intellij.pluginName.get()}/lib/LanguageHost/modules"
202+
val outDir = intellijPlatform.pluginConfiguration.name.map { "$it/lib/LanguageHost/modules" }
191203
unpackPsScriptAnalyzer(outDir)
192204
unpackPowerShellEditorServices(outDir)
193205
}
@@ -218,7 +230,7 @@ tasks {
218230

219231
runIde {
220232
jvmArgs("-Dide.plugins.snapshot.on.unload.fail=true", "-XX:+UnlockDiagnosticVMOptions")
221-
autoReloadPlugins.set(true)
233+
autoReload = true
222234
}
223235

224236
patchPluginXml {

gradle/libs.versions.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ intellij = "2023.2"
33
junixsocket = "2.10.0"
44

55
[libraries]
6+
jetBrainsAnnotations = "org.jetbrains:annotations:24.0.1" # TODO: Get rid of this after updating IntelliJ
7+
junit = "junit:junit:4.13.2"
68
junixsocket-common = { module = "com.kohlschutter.junixsocket:junixsocket-common", version.ref = "junixsocket" }
79
junixsocket-native-common = { module = "com.kohlschutter.junixsocket:junixsocket-native-common", version.ref = "junixsocket" }
810
lsp4j = "org.eclipse.lsp4j:org.eclipse.lsp4j:0.23.1"
9-
junit = "junit:junit:4.13.2"
1011

1112
[bundles]
1213
junixsocket = ["junixsocket-common", "junixsocket-native-common"]
@@ -15,5 +16,5 @@ junixsocket = ["junixsocket-common", "junixsocket-native-common"]
1516
changelog = { id = "org.jetbrains.changelog", version = "2.2.1" }
1617
gradleJvmWrapper = "me.filippov.gradle.jvm.wrapper:0.14.0"
1718
grammarkit = { id = "org.jetbrains.grammarkit", version = "2022.3.2.2" }
18-
intellij = { id = "org.jetbrains.intellij", version = "1.17.4" }
19+
intellijPlatform = "org.jetbrains.intellij.platform:2.0.1"
1920
kotlin = { id = "org.jetbrains.kotlin.jvm", version = "2.0.0" }

0 commit comments

Comments
 (0)