From f85291fba3751ba8529cc251f9c30716e4c4d757 Mon Sep 17 00:00:00 2001 From: Ilya Siamionau Date: Mon, 20 Jan 2025 16:19:22 +0100 Subject: [PATCH 1/4] CM-43972 - Add support for IDEs 2025.1 --- CHANGELOG.md | 8 +++++++- gradle.properties | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a98071..0534cf8 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ## [Unreleased] +## [2.4.0] - 2025-01-20 + +- Add support for IDEs 2025.1 + ## [2.3.0] - 2024-12-20 - Add the "Ignore this violation" button for violation card of SCA @@ -135,6 +139,8 @@ The first public release of the plugin. +[2.4.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v2.4.0 + [2.3.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v2.3.0 [2.2.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v2.2.0 @@ -189,4 +195,4 @@ The first public release of the plugin. [1.0.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v1.0.0 -[Unreleased]: https://github.com/cycodehq/intellij-platform-plugin/compare/v2.3.0...HEAD +[Unreleased]: https://github.com/cycodehq/intellij-platform-plugin/compare/v2.4.0...HEAD diff --git a/gradle.properties b/gradle.properties index d523ae0..c0fdbe4 100755 --- a/gradle.properties +++ b/gradle.properties @@ -4,11 +4,11 @@ pluginGroup = com.cycode.plugin pluginName = Cycode pluginRepositoryUrl = https://github.com/cycodehq/intellij-platform-plugin # SemVer format -> https://semver.org -pluginVersion = 2.3.0 +pluginVersion = 2.4.0 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 231 -pluginUntilBuild = 243.* +pluginUntilBuild = 251.* # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension platformType = IC From 5d619a302381db249189f6096b19f121ab693aef Mon Sep 17 00:00:00 2001 From: Ilya Siamionau Date: Wed, 29 Jan 2025 14:42:17 +0100 Subject: [PATCH 2/4] CM-43972 - Fix usage of internal API in 2025.1 --- CHANGELOG.md | 8 +++++++- gradle.properties | 2 +- .../plugin/sentry/SentryErrorReporter.kt | 20 ++++++++++++------- .../com/cycode/plugin/sentry/SentryInit.kt | 12 +++++------ 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0534cf8..12d57e6 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ## [Unreleased] +## [2.4.1] - 2025-01-29 + +- Fix usage of internal API in 2025.1 + ## [2.4.0] - 2025-01-20 - Add support for IDEs 2025.1 @@ -139,6 +143,8 @@ The first public release of the plugin. +[2.4.1]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v2.4.1 + [2.4.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v2.4.0 [2.3.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v2.3.0 @@ -195,4 +201,4 @@ The first public release of the plugin. [1.0.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v1.0.0 -[Unreleased]: https://github.com/cycodehq/intellij-platform-plugin/compare/v2.4.0...HEAD +[Unreleased]: https://github.com/cycodehq/intellij-platform-plugin/compare/v2.4.1...HEAD diff --git a/gradle.properties b/gradle.properties index c0fdbe4..164585f 100755 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ pluginGroup = com.cycode.plugin pluginName = Cycode pluginRepositoryUrl = https://github.com/cycodehq/intellij-platform-plugin # SemVer format -> https://semver.org -pluginVersion = 2.4.0 +pluginVersion = 2.4.1 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 231 diff --git a/src/main/kotlin/com/cycode/plugin/sentry/SentryErrorReporter.kt b/src/main/kotlin/com/cycode/plugin/sentry/SentryErrorReporter.kt index b5d6257..a11c005 100644 --- a/src/main/kotlin/com/cycode/plugin/sentry/SentryErrorReporter.kt +++ b/src/main/kotlin/com/cycode/plugin/sentry/SentryErrorReporter.kt @@ -2,7 +2,6 @@ package com.cycode.plugin.sentry import com.cycode.plugin.Consts import com.cycode.plugin.CycodeBundle -import com.intellij.diagnostic.IdeaReportingEvent import com.intellij.ide.DataManager import com.intellij.idea.IdeaLogger import com.intellij.openapi.actionSystem.CommonDataKeys @@ -18,8 +17,16 @@ import io.sentry.Sentry import io.sentry.SentryEvent import io.sentry.SentryLevel import java.awt.Component +import java.io.PrintWriter +import java.io.StringWriter +fun getStackTraceAsString(throwable: Throwable): String { + val sw = StringWriter() + throwable.printStackTrace(PrintWriter(sw)) + return sw.toString() +} + class SentryErrorReporter : ErrorReportSubmitter() { override fun getReportActionText(): String { return CycodeBundle.message("reportActionButton") @@ -38,20 +45,19 @@ class SentryErrorReporter : ErrorReportSubmitter() { object : Task.Backgroundable(project, CycodeBundle.message("sentryReporting"), false) { override fun run(indicator: ProgressIndicator) { for (ideaEvent in events) { - if (ideaEvent !is IdeaReportingEvent) { - continue - } - val event = SentryEvent() event.level = SentryLevel.ERROR event.release = Consts.SENTRY_RELEASE - event.throwable = ideaEvent.data.throwable + event.throwable = ideaEvent.throwable event.serverName = "" event.extras = mapOf( - "message" to ideaEvent.data.message, + "message" to ideaEvent.message, "additional_info" to additionalInfo, "last_action" to IdeaLogger.ourLastActionId, + // before 2025.1 it will contain more useful information + // since 2025.1 throwable is close to the original + "stacktrace" to getStackTraceAsString(ideaEvent.throwable) ) Sentry.captureEvent(event) diff --git a/src/main/kotlin/com/cycode/plugin/sentry/SentryInit.kt b/src/main/kotlin/com/cycode/plugin/sentry/SentryInit.kt index e27a16b..48e58f7 100644 --- a/src/main/kotlin/com/cycode/plugin/sentry/SentryInit.kt +++ b/src/main/kotlin/com/cycode/plugin/sentry/SentryInit.kt @@ -27,13 +27,11 @@ object SentryInit { } fun setupScope(userId: String, tenantId: String) { - Sentry.configureScope { scope -> - scope.setTag("tenant_id", tenantId) - scope.user = User().apply { - id = userId - data = mapOf("tenant_id" to tenantId) - } - } + Sentry.setTag("tenant_id", tenantId) + Sentry.setUser(User().apply { + id = userId + data = mapOf("tenant_id" to tenantId) + }) } private fun isSentryDisabled(): Boolean { From 63887f86030403714eec8b4be6d840a3a5095fc3 Mon Sep 17 00:00:00 2001 From: Ilya Siamionau Date: Wed, 29 Jan 2025 14:46:36 +0100 Subject: [PATCH 3/4] allow gradle connections --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 14a57aa..bc9af78 100755 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -157,6 +157,7 @@ jobs: plugins.jetbrains.com raw.githubusercontent.com teamcity.jetbrains.com + downloads.gradle.org - name: Maximize Build Space run: | From de5207ddf0687df7325f006360ff8419a4037aeb Mon Sep 17 00:00:00 2001 From: Ilya Siamionau Date: Wed, 29 Jan 2025 14:51:07 +0100 Subject: [PATCH 4/4] bump gradle actions for workflow --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc9af78..41b8eaf 100755 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,6 +32,7 @@ jobs: plugins.gradle.org teamcity.jetbrains.com www.jetbrains.com + downloads.gradle.org - name: Maximize Build Space run: | @@ -44,7 +45,7 @@ jobs: uses: actions/checkout@v4 - name: Gradle Wrapper Validation - uses: gradle/wrapper-validation-action@v1.1.0 + uses: gradle/actions/wrapper-validation@v3 - name: Setup Java uses: actions/setup-java@v3 @@ -53,7 +54,7 @@ jobs: java-version: 17 - name: Setup Gradle - uses: gradle/gradle-build-action@v2.9.0 + uses: gradle/actions/setup-gradle@v3 with: gradle-home-cache-cleanup: true @@ -157,7 +158,6 @@ jobs: plugins.jetbrains.com raw.githubusercontent.com teamcity.jetbrains.com - downloads.gradle.org - name: Maximize Build Space run: | @@ -190,7 +190,7 @@ jobs: java-version: 17 - name: Setup Gradle - uses: gradle/gradle-build-action@v2.9.0 + uses: gradle/actions/setup-gradle@v3 with: gradle-home-cache-cleanup: true