Skip to content

Commit 6f10623

Browse files
committed
Upgrade Gradle to 9.0 and Intellij Platform to 2.9
1 parent ddc21d3 commit 6f10623

File tree

5 files changed

+83
-106
lines changed

5 files changed

+83
-106
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@ jobs:
1818
- name: Build with Gradle
1919
run: |
2020
chmod +x gradlew
21-
./gradlew build -x test
21+
./gradlew buildPlugin
2222
- name: Create artifact name
2323
id: vars
2424
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
2525
- name: Upload artifact
2626
uses: actions/upload-artifact@v4
2727
with:
2828
name: artifact-${{ steps.vars.outputs.sha_short }}
29-
path: build/libs/instrumented*.jar
29+
path: build/libs/*instrumented.jar
3030
- name: Download artifact
3131
uses: actions/download-artifact@v4
3232
- name: IntelliJ Platform Plugin Verifier
3333
uses: ChrisCarini/intellij-platform-plugin-verifier-action@v2.0.1
3434
with:
3535
ide-versions: |
36-
phpstorm:2022.2
3736
phpstorm:2023.1
3837
phpstorm:2024.1
38+
phpstorm:2025.1
3939
phpstorm:LATEST-EAP-SNAPSHOT
4040
- name: Upload release assets
4141
uses: softprops/action-gh-release@v2

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
local.properties
44
/src/main/gen
55
/.idea
6+
/.kotlin
7+
/.intellijPlatform
68
/.gradle
79
/build
810
/out

build.gradle.kts

Lines changed: 68 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
1-
import kotlinx.kover.tasks.KoverXmlTask
1+
import org.gradle.kotlin.dsl.register
22
import org.jetbrains.changelog.Changelog
33
import org.jetbrains.changelog.markdownToHTML
44
import org.jetbrains.grammarkit.tasks.GenerateLexerTask
55
import org.jetbrains.grammarkit.tasks.GenerateParserTask
66
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
7+
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
78

8-
fun properties(key: String) = providers.gradleProperty(key)
9-
fun environment(key: String) = providers.environmentVariable(key)
9+
fun cfg(key: String) = providers.gradleProperty(key)
10+
fun env(key: String) = providers.environmentVariable(key)
1011

1112
plugins {
1213
id("java")
13-
id("org.jetbrains.kotlin.jvm") version "1.8.20"
14-
id("org.jetbrains.intellij") version "1.17.3"
15-
id("org.jetbrains.grammarkit") version "2022.3.2.2"
16-
id("org.jetbrains.changelog") version "2.2.0"
14+
id("org.jetbrains.intellij.platform") version "2.9.0"
15+
id("org.jetbrains.changelog") version "2.4.0"
1716
id("org.jetbrains.qodana") version "0.1.13"
18-
id("org.jetbrains.kotlinx.kover") version "0.6.1"
17+
id("org.jetbrains.grammarkit") version "2022.3.2.2"
18+
kotlin("jvm") version "2.2.10"
1919
}
2020

21-
group = properties("pluginGroup").get()
22-
version = properties("pluginVersion").get()
21+
group = cfg("pluginGroup").get()
22+
version = cfg("pluginVersion").get()
2323

2424
repositories {
2525
mavenCentral()
26+
27+
intellijPlatform {
28+
defaultRepositories()
29+
}
2630
}
2731

2832
kotlin {
@@ -38,96 +42,99 @@ sourceSets {
3842
}
3943
}
4044

41-
// https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
42-
intellij {
43-
pluginName.set(properties("pluginName"))
44-
version.set(properties("platformVersion"))
45-
type.set(properties("platformType"))
45+
dependencies {
46+
intellijPlatform {
47+
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))
48+
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
49+
testFramework(TestFrameworkType.Platform)
50+
}
4651

47-
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
48-
plugins.set(properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) })
52+
testImplementation("junit:junit:4.13.2")
4953
}
5054

51-
grammarKit {
52-
// Version of IntelliJ patched JFlex (see the link below), Default is 1.7.0-1
53-
jflexRelease.set(properties("jflexRelease"))
55+
intellijPlatform {
56+
pluginConfiguration {
57+
name = cfg("pluginName")
58+
version = cfg("pluginVersion")
59+
60+
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
61+
val start = "<!-- Plugin description -->"
62+
val end = "<!-- Plugin description end -->"
5463

55-
// Release version, tag, or short commit hash of Grammar-Kit to use (see link below). Default is 2021.1.2
56-
grammarKitRelease.set(properties("grammarKitRelease"))
64+
with(it.lines()) {
65+
if (!containsAll(listOf(start, end))) {
66+
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
67+
}
68+
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
69+
}
70+
}
71+
72+
changeNotes = provider {
73+
changelog.getAll().values.joinToString("\n") { changelog.renderItem(it, Changelog.OutputType.HTML) }
74+
}
75+
76+
ideaVersion {
77+
sinceBuild = cfg("pluginSinceBuild")
78+
}
79+
}
80+
81+
autoReload = true
5782
}
5883

59-
// https://github.com/JetBrains/gradle-qodana-plugin
60-
qodana {
61-
cachePath.set(provider { file(".qodana").canonicalPath })
62-
reportPath.set(provider { file("build/reports/inspections").canonicalPath })
63-
saveReport.set(true)
64-
showReport.set(environment("QODANA_SHOW_REPORT").map { it.toBoolean() }.getOrElse(false))
84+
grammarKit {
85+
jflexRelease.set(cfg("jflexRelease"))
86+
grammarKitRelease.set(cfg("grammarKitRelease"))
87+
}
88+
89+
changelog {
90+
version = cfg("pluginVersion")
91+
repositoryUrl = cfg("pluginRepositoryUrl")
92+
path = file("CHANGELOG.md").canonicalPath
6593
}
6694

67-
// https://github.com/Kotlin/kotlinx-kover#configuration
68-
kover.xmlReport {
69-
onCheck.set(true)
95+
qodana {
96+
cachePath = provider { file(".qodana").canonicalPath }
97+
reportPath = provider { file("build/reports/inspections").canonicalPath }
98+
saveReport = true
99+
showReport = env("QODANA_SHOW_REPORT").map { it.toBoolean() }.getOrElse(false)
70100
}
71101

72-
val generateLatteParser = task("generateLatteParser", GenerateParserTask::class) {
102+
val generateLatteParser = tasks.register<GenerateParserTask>("generateLatteParser") {
73103
sourceFile.set(File("src/main/java/org/nette/latte/parser/LatteParser.bnf"))
74104
targetRootOutputDir.set(File("src/main/gen"))
75105
pathToParser.set("/org/nette/latte/parser/LatteParser.java")
76106
pathToPsiRoot.set("/org/nette/latte/psi")
77107
purgeOldFiles.set(false)
78108
}
79109

80-
val generateLatteMacroContentLexer = task<GenerateLexerTask>("generateLatteMacroContentLexer") {
110+
val generateLatteMacroContentLexer = tasks.register<GenerateLexerTask>("generateLatteMacroContentLexer") {
81111
sourceFile.set(File("src/main/java/org/nette/latte/lexer/grammars/LatteMacroContentLexer.flex"))
82112
targetOutputDir.set(File("src/main/gen/org/nette/latte/lexer"))
83113
purgeOldFiles.set(false)
84114
}
85115

86-
val generateLatteMacroLexer = task<GenerateLexerTask>("generateLatteMacroLexer") {
116+
val generateLatteMacroLexer = tasks.register<GenerateLexerTask>("generateLatteMacroLexer") {
87117
sourceFile.set(File("src/main/java/org/nette/latte/lexer/grammars/LatteMacroLexer.flex"))
88118
targetOutputDir.set(File("src/main/gen/org/nette/latte/lexer"))
89119
purgeOldFiles.set(false)
90120
}
91121

92-
val generateLatteTopLexer = task<GenerateLexerTask>("generateLatteTopLexer") {
122+
val generateLatteTopLexer = tasks.register<GenerateLexerTask>("generateLatteTopLexer") {
93123
sourceFile.set(File("src/main/java/org/nette/latte/lexer/grammars/LatteTopLexer.flex"))
94124
targetOutputDir.set(File("src/main/gen/org/nette/latte/lexer"))
95125
purgeOldFiles.set(false)
96126
}
97127

98-
val generateLattePhpLexer = task<GenerateLexerTask>("generateLattePhpLexer") {
128+
val generateLattePhpLexer = tasks.register<GenerateLexerTask>("generateLattePhpLexer") {
99129
sourceFile.set(File("src/main/java/org/nette/latte/lexer/grammars/LattePhpLexer.flex"))
100130
targetOutputDir.set(File("src/main/gen/org/nette/latte/lexer"))
101131
purgeOldFiles.set(false)
102132
}
103133

104-
changelog {
105-
version.set(properties("pluginVersion"))
106-
repositoryUrl = properties("pluginRepositoryUrl")
107-
path.set(file("CHANGELOG.md").canonicalPath)
108-
}
109-
110134
tasks {
111135
generateLexer.configure { enabled = false }
112136
generateParser.configure { enabled = false }
113137

114-
// Set the JVM compatibility versions
115-
properties("javaVersion").get().let {
116-
withType<JavaCompile> {
117-
sourceCompatibility = it
118-
targetCompatibility = it
119-
}
120-
}
121-
122-
withType<KotlinCompile> {
123-
kotlinOptions.jvmTarget = "17"
124-
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=all")
125-
}
126-
127-
withType<KoverXmlTask> {
128-
dependsOn("compileJava")
129-
}
130-
131138
withType<KotlinCompile> {
132139
dependsOn(
133140
generateLatteMacroContentLexer,
@@ -139,42 +146,10 @@ tasks {
139146
}
140147

141148
wrapper {
142-
gradleVersion = properties("gradleVersion").get()
143-
}
144-
145-
patchPluginXml {
146-
version.set(properties("pluginVersion"))
147-
sinceBuild.set(properties("pluginSinceBuild"))
148-
untilBuild.set(properties("pluginUntilBuild"))
149-
150-
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
151-
pluginDescription.set(providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
152-
val start = "<!-- Plugin description -->"
153-
val end = "<!-- Plugin description end -->"
154-
155-
with (it.lines()) {
156-
if (!containsAll(listOf(start, end))) {
157-
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
158-
}
159-
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
160-
}
161-
})
162-
163-
changeNotes.set( provider {
164-
changelog.getAll().values.joinToString("\n") { changelog.renderItem(it, Changelog.OutputType.HTML) }
165-
})
166-
}
167-
168-
// Configure UI tests plugin
169-
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
170-
runIdeForUiTests {
171-
systemProperty("robot-server.port", "8082")
172-
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
173-
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
174-
systemProperty("jb.consents.confirmation.enabled", "false")
149+
gradleVersion = cfg("gradleVersion").get()
175150
}
176151

177152
publishPlugin {
178-
token.set(environment("PLUGIN_PUBLISH_TOKEN"))
153+
token = env("PLUGIN_PUBLISH_TOKEN")
179154
}
180155
}

gradle.properties

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
1+
# https://github.com/JetBrains/intellij-platform-plugin-template/blob/main/gradle.properties
22

33
pluginGroup = org.nette.latte
44
pluginName = Latte Support
@@ -7,13 +7,11 @@ pluginRepositoryUrl = https://github.com/Rixafy/LatteSupport
77
pluginVersion = 1.6.1
88

99
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
10-
pluginSinceBuild = 222
11-
pluginUntilBuild = 291.*
10+
pluginSinceBuild = 223
1211

1312
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
1413
platformType = PS
1514
platformVersion = 2023.3.3
16-
platformDownloadSources = true
1715

1816
# GrammarKit Properties
1917
jflexRelease = 1.7.0-1
@@ -24,12 +22,14 @@ grammarKitIntelliJRelease = 223.8214.52
2422
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
2523
platformPlugins = com.jetbrains.php:233.11799.232
2624

27-
# Java language level used to compile sources and to generate the files for - Java 11 is required since 2020.3
28-
javaVersion = 17
29-
3025
# Gradle Releases -> https://github.com/gradle/gradle/releases
31-
gradleVersion = 8.7
26+
gradleVersion = 9.0.0
3227

3328
# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
34-
# suppress inspection "UnusedProperty"
3529
kotlin.stdlib.default.dependency = false
30+
31+
# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
32+
org.gradle.configuration-cache = true
33+
34+
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
35+
org.gradle.caching = true

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.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)