Skip to content

Commit

Permalink
98 support idea 20243 (#99)
Browse files Browse the repository at this point in the history
* Upgrade to gradle 8.5
* Add support for 2024.3
* Prepare for release 3.0.0
* Update klint
  • Loading branch information
sebastienvermeille authored Oct 1, 2024
1 parent ea301b7 commit 64a66d3
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 52 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ jobs:
run: ./gradlew verifyGoogleJavaFormat
- name: Build Plugin
run: ./gradlew buildPlugin
- name: Verify Plugin
run: ./gradlew verifyPlugin
- name: Extract PR number
if: github.event_name == 'pull_request'
run: echo ${{ github.event.number }} > PR_NUMBER.txt
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.gradle
.idea
build
.intellijPlatform
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

## [Unreleased]
### Added


- Support for IntelliJ 2024.3 EAP (branch number 243)
- Migrate Gradle project to IntelliJ Platform Gradle Plugin (2.x)
- Fix deprecated Kotlin calls
## [2.1.0]
### Added
- Support for IntelliJ 2024.2 (branch number 242)
Expand Down
122 changes: 84 additions & 38 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

fun properties(key: String) = project.findProperty(key).toString()
Expand All @@ -9,21 +10,22 @@ plugins {
// Java support
id("java")
// Kotlin support
id("org.jetbrains.kotlin.jvm") version "2.0.20"
kotlin("jvm") version "2.0.20"
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
id("org.jetbrains.intellij") version "1.17.4"
id("org.jetbrains.intellij.platform") version "2.1.0"
// gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
id("org.jetbrains.changelog") version "2.2.1"
// detekt linter - read more: https://detekt.github.io/detekt/gradle.html
id("io.gitlab.arturbosch.detekt") version "1.23.7"
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
id("org.jlleitschuh.gradle.ktlint") version "11.6.1"
id("org.jlleitschuh.gradle.ktlint") version "12.1.0"
// google-java-format
id("com.github.sherter.google-java-format") version "0.9"
// license header
id("com.github.hierynomus.license") version "0.16.1"
// Sonar support
id("org.sonarqube") version "5.1.0.4882"
// plugin verifier
}

group = properties("pluginGroup")
Expand All @@ -32,23 +34,58 @@ version = properties("pluginVersion")
// Configure project's dependencies
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}

dependencies {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.7")
intellijPlatform {
create(properties("platformType"), properties("platformVersion"))
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
}
runtimeOnly("org.jetbrains.intellij.plugins:verifier-cli:1.379")
}

// Configure gradle-intellij-plugin plugin.
// Read more: https://github.com/JetBrains/gradle-intellij-plugin
intellij {
pluginName.set(properties("pluginName"))
version.set(properties("platformVersion"))
type.set(properties("platformType"))
downloadSources.set(properties("platformDownloadSources").toBoolean())
updateSinceUntilBuild.set(true)

// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
intellijPlatform {
buildSearchableOptions = true
instrumentCode = false
projectName = project.name
pluginConfiguration {
id = "cookiecode-stepbuilder-plugin"
name = "Stepbuilder Codegen"
ideaVersion {
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")
}
vendor {
name = "Sebastien Vermeille"
email = "[email protected]"
url = "https://cookiecode.dev"
}
}
pluginVerification {
cliPath = file("build/libs/verifier-cli-1.379.jar")

ides {
recommended()
// select {
// types = listOf(IntelliJPlatformType.IntellijIdeaCommunity)
// channels = listOf(ProductRelease.Channel.RELEASE)
// sinceBuild = properties("pluginSinceBuild")
// untilBuild = properties("pluginUntilBuild")
// }
}
}
publishing {
host = "https://plugins.jetbrains.com"
token = System.getenv("PUBLISH_TOKEN")
channels = listOf("default")
ideServices = false
hidden = false
}
}

sonarqube {
Expand All @@ -69,14 +106,8 @@ changelog {
// Configure detekt plugin.
// Read more: https://detekt.github.io/detekt/kotlindsl.html
detekt {
config = files("./detekt-config.yml")
config.setFrom(files("./detekt-config.yml"))
buildUponDefaultConfig = true

reports {
html.enabled = false
xml.enabled = false
txt.enabled = false
}
}

googleJavaFormat {
Expand All @@ -91,21 +122,29 @@ license {
tasks {
// Set the compatibility versions to 17
withType<JavaCompile> {
sourceCompatibility = "17"
targetCompatibility = "17"
sourceCompatibility = properties("targetJdk")
targetCompatibility = properties("targetJdk")
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

withType<Detekt> {
jvmTarget = "17"
jvmTarget = properties("targetJdk")
}

withType<Detekt>().configureEach {
reports {
html.required.set(true)
xml.required.set(true)
txt.required.set(false)
}
}

patchPluginXml {
version.set(properties("pluginVersion"))
sinceBuild.set(properties("pluginSinceBuild"))
untilBuild.set(properties("pluginUntilBuild"))
version = properties("pluginVersion")

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

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

runPluginVerifier {
ideVersions.set(properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty))
}
tasks.register<Copy>("downloadVerifierCli") {
val outputDir = layout.buildDirectory.dir("libs").get().asFile

from(
configurations.create("verifierCli").apply {
dependencies.add(
project.dependencies.create("org.jetbrains.intellij.plugins:verifier-cli:1.379"),
)
},
)

into(outputDir)

publishPlugin {
dependsOn("patchChangelog")
token.set(System.getenv("PUBLISH_TOKEN"))
// pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()))
doLast {
println("Dependency downloaded to: ${outputDir.absolutePath}")
}
}
17 changes: 10 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,27 @@

pluginGroup = com.github.sebastienvermeille.intellijstepbuildercodegenplugin
pluginName = intellij-stepbuilder-codegen-plugin
pluginVersion = 2.1.0
pluginVersion = 3.0.0

targetJdk = 17

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

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

platformType = IC
platformVersion = 2022.2.3
platformDownloadSources = true
platformVersion = 2022.3

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
platformPlugins = com.intellij.java
platformBundledPlugins = com.intellij.java
#platformPlugins =

# Opt-out flag for bundling Kotlin standard library.
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
Expand Down
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Mon Sep 30 18:22:08 CEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import com.intellij.ui.NonFocusableCheckBox;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import javax.swing.JCheckBox;
import org.jetbrains.annotations.Nullable;

public final class StepBuilderOptionSelector {
private static final List<SelectorOption> OPTIONS = createGeneratorOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
import com.intellij.psi.PsiStatement;
import com.intellij.psi.PsiType;
import com.intellij.psi.util.PsiUtil;
import javax.annotation.Nullable;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

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

0 comments on commit 64a66d3

Please sign in to comment.