Skip to content

Commit 64a66d3

Browse files
98 support idea 20243 (#99)
* Upgrade to gradle 8.5 * Add support for 2024.3 * Prepare for release 3.0.0 * Update klint
1 parent ea301b7 commit 64a66d3

File tree

8 files changed

+102
-52
lines changed

8 files changed

+102
-52
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ jobs:
2626
run: ./gradlew verifyGoogleJavaFormat
2727
- name: Build Plugin
2828
run: ./gradlew buildPlugin
29-
- name: Verify Plugin
30-
run: ./gradlew verifyPlugin
3129
- name: Extract PR number
3230
if: github.event_name == 'pull_request'
3331
run: echo ${{ github.event.number }} > PR_NUMBER.txt

.gitignore

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

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
## [Unreleased]
66
### Added
7-
8-
7+
- Support for IntelliJ 2024.3 EAP (branch number 243)
8+
- Migrate Gradle project to IntelliJ Platform Gradle Plugin (2.x)
9+
- Fix deprecated Kotlin calls
910
## [2.1.0]
1011
### Added
1112
- Support for IntelliJ 2024.2 (branch number 242)

build.gradle.kts

Lines changed: 84 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import io.gitlab.arturbosch.detekt.Detekt
22
import org.jetbrains.changelog.Changelog
33
import org.jetbrains.changelog.markdownToHTML
4+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
45
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
56

67
fun properties(key: String) = project.findProperty(key).toString()
@@ -9,21 +10,22 @@ plugins {
910
// Java support
1011
id("java")
1112
// Kotlin support
12-
id("org.jetbrains.kotlin.jvm") version "2.0.20"
13+
kotlin("jvm") version "2.0.20"
1314
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
14-
id("org.jetbrains.intellij") version "1.17.4"
15+
id("org.jetbrains.intellij.platform") version "2.1.0"
1516
// gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
1617
id("org.jetbrains.changelog") version "2.2.1"
1718
// detekt linter - read more: https://detekt.github.io/detekt/gradle.html
1819
id("io.gitlab.arturbosch.detekt") version "1.23.7"
1920
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
20-
id("org.jlleitschuh.gradle.ktlint") version "11.6.1"
21+
id("org.jlleitschuh.gradle.ktlint") version "12.1.0"
2122
// google-java-format
2223
id("com.github.sherter.google-java-format") version "0.9"
2324
// license header
2425
id("com.github.hierynomus.license") version "0.16.1"
2526
// Sonar support
2627
id("org.sonarqube") version "5.1.0.4882"
28+
// plugin verifier
2729
}
2830

2931
group = properties("pluginGroup")
@@ -32,23 +34,58 @@ version = properties("pluginVersion")
3234
// Configure project's dependencies
3335
repositories {
3436
mavenCentral()
37+
intellijPlatform {
38+
defaultRepositories()
39+
}
3540
}
3641

3742
dependencies {
3843
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.7")
44+
intellijPlatform {
45+
create(properties("platformType"), properties("platformVersion"))
46+
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
47+
}
48+
runtimeOnly("org.jetbrains.intellij.plugins:verifier-cli:1.379")
3949
}
4050

4151
// Configure gradle-intellij-plugin plugin.
42-
// Read more: https://github.com/JetBrains/gradle-intellij-plugin
43-
intellij {
44-
pluginName.set(properties("pluginName"))
45-
version.set(properties("platformVersion"))
46-
type.set(properties("platformType"))
47-
downloadSources.set(properties("platformDownloadSources").toBoolean())
48-
updateSinceUntilBuild.set(true)
49-
50-
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
51-
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
52+
intellijPlatform {
53+
buildSearchableOptions = true
54+
instrumentCode = false
55+
projectName = project.name
56+
pluginConfiguration {
57+
id = "cookiecode-stepbuilder-plugin"
58+
name = "Stepbuilder Codegen"
59+
ideaVersion {
60+
sinceBuild = properties("pluginSinceBuild")
61+
untilBuild = properties("pluginUntilBuild")
62+
}
63+
vendor {
64+
name = "Sebastien Vermeille"
65+
66+
url = "https://cookiecode.dev"
67+
}
68+
}
69+
pluginVerification {
70+
cliPath = file("build/libs/verifier-cli-1.379.jar")
71+
72+
ides {
73+
recommended()
74+
// select {
75+
// types = listOf(IntelliJPlatformType.IntellijIdeaCommunity)
76+
// channels = listOf(ProductRelease.Channel.RELEASE)
77+
// sinceBuild = properties("pluginSinceBuild")
78+
// untilBuild = properties("pluginUntilBuild")
79+
// }
80+
}
81+
}
82+
publishing {
83+
host = "https://plugins.jetbrains.com"
84+
token = System.getenv("PUBLISH_TOKEN")
85+
channels = listOf("default")
86+
ideServices = false
87+
hidden = false
88+
}
5289
}
5390

5491
sonarqube {
@@ -69,14 +106,8 @@ changelog {
69106
// Configure detekt plugin.
70107
// Read more: https://detekt.github.io/detekt/kotlindsl.html
71108
detekt {
72-
config = files("./detekt-config.yml")
109+
config.setFrom(files("./detekt-config.yml"))
73110
buildUponDefaultConfig = true
74-
75-
reports {
76-
html.enabled = false
77-
xml.enabled = false
78-
txt.enabled = false
79-
}
80111
}
81112

82113
googleJavaFormat {
@@ -91,21 +122,29 @@ license {
91122
tasks {
92123
// Set the compatibility versions to 17
93124
withType<JavaCompile> {
94-
sourceCompatibility = "17"
95-
targetCompatibility = "17"
125+
sourceCompatibility = properties("targetJdk")
126+
targetCompatibility = properties("targetJdk")
96127
}
97128
withType<KotlinCompile> {
98-
kotlinOptions.jvmTarget = "17"
129+
compilerOptions {
130+
jvmTarget.set(JvmTarget.JVM_17)
131+
}
99132
}
100133

101134
withType<Detekt> {
102-
jvmTarget = "17"
135+
jvmTarget = properties("targetJdk")
136+
}
137+
138+
withType<Detekt>().configureEach {
139+
reports {
140+
html.required.set(true)
141+
xml.required.set(true)
142+
txt.required.set(false)
143+
}
103144
}
104145

105146
patchPluginXml {
106-
version.set(properties("pluginVersion"))
107-
sinceBuild.set(properties("pluginSinceBuild"))
108-
untilBuild.set(properties("pluginUntilBuild"))
147+
version = properties("pluginVersion")
109148

110149
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
111150
pluginDescription.set(
@@ -117,23 +156,30 @@ tasks {
117156
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
118157
}
119158
subList(indexOf(start) + 1, indexOf(end))
120-
}.joinToString("\n").run { markdownToHTML(this) }
159+
}.joinToString("\n").run {
160+
markdownToHTML(this)
161+
},
121162
)
122163

123164
// Get the latest available change notes from the changelog file
124165
changeNotes.set(provider { changelog.renderItem(changelog.getLatest(), Changelog.OutputType.HTML) })
125166
}
167+
}
126168

127-
runPluginVerifier {
128-
ideVersions.set(properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty))
129-
}
169+
tasks.register<Copy>("downloadVerifierCli") {
170+
val outputDir = layout.buildDirectory.dir("libs").get().asFile
171+
172+
from(
173+
configurations.create("verifierCli").apply {
174+
dependencies.add(
175+
project.dependencies.create("org.jetbrains.intellij.plugins:verifier-cli:1.379"),
176+
)
177+
},
178+
)
179+
180+
into(outputDir)
130181

131-
publishPlugin {
132-
dependsOn("patchChangelog")
133-
token.set(System.getenv("PUBLISH_TOKEN"))
134-
// pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
135-
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
136-
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
137-
channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()))
182+
doLast {
183+
println("Dependency downloaded to: ${outputDir.absolutePath}")
138184
}
139185
}

gradle.properties

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,27 @@
33

44
pluginGroup = com.github.sebastienvermeille.intellijstepbuildercodegenplugin
55
pluginName = intellij-stepbuilder-codegen-plugin
6-
pluginVersion = 2.1.0
6+
pluginVersion = 3.0.0
7+
8+
targetJdk = 17
79

810
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
911
# for insight into build numbers and IntelliJ Platform versions.
10-
pluginSinceBuild = 222
11-
pluginUntilBuild = 242.*
12+
# 243 = 2024.3, 223 = 2022.3 etc.
13+
pluginSinceBuild = 223
14+
pluginUntilBuild = 243.*
1215

1316
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
1417
# See https://jb.gg/intellij-platform-builds-list for available build versions.
15-
pluginVerifierIdeVersions = 2022.2.3, 2023.2, 2023.3, 2024.1, 2024.2
18+
pluginVerifierIdeVersions = 2022.2.3, 2023.2, 2023.3, 2024.1, 2024.2, 2024.3
1619

1720
platformType = IC
18-
platformVersion = 2022.2.3
19-
platformDownloadSources = true
21+
platformVersion = 2022.3
2022

2123
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
2224
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
23-
platformPlugins = com.intellij.java
25+
platformBundledPlugins = com.intellij.java
26+
#platformPlugins =
2427

2528
# Opt-out flag for bundling Kotlin standard library.
2629
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Mon Sep 30 18:22:08 CEST 2024
12
distributionBase=GRADLE_USER_HOME
23
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

src/main/java/com/github/sebastienvermeille/intellijstepbuildercodegenplugin/StepBuilderOptionSelector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
import com.intellij.ui.NonFocusableCheckBox;
2929
import java.util.ArrayList;
3030
import java.util.List;
31-
import javax.annotation.Nullable;
3231
import javax.swing.JCheckBox;
32+
import org.jetbrains.annotations.Nullable;
3333

3434
public final class StepBuilderOptionSelector {
3535
private static final List<SelectorOption> OPTIONS = createGeneratorOptions();

src/main/java/com/github/sebastienvermeille/intellijstepbuildercodegenplugin/StepBuilderUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
import com.intellij.psi.PsiStatement;
3232
import com.intellij.psi.PsiType;
3333
import com.intellij.psi.util.PsiUtil;
34-
import javax.annotation.Nullable;
3534
import org.jetbrains.annotations.NonNls;
3635
import org.jetbrains.annotations.NotNull;
36+
import org.jetbrains.annotations.Nullable;
3737

3838
public final class StepBuilderUtils {
3939
@NonNls static final String JAVA_DOT_LANG = "java.lang.";

0 commit comments

Comments
 (0)