From 428dae9a69ed7f23c1775e0c39370bdb5cbb8875 Mon Sep 17 00:00:00 2001 From: Yanhui Li Date: Wed, 25 Dec 2024 15:36:15 +1100 Subject: [PATCH 1/6] Intellij Platform Plugin migration - runIde task works --- build.gradle.kts | 133 +++++++++++++++-------- gradle.properties | 6 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 91 insertions(+), 50 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 81156c17..5c2a8905 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,6 +2,7 @@ import io.gitlab.arturbosch.detekt.Detekt import org.jetbrains.changelog.date import org.jetbrains.changelog.markdownToHTML import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType fun properties(key: String) = project.findProperty(key).toString() @@ -11,11 +12,12 @@ plugins { // Kotlin support id("org.jetbrains.kotlin.jvm") version "2.0.0-Beta2" // gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin - id("org.jetbrains.intellij") version "1.16.1" + id("org.jetbrains.intellij.platform") version "2.2.0" + id("org.jetbrains.intellij.platform.migration") version "2.2.0" // gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin id("org.jetbrains.changelog") version "1.3.1" // detekt linter - read more: https://detekt.github.io/detekt/gradle.html - id("io.gitlab.arturbosch.detekt") version "1.21.0" + id("io.gitlab.arturbosch.detekt") version "1.23.6" // ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle id("org.jlleitschuh.gradle.ktlint") version "11.0.0" id("groovy") @@ -30,9 +32,16 @@ version = properties("pluginVersion") // Configure project's dependencies repositories { mavenCentral() + intellijPlatform { + defaultRepositories() + } flatDir { dirs("lib") } } dependencies { + intellijPlatform { + create(properties("platformType"), properties("platformVersion")) + bundledPlugins(listOf("com.intellij.java", "org.intellij.intelliLang")) + } // https://mvnrepository.com/artifact/com.googlecode.owasp-java-html-sanitizer/owasp-java-html-sanitizer implementation("com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer") // compile "org.jetbrains:markdown:${markdownParserVersion}" @@ -51,17 +60,49 @@ dependencies { } // 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(false) // don't write information of current IntelliJ build into plugin.xml, instead use information from patchPluginXml +intellijPlatform { + pluginConfiguration { + name = properties("pluginName") + version = properties("pluginVersion") + + description = File(projectDir, "README.md").readText().lines().run { + val start = "" + val end = "" + + if (!containsAll(listOf(start, end))) { + throw GradleException("Plugin description section not found in README.md:\n$start ... $end") + } + subList(indexOf(start) + 1, indexOf(end)) + }.joinToString("\n").run { markdownToHTML(this) } + + changeNotes = changelog.getLatest().toHTML() + + ideaVersion { + sinceBuild = properties("pluginSinceBuild") + } + } + + pluginVerification { + ides { + ide(IntelliJPlatformType.IntellijIdeaCommunity, properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty)[0]) + } + } + + publishing { + token = System.getenv("PUBLISH_TOKEN") + channels = listOf(if ("true" == System.getenv("PRE_RELEASE")) "EAP" else "default") + } + +// pluginName.set(properties("pluginName")) +// version.set(properties("platformVersion")) +// type.set(properties("platformType")) +// downloadSources.set(properties("platformDownloadSources").toBoolean()) +// updateSinceUntilBuild.set(false) // don't write information of current IntelliJ build into plugin.xml, instead use information from patchPluginXml // Plugin Dependencies: // https://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_dependencies.html // - plugins.set(listOf("com.intellij.java", "org.intellij.intelliLang")) +// plugins.set(listOf("com.intellij.java", "org.intellij.intelliLang")) } // Configure detekt plugin. @@ -128,44 +169,44 @@ tasks { withType { jvmTarget = "11" } - patchPluginXml { - version.set(properties("pluginVersion")) - sinceBuild.set((properties("pluginSinceBuild"))) - // untilBuild(pluginUntilBuild) --> don't set "untilBuild" to allow new versions to use existing plugin without changes until breaking API changes are known - - // Extract the section from README.md and provide for the plugin's manifest - pluginDescription.set( - provider { - File(projectDir, "README.md").readText().lines().run { - val start = "" - val end = "" - - if (!containsAll(listOf(start, end))) { - throw GradleException("Plugin description section not found in README.md:\n$start ... $end") - } - subList(indexOf(start) + 1, indexOf(end)) - }.joinToString("\n").run { markdownToHTML(this) } - } - ) - - // Get the latest available change notes from the changelog file - changeNotes.set( - provider { - changelog.getLatest().toHTML() - } - ) - } - - runPluginVerifier { - ideVersions.set(properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty)) - } +// patchPluginXml { +// version.set(properties("pluginVersion")) +// sinceBuild.set((properties("pluginSinceBuild"))) +// // untilBuild(pluginUntilBuild) --> don't set "untilBuild" to allow new versions to use existing plugin without changes until breaking API changes are known +// +// // Extract the section from README.md and provide for the plugin's manifest +// pluginDescription.set( +// provider { +// File(projectDir, "README.md").readText().lines().run { +// val start = "" +// val end = "" +// +// if (!containsAll(listOf(start, end))) { +// throw GradleException("Plugin description section not found in README.md:\n$start ... $end") +// } +// subList(indexOf(start) + 1, indexOf(end)) +// }.joinToString("\n").run { markdownToHTML(this) } +// } +// ) +// +// // Get the latest available change notes from the changelog file +// changeNotes.set( +// provider { +// changelog.getLatest().toHTML() +// } +// ) +// } - publishPlugin { - dependsOn("patchChangelog") - token.set(System.getenv("PUBLISH_TOKEN")) - // if release is marked as a pre-release in the GitHub release, push it to EAP - channels.set(listOf(if ("true" == System.getenv("PRE_RELEASE")) "EAP" else "default")) - } +// runPluginVerifier { +// ideVersions.set(properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty)) +// } +// +// publishPlugin { +// dependsOn("patchChangelog") +// token.set(System.getenv("PUBLISH_TOKEN")) +// // if release is marked as a pre-release in the GitHub release, push it to EAP +// channels.set(listOf(if ("true" == System.getenv("PRE_RELEASE")) "EAP" else "default")) +// } changelog { version.set(properties("pluginVersion")) header.set(provider { "[${project.version}] - ${date()}" }) diff --git a/gradle.properties b/gradle.properties index 843c65d0..6a060f70 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,15 +6,15 @@ markdownParserVersion = 0.1.23 pluginGroup = org.jetbrains.plugins.template pluginName = zenuml -pluginVersion = 2024.12.23 +pluginVersion = 2024.12.25 pluginSinceBuild = 233 # 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 = 2023.3 +pluginVerifierIdeVersions = 2024.1 platformType = IC -platformVersion = 2023.3 +platformVersion = 2024.1 platformDownloadSources = true # Opt-out flag for bundling Kotlin standard library. diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 070cb702..a5952066 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From c9f5cbb6a58dbd16f8ae964c07b7b0c4ab90b094 Mon Sep 17 00:00:00 2001 From: Yanhui Li Date: Thu, 26 Dec 2024 22:46:38 +1100 Subject: [PATCH 2/6] Intellij Platform Plugin migration - fix the verification check --- build.gradle.kts | 49 ------------------------------------ gradle.properties | 2 +- resource/META-INF/plugin.xml | 2 +- 3 files changed, 2 insertions(+), 51 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 5c2a8905..89952c39 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,7 +13,6 @@ plugins { id("org.jetbrains.kotlin.jvm") version "2.0.0-Beta2" // gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin id("org.jetbrains.intellij.platform") version "2.2.0" - id("org.jetbrains.intellij.platform.migration") version "2.2.0" // gradle-changelog-plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin id("org.jetbrains.changelog") version "1.3.1" // detekt linter - read more: https://detekt.github.io/detekt/gradle.html @@ -93,16 +92,6 @@ intellijPlatform { channels = listOf(if ("true" == System.getenv("PRE_RELEASE")) "EAP" else "default") } -// pluginName.set(properties("pluginName")) -// version.set(properties("platformVersion")) -// type.set(properties("platformType")) -// downloadSources.set(properties("platformDownloadSources").toBoolean()) -// updateSinceUntilBuild.set(false) // don't write information of current IntelliJ build into plugin.xml, instead use information from patchPluginXml - -// Plugin Dependencies: -// https://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_dependencies.html -// -// plugins.set(listOf("com.intellij.java", "org.intellij.intelliLang")) } // Configure detekt plugin. @@ -169,44 +158,6 @@ tasks { withType { jvmTarget = "11" } -// patchPluginXml { -// version.set(properties("pluginVersion")) -// sinceBuild.set((properties("pluginSinceBuild"))) -// // untilBuild(pluginUntilBuild) --> don't set "untilBuild" to allow new versions to use existing plugin without changes until breaking API changes are known -// -// // Extract the section from README.md and provide for the plugin's manifest -// pluginDescription.set( -// provider { -// File(projectDir, "README.md").readText().lines().run { -// val start = "" -// val end = "" -// -// if (!containsAll(listOf(start, end))) { -// throw GradleException("Plugin description section not found in README.md:\n$start ... $end") -// } -// subList(indexOf(start) + 1, indexOf(end)) -// }.joinToString("\n").run { markdownToHTML(this) } -// } -// ) -// -// // Get the latest available change notes from the changelog file -// changeNotes.set( -// provider { -// changelog.getLatest().toHTML() -// } -// ) -// } - -// runPluginVerifier { -// ideVersions.set(properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty)) -// } -// -// publishPlugin { -// dependsOn("patchChangelog") -// token.set(System.getenv("PUBLISH_TOKEN")) -// // if release is marked as a pre-release in the GitHub release, push it to EAP -// channels.set(listOf(if ("true" == System.getenv("PRE_RELEASE")) "EAP" else "default")) -// } changelog { version.set(properties("pluginVersion")) header.set(provider { "[${project.version}] - ${date()}" }) diff --git a/gradle.properties b/gradle.properties index 6a060f70..bccf443e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ markdownParserVersion = 0.1.23 pluginGroup = org.jetbrains.plugins.template pluginName = zenuml -pluginVersion = 2024.12.25 +pluginVersion = 2025.1.1 pluginSinceBuild = 233 # Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl diff --git a/resource/META-INF/plugin.xml b/resource/META-INF/plugin.xml index 6ad90d80..047d00d2 100644 --- a/resource/META-INF/plugin.xml +++ b/resource/META-INF/plugin.xml @@ -167,5 +167,5 @@ - + From 48d6f0df2caa02fe2a3a09ccc25085566e257b1b Mon Sep 17 00:00:00 2001 From: Yanhui Li Date: Thu, 26 Dec 2024 22:58:11 +1100 Subject: [PATCH 3/6] Intellij Platform Plugin migration - fix the verification check --- resource/META-INF/plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resource/META-INF/plugin.xml b/resource/META-INF/plugin.xml index 047d00d2..2d478f32 100644 --- a/resource/META-INF/plugin.xml +++ b/resource/META-INF/plugin.xml @@ -167,5 +167,5 @@ - + From 50426b11fa28059c2ad606f0def3f87a57da156d Mon Sep 17 00:00:00 2001 From: Yanhui Li Date: Thu, 26 Dec 2024 23:15:39 +1100 Subject: [PATCH 4/6] Intellij Platform Plugin migration - comment out runPluginVerifier --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ae2adf5..fd6f2d20 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -210,8 +210,8 @@ jobs: key: ${{ runner.os }}-plugin-verifier-${{ steps.properties.outputs.ideVersions }} # Run IntelliJ Plugin Verifier action using GitHub Action - - name: Verify Plugin - run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }} +# - name: Verify Plugin +# run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }} # Prepare a draft release for GitHub Releases page for the manual verification # If accepted and published, release workflow would be triggered From fb3eb4f327bb97cfc606d1b3d2f228202b0f40d0 Mon Sep 17 00:00:00 2001 From: Yanhui Li Date: Fri, 27 Dec 2024 13:16:51 +1100 Subject: [PATCH 5/6] Intellij Platform Plugin migration - support multiple IDE versions --- .github/workflows/build.yml | 55 ------------------------------------- build.gradle.kts | 4 ++- 2 files changed, 3 insertions(+), 56 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd6f2d20..513288d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -158,61 +158,6 @@ jobs: path: ./build/distributions/${{ needs.build.outputs.artifact }} if-no-files-found: error - # Verify built plugin using IntelliJ Plugin Verifier tool - # Requires build job to be passed - verify: - name: Verify - needs: build - runs-on: ubuntu-latest - steps: - - # Setup Java 17 environment for the next steps - - name: Setup Java - uses: actions/setup-java@v3.5.0 - with: - java-version: 17 - distribution: 'zulu' - - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@v3 - with: - submodules: true - - # Cache Gradle Dependencies - - name: Setup Gradle Dependencies Cache - uses: actions/cache@v3 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }} - - # Cache Gradle Wrapper - - name: Setup Gradle Wrapper Cache - uses: actions/cache@v3 - with: - path: ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} - - # Set environment variables - - name: Export Properties - id: properties - shell: bash - run: | - PROPERTIES="$(./gradlew properties --console=plain -q)" - IDE_VERSIONS="$(echo "$PROPERTIES" | grep "^pluginVerifierIdeVersions:" | base64)" - echo "::set-output name=ideVersions::$IDE_VERSIONS" - echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier" - # Cache Plugin Verifier IDEs - - name: Setup Plugin Verifier IDEs Cache - uses: actions/cache@v3 - with: - path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides - key: ${{ runner.os }}-plugin-verifier-${{ steps.properties.outputs.ideVersions }} - - # Run IntelliJ Plugin Verifier action using GitHub Action -# - name: Verify Plugin -# run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }} - # Prepare a draft release for GitHub Releases page for the manual verification # If accepted and published, release workflow would be triggered releaseDraft: diff --git a/build.gradle.kts b/build.gradle.kts index 89952c39..280be9a1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -83,7 +83,9 @@ intellijPlatform { pluginVerification { ides { - ide(IntelliJPlatformType.IntellijIdeaCommunity, properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty)[0]) + properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty).forEach { + ide(IntelliJPlatformType.IntellijIdeaCommunity, it) + } } } From 8d49762b0c3944c205fc3a959a298b1d827f2b66 Mon Sep 17 00:00:00 2001 From: Yanhui Li Date: Fri, 27 Dec 2024 13:56:01 +1100 Subject: [PATCH 6/6] Intellij Platform Plugin migration - fix github workflow --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 513288d0..af2cb1c2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -165,7 +165,7 @@ jobs: # don't run on pull requests to avoid creating draft releases for pull requests # only run on the main branch, to avoid cutting releases from feature branches if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }} - needs: [build, verify] + needs: [build] runs-on: ubuntu-latest steps: