From bfb1a45ae5937224c7a9c5e360a2aa32a2160642 Mon Sep 17 00:00:00 2001 From: Frederik Haselmeier Date: Thu, 26 Feb 2026 10:21:09 +0100 Subject: [PATCH] Revert "[Kotlin] [KTIJ-34626] Add in-IDE Kotlin Maven build satisfaction survey" This reverts commit 52e96236 and f6ec96cdd7a50d6678b74024780398e6c8cd6425 Done as part of KTIJ-37724 because the feature is not ready for the 261 release ^KTIJ-37724 fixed (cherry picked from commit e0d8d8958de8204e516c2f152332d3c048a28354) GitOrigin-RevId: 39bc2ae10e96faa3abbd252217253d78aad48b11 --- .idea/modules.xml | 1 - build/bazel-generated-file-list.txt | 1 - .../build/kotlin/KotlinPluginBuilder.kt | 1 - plugins/kotlin/BUILD.bazel | 1 - .../intellij.kotlin.plugin.community.main.iml | 1 - plugins/kotlin/onboarding-maven/BUILD.bazel | 39 ---- .../intellij.kotlin.onboarding.maven.iml | 53 ----- .../intellij.kotlin.onboarding.maven.xml | 26 --- .../messages/MavenFeedbackBundle.properties | 33 --- .../MavenBuildProcessSatisfactionDialog.kt | 189 ------------------ .../MavenBuildProcessSatisfactionListener.kt | 20 -- .../MavenBuildProcessSatisfactionSurvey.kt | 12 -- ...venBuildProcessSatisfactionSurveyConfig.kt | 46 ----- ...avenBuildProcessSatisfactionSurveyStore.kt | 111 ---------- .../onboarding/maven/MavenFeedbackBundle.kt | 14 -- ...venBuildProcessSatisfactionDialogAction.kt | 12 -- plugins/kotlin/plugin/k1/BUILD.bazel | 1 - plugins/kotlin/plugin/k1/kotlin.plugin.k1.iml | 1 - .../plugin/k1/resources/kotlin.plugin.k1.xml | 1 - plugins/kotlin/plugin/k2/BUILD.bazel | 1 - plugins/kotlin/plugin/k2/kotlin.plugin.k2.iml | 1 - .../plugin/k2/resources/kotlin.plugin.k2.xml | 1 - plugins/kotlin/plugin/plugin-content.yaml | 1 - 23 files changed, 567 deletions(-) delete mode 100644 plugins/kotlin/onboarding-maven/BUILD.bazel delete mode 100644 plugins/kotlin/onboarding-maven/intellij.kotlin.onboarding.maven.iml delete mode 100644 plugins/kotlin/onboarding-maven/resources/intellij.kotlin.onboarding.maven.xml delete mode 100644 plugins/kotlin/onboarding-maven/resources/messages/MavenFeedbackBundle.properties delete mode 100644 plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionDialog.kt delete mode 100644 plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionListener.kt delete mode 100644 plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionSurvey.kt delete mode 100644 plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionSurveyConfig.kt delete mode 100644 plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionSurveyStore.kt delete mode 100644 plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenFeedbackBundle.kt delete mode 100644 plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/ShowMavenBuildProcessSatisfactionDialogAction.kt diff --git a/.idea/modules.xml b/.idea/modules.xml index d7e1342b8808..5d191625a125 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -804,7 +804,6 @@ - diff --git a/build/bazel-generated-file-list.txt b/build/bazel-generated-file-list.txt index bfd892ac41bd..13ff119e36fb 100644 --- a/build/bazel-generated-file-list.txt +++ b/build/bazel-generated-file-list.txt @@ -1318,7 +1318,6 @@ plugins/kotlin/navigation plugins/kotlin/navigation/tests plugins/kotlin/onboarding plugins/kotlin/onboarding-gradle -plugins/kotlin/onboarding-maven plugins/kotlin/onboarding-promoter plugins/kotlin/plugin plugins/kotlin/plugin-updater diff --git a/platform/build-scripts/src/org/jetbrains/intellij/build/kotlin/KotlinPluginBuilder.kt b/platform/build-scripts/src/org/jetbrains/intellij/build/kotlin/KotlinPluginBuilder.kt index 65a916acc501..06d43e4280d5 100644 --- a/platform/build-scripts/src/org/jetbrains/intellij/build/kotlin/KotlinPluginBuilder.kt +++ b/platform/build-scripts/src/org/jetbrains/intellij/build/kotlin/KotlinPluginBuilder.kt @@ -140,7 +140,6 @@ abstract class KotlinPluginBuilder(val kind : KotlinPluginKind = System.getPrope "intellij.kotlin.j2k", "intellij.kotlin.onboarding", "intellij.kotlin.onboarding.gradle", - "intellij.kotlin.onboarding.maven", "intellij.kotlin.plugin.updater", "intellij.kotlin.preferences", "intellij.kotlin.projectConfiguration", diff --git a/plugins/kotlin/BUILD.bazel b/plugins/kotlin/BUILD.bazel index 8bf70fd26efa..3f0f0dfd3574 100644 --- a/plugins/kotlin/BUILD.bazel +++ b/plugins/kotlin/BUILD.bazel @@ -428,7 +428,6 @@ jvm_library( "//plugins/kotlin/bundled-compiler-plugins-support:compilerPlugins-support-bundled", "//plugins/kotlin/onboarding", "//plugins/kotlin/onboarding-gradle", - "//plugins/kotlin/onboarding-maven", "//plugins/kotlin/base/code-insight/minimal", "//plugins/kotlin/highlighting/highlighting-minimal:kotlin-highlighting-minimal", "//plugins/kotlin/formatter/minimal", diff --git a/plugins/kotlin/intellij.kotlin.plugin.community.main.iml b/plugins/kotlin/intellij.kotlin.plugin.community.main.iml index 0ab1887f82e1..5dd3d014ba01 100644 --- a/plugins/kotlin/intellij.kotlin.plugin.community.main.iml +++ b/plugins/kotlin/intellij.kotlin.plugin.community.main.iml @@ -215,7 +215,6 @@ - diff --git a/plugins/kotlin/onboarding-maven/BUILD.bazel b/plugins/kotlin/onboarding-maven/BUILD.bazel deleted file mode 100644 index eb7a38927ef6..000000000000 --- a/plugins/kotlin/onboarding-maven/BUILD.bazel +++ /dev/null @@ -1,39 +0,0 @@ -### auto-generated section `build intellij.kotlin.onboarding.maven` start -load("@rules_jvm//:jvm.bzl", "jvm_library", "resourcegroup") - -resourcegroup( - name = "onboarding-maven_resources", - srcs = glob(["resources/**/*"]), - strip_prefix = "resources" -) - -jvm_library( - name = "onboarding-maven", - module_name = "intellij.kotlin.onboarding.maven", - visibility = ["//visibility:public"], - srcs = glob(["src/**/*.kt", "src/**/*.java", "src/**/*.form"], allow_empty = True), - resources = [":onboarding-maven_resources"], - deps = [ - "@lib//:kotlin-stdlib", - "@lib//:kotlinc-kotlin-compiler-common", - "//platform/core-api:core", - "//platform/editor-ui-api:editor-ui", - "//platform/projectModel-api:projectModel", - "//platform/statistics", - "//platform/analysis-api:analysis", - "//platform/feedback", - "//platform/platform-api:ide", - "//platform/platform-impl:ide-impl", - "//plugins/kotlin/base/plugin", - "//libraries/kotlinx/datetime", - "//libraries/kotlinx/serialization/core", - "//libraries/kotlinx/serialization/json", - "//plugins/kotlin/project-configuration", - "//plugins/kotlin/base/facet", - "//plugins/kotlin/base/resources:kotlin-base-resources", - "//plugins/kotlin/onboarding", - "//plugins/maven", - "//platform/external-system-api:externalSystem", - ] -) -### auto-generated section `build intellij.kotlin.onboarding.maven` end \ No newline at end of file diff --git a/plugins/kotlin/onboarding-maven/intellij.kotlin.onboarding.maven.iml b/plugins/kotlin/onboarding-maven/intellij.kotlin.onboarding.maven.iml deleted file mode 100644 index e9064d68bb40..000000000000 --- a/plugins/kotlin/onboarding-maven/intellij.kotlin.onboarding.maven.iml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - $KOTLIN_BUNDLED$/lib/kotlinx-serialization-compiler-plugin.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/plugins/kotlin/onboarding-maven/resources/intellij.kotlin.onboarding.maven.xml b/plugins/kotlin/onboarding-maven/resources/intellij.kotlin.onboarding.maven.xml deleted file mode 100644 index 3bac0a6d0256..000000000000 --- a/plugins/kotlin/onboarding-maven/resources/intellij.kotlin.onboarding.maven.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - messages.MavenFeedbackBundle - - - - - - - - - - - - - - diff --git a/plugins/kotlin/onboarding-maven/resources/messages/MavenFeedbackBundle.properties b/plugins/kotlin/onboarding-maven/resources/messages/MavenFeedbackBundle.properties deleted file mode 100644 index 79875b9b3356..000000000000 --- a/plugins/kotlin/onboarding-maven/resources/messages/MavenFeedbackBundle.properties +++ /dev/null @@ -1,33 +0,0 @@ -dialog.top.title=Feedback -dialog.title=Kotlin Feedback -dialog.description=You have been using Kotlin recently, share your feedback with us. -notification.thanks.feedback.content=You are helping improve the Kotlin plugin! - -notification.request.title=Share feedback about the Kotlin plugin -notification.request.content=Please answer a few questions. It will take about 2 minutes. - -build.process.maven.satisfaction.request.title=Maven feedback -build.process.maven.satisfaction.request.content=Please answer a few questions. It will take about 2 minutes. - -dialog.build.process.maven.satisfaction.top.title=Feedback -dialog.build.process.maven.satisfaction.title=Maven feedback -dialog.build.process.maven.satisfaction.description=You have been using the Maven build system recently, share your feedback with us. - -dialog.build.process.maven.satisfaction.rating.label=How do you feel about your experience with the Maven build system in {0}? -dialog.build.process.maven.satisfaction.improve.label=How can your experience be improved? - -dialog.build.process.maven.satisfaction.feedback.content=You are helping improve the Kotlin Maven experience! - -dialog.rating.leftHint=Very dissatisfied -dialog.rating.middleHint=Neutral -dialog.rating.rightHint=Very satisfied - -build.process.info.maven.version=Maven version: -build.process.info.kotlin.version=Kotlin version: -build.process.info.pom.file.count=Number of POM files: -build.process.info.days.of.kotlin.usage=Days of Kotlin usage: -build.process.info.days.of.kotlin.maven.usage=Days of Kotlin with Maven usage: -build.process.info.days.of.maven.usage=Days of Maven usage: -build.process.info.days.of.idea.usage=Days of IntelliJ IDEA usage: - -action.org.jetbrains.kotlin.onboarding.maven.ShowMavenBuildProcessSatisfactionDialogAction.text=Show Kotlin Maven Build Process Satisfaction Survey diff --git a/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionDialog.kt b/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionDialog.kt deleted file mode 100644 index eedb3032fee6..000000000000 --- a/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionDialog.kt +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package org.jetbrains.kotlin.onboarding.maven - -import com.intellij.icons.AllIcons -import com.intellij.openapi.application.ApplicationInfo -import com.intellij.openapi.application.EDT -import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil -import com.intellij.openapi.project.Project -import com.intellij.openapi.project.modules -import com.intellij.openapi.util.NlsSafe -import com.intellij.openapi.util.io.toNioPathOrNull -import com.intellij.openapi.vfs.VirtualFileManager -import com.intellij.platform.feedback.dialog.BlockBasedFeedbackDialogWithEmail -import com.intellij.platform.feedback.dialog.CommonFeedbackSystemData -import com.intellij.platform.feedback.dialog.SystemDataJsonSerializable -import com.intellij.platform.feedback.dialog.showFeedbackSystemInfoDialog -import com.intellij.platform.feedback.dialog.uiBlocks.DescriptionBlock -import com.intellij.platform.feedback.dialog.uiBlocks.FeedbackBlock -import com.intellij.platform.feedback.dialog.uiBlocks.SegmentedButtonBlock -import com.intellij.platform.feedback.dialog.uiBlocks.TextAreaBlock -import com.intellij.platform.feedback.dialog.uiBlocks.TopLabelBlock -import com.intellij.platform.feedback.impl.notification.ThanksForFeedbackNotification -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.withContext -import kotlinx.serialization.Serializable -import kotlinx.serialization.json.Json -import kotlinx.serialization.json.JsonElement -import kotlinx.serialization.json.encodeToJsonElement -import org.jetbrains.idea.maven.project.MavenProjectsManager -import org.jetbrains.idea.maven.server.MavenDistributionsCache -import org.jetbrains.kotlin.onboarding.KotlinNewUserTracker -import java.time.LocalDate -import java.time.temporal.ChronoUnit -import kotlin.io.path.div - -private const val KOTLIN_MAVEN_PLUGIN_GROUP_ID = "org.jetbrains.kotlin" -private const val KOTLIN_MAVEN_PLUGIN_ARTIFACT_ID = "kotlin-maven-plugin" - -@Serializable -internal data class MavenBuildProcessSatisfactionDialogData( - @NlsSafe val mavenVersion: String, - @NlsSafe val kotlinVersion: String, - val pomFileCount: Int, - val daysOfIdeaUsage: Int, - val daysOfKotlinUsage: Int, - val daysOfKotlinWithMavenUsage: Int, - val daysOfMavenUsage: Int, - val commonData: CommonFeedbackSystemData -) : SystemDataJsonSerializable { - override fun serializeToJson(json: Json): JsonElement = json.encodeToJsonElement(this) -} - -internal class MavenBuildProcessSatisfactionDialog( - private val project: Project, - forTest: Boolean -) : BlockBasedFeedbackDialogWithEmail(project, forTest) { - /** Increase the additional number when feedback format is changed */ - override val myFeedbackJsonVersion: Int = super.myFeedbackJsonVersion + 1 - - private fun getMavenVersion(): String? { - val mavenProjectsManager = MavenProjectsManager.getInstance(project) - val firstMavenProject = mavenProjectsManager.projects.firstOrNull() ?: return null - val pomPath = firstMavenProject.file.parent?.path ?: return null - return try { - MavenDistributionsCache.getInstance(project).getMavenDistribution(pomPath).version - } catch (_: Exception) { - null - } - } - - private fun getKotlinVersions(): List { - val mavenProjectsManager = MavenProjectsManager.getInstance(project) - return mavenProjectsManager.projects - .mapNotNull { mavenProject -> - mavenProject.findPlugin(KOTLIN_MAVEN_PLUGIN_GROUP_ID, KOTLIN_MAVEN_PLUGIN_ARTIFACT_ID)?.version - } - .distinct() - } - - private fun LocalDate.daysSinceDate(): Int { - return ChronoUnit.DAYS.between(this, LocalDate.now()).toInt() - } - - private fun collectData(): MavenBuildProcessSatisfactionDialogData { - val allExternalModulePaths = project.modules.mapNotNullTo(mutableSetOf()) { - ExternalSystemApiUtil.getExternalProjectPath(it)?.toNioPathOrNull() - } - - fun countExistingFiles(filename: String): Int { - return allExternalModulePaths.count { path -> - VirtualFileManager.getInstance().findFileByNioPath(path / filename) != null - } - } - - val pomCount = countExistingFiles("pom.xml") - val mavenVersion = getMavenVersion() ?: "UNKNOWN" - val kotlinVersion = getKotlinVersions().maxOrNull() ?: "UNKNOWN" - - val daysOfIdeaUsage = KotlinNewUserTracker.getInstance().getInstallationDate()?.daysSinceDate() ?: 0 - val daysOfKotlinUsage = KotlinNewUserTracker.getInstance().getFirstKotlinUsageDate()?.daysSinceDate() ?: 0 - val daysOfKotlinWithMavenUsage = MavenBuildProcessSatisfactionSurveyStore.getInstance().getFirstKotlinMavenUsageDate()?.daysSinceDate() ?: 0 - val daysOfMavenUsage = MavenBuildProcessSatisfactionSurveyStore.getInstance().getFirstMavenUsageDate()?.daysSinceDate() ?: 0 - - return MavenBuildProcessSatisfactionDialogData( - mavenVersion = mavenVersion, - kotlinVersion = kotlinVersion, - pomFileCount = pomCount, - daysOfIdeaUsage = daysOfIdeaUsage, - daysOfKotlinUsage = daysOfKotlinUsage, - daysOfMavenUsage = daysOfMavenUsage, - daysOfKotlinWithMavenUsage = daysOfKotlinWithMavenUsage, - commonData = CommonFeedbackSystemData.getCurrentData(), - ) - } - - override suspend fun computeSystemInfoData(): MavenBuildProcessSatisfactionDialogData = - withContext(Dispatchers.EDT) { - collectData() - } - - override val zendeskTicketTitle: String = "Kotlin Maven Build Process in-IDE Feedback" - override val zendeskFeedbackType: String = "Kotlin Maven Build Process Feedback" - override val myFeedbackReportId: String = "kotlin_maven_build_process_feedback" - override fun shouldAutoCloseZendeskTicket(): Boolean = false - - override fun showFeedbackSystemInfoDialog(systemInfoData: MavenBuildProcessSatisfactionDialogData) { - showFeedbackSystemInfoDialog(myProject, systemInfoData.commonData) { - row(MavenFeedbackBundle.message("build.process.info.maven.version")) { - label(systemInfoData.mavenVersion) - } - row(MavenFeedbackBundle.message("build.process.info.kotlin.version")) { - label(systemInfoData.kotlinVersion) - } - row(MavenFeedbackBundle.message("build.process.info.pom.file.count")) { - label(systemInfoData.pomFileCount.toString()) - } - row(MavenFeedbackBundle.message("build.process.info.days.of.kotlin.usage")) { - label(systemInfoData.daysOfKotlinUsage.toString()) - } - row(MavenFeedbackBundle.message("build.process.info.days.of.idea.usage")) { - label(systemInfoData.daysOfIdeaUsage.toString()) - } - row(MavenFeedbackBundle.message("build.process.info.days.of.maven.usage")) { - label(systemInfoData.daysOfMavenUsage.toString()) - } - row(MavenFeedbackBundle.message("build.process.info.days.of.kotlin.maven.usage")) { - label(systemInfoData.daysOfKotlinWithMavenUsage.toString()) - } - } - } - - override val myTitle: String = MavenFeedbackBundle.message("dialog.build.process.maven.satisfaction.top.title") - - override val myBlocks: List = listOf( - TopLabelBlock(MavenFeedbackBundle.message("dialog.build.process.maven.satisfaction.title")), - DescriptionBlock(MavenFeedbackBundle.message("dialog.build.process.maven.satisfaction.description")), - SegmentedButtonBlock( - MavenFeedbackBundle.message("dialog.build.process.maven.satisfaction.rating.label", ApplicationInfo.getInstance().versionName), - List(5) { (it + 1).toString() }, - "csat_rating", - listOf( - AllIcons.Survey.VeryDissatisfied, - AllIcons.Survey.Dissatisfied, - AllIcons.Survey.Neutral, - AllIcons.Survey.Satisfied, - AllIcons.Survey.VerySatisfied - ) - ) - .addLeftBottomLabel(MavenFeedbackBundle.message("dialog.rating.leftHint")) - .addMiddleBottomLabel(MavenFeedbackBundle.message("dialog.rating.middleHint")) - .addRightBottomLabel(MavenFeedbackBundle.message("dialog.rating.rightHint")), - TextAreaBlock( - MavenFeedbackBundle.message("dialog.build.process.maven.satisfaction.improve.label"), - "improvements" - ) - ) - - init { - init() - } - - override fun showThanksNotification() { - ThanksForFeedbackNotification( - description = MavenFeedbackBundle.message( - "dialog.build.process.maven.satisfaction.feedback.content" - ) - ).notify(myProject) - } -} diff --git a/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionListener.kt b/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionListener.kt deleted file mode 100644 index 9f63cbe6bf91..000000000000 --- a/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionListener.kt +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package org.jetbrains.kotlin.onboarding.maven - -import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId -import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationListener -import com.intellij.openapi.project.modules -import org.jetbrains.idea.maven.utils.MavenUtil -import org.jetbrains.kotlin.idea.configuration.hasKotlinPluginEnabled - -internal class MavenBuildProcessSatisfactionListener : ExternalSystemTaskNotificationListener { - override fun onSuccess(projectPath: String, id: ExternalSystemTaskId) { - if (id.projectSystemId != MavenUtil.SYSTEM_ID) return - val project = id.findProject() ?: return - if (project.modules.any { it.hasKotlinPluginEnabled() }) { - MavenBuildProcessSatisfactionSurveyStore.getInstance().recordKotlinBuild() - } else { - MavenBuildProcessSatisfactionSurveyStore.getInstance().recordNonKotlinBuild() - } - } -} diff --git a/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionSurvey.kt b/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionSurvey.kt deleted file mode 100644 index c4b461dcadd8..000000000000 --- a/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionSurvey.kt +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package org.jetbrains.kotlin.onboarding.maven - -import com.intellij.platform.feedback.FeedbackSurvey -import com.intellij.platform.feedback.FeedbackSurveyType -import com.intellij.platform.feedback.InIdeFeedbackSurveyConfig -import com.intellij.platform.feedback.InIdeFeedbackSurveyType - -internal class MavenBuildProcessSatisfactionSurvey : FeedbackSurvey() { - override val feedbackSurveyType: FeedbackSurveyType = - InIdeFeedbackSurveyType(MavenBuildProcessSatisfactionSurveyConfig()) -} diff --git a/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionSurveyConfig.kt b/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionSurveyConfig.kt deleted file mode 100644 index 940b0544498e..000000000000 --- a/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionSurveyConfig.kt +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package org.jetbrains.kotlin.onboarding.maven - -import com.intellij.openapi.project.Project -import com.intellij.platform.feedback.InIdeFeedbackSurveyConfig -import com.intellij.platform.feedback.dialog.BlockBasedFeedbackDialogWithEmail -import com.intellij.platform.feedback.dialog.SystemDataJsonSerializable -import com.intellij.platform.feedback.impl.notification.RequestFeedbackNotification -import com.intellij.util.PlatformUtils -import kotlinx.datetime.LocalDate - -class MavenBuildProcessSatisfactionSurveyConfig : InIdeFeedbackSurveyConfig { - - override val surveyId: String = "kotlin_maven_build_process_feedback" - override val lastDayOfFeedbackCollection: LocalDate = LocalDate(2035, 1, 1) - override val requireIdeEAP: Boolean = false - - override fun createFeedbackDialog(project: Project, forTest: Boolean): BlockBasedFeedbackDialogWithEmail { - return MavenBuildProcessSatisfactionDialog(project, forTest) - } - - override fun updateStateAfterDialogClosedOk(project: Project) { - MavenBuildProcessSatisfactionSurveyStore.getInstance().recordSurveyShown() - } - - override fun checkIdeIsSuitable(): Boolean { - return PlatformUtils.isIdeaUltimate() || PlatformUtils.isIdeaCommunity() - } - - override fun checkExtraConditionSatisfied(project: Project): Boolean { - if (!project.isKotlinMavenProject()) return false - return MavenBuildProcessSatisfactionSurveyStore.getInstance().shouldShowDialog() - } - - override fun createNotification(project: Project, forTest: Boolean): RequestFeedbackNotification { - return RequestFeedbackNotification( - "Feedback In IDE", - MavenFeedbackBundle.message("build.process.maven.satisfaction.request.title"), - MavenFeedbackBundle.message("build.process.maven.satisfaction.request.content") - ) - } - - override fun updateStateAfterNotificationShowed(project: Project) { - // do nothing - } -} diff --git a/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionSurveyStore.kt b/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionSurveyStore.kt deleted file mode 100644 index a29c54828233..000000000000 --- a/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenBuildProcessSatisfactionSurveyStore.kt +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package org.jetbrains.kotlin.onboarding.maven - -import com.intellij.openapi.components.BaseState -import com.intellij.openapi.components.PersistentStateComponent -import com.intellij.openapi.components.RoamingType -import com.intellij.openapi.components.State -import com.intellij.openapi.components.Storage -import com.intellij.openapi.components.service -import com.intellij.openapi.project.Project -import com.intellij.openapi.project.modules -import org.jetbrains.annotations.ApiStatus -import org.jetbrains.kotlin.idea.configuration.BuildSystemType -import org.jetbrains.kotlin.idea.configuration.buildSystemType -import org.jetbrains.kotlin.idea.configuration.hasKotlinPluginEnabled -import java.time.Duration -import java.time.Instant -import java.time.LocalDate -import java.time.ZoneOffset - -internal class MavenBuildProcessSatisfactionSurveyState : BaseState() { - var daysWithMavenBuilds by property(0) - var userSawSurvey by property(false) - // Unix time seconds - var firstKotlinMavenBuildTime by property(0L) - // Not just Kotlin but also counts Java - var firstMavenBuildTime by property(0L) - var lastKotlinMavenBuildTime by property(0L) - var nextCountedMavenBuild by property(0L) -} - -internal fun Project.isKotlinMavenProject(): Boolean { - return modules.any { - it.buildSystemType == BuildSystemType.Maven && it.hasKotlinPluginEnabled() - } -} - -@ApiStatus.Internal -@State(name = "MavenBuildProcessSatisfactionSurveyStore", storages = [Storage(value = "kotlin-onboarding.xml", roamingType = RoamingType.DISABLED)]) -internal class MavenBuildProcessSatisfactionSurveyStore : PersistentStateComponent { - override fun getState(): MavenBuildProcessSatisfactionSurveyState = currentState - - companion object { - internal const val MINIMUM_BUILDS_BEFORE_SURVEY = 3 - internal val MINIMUM_DURATION_SINCE_FIRST_BUILD: Duration = Duration.ofDays(14) - - fun getInstance(): MavenBuildProcessSatisfactionSurveyStore { - return service() - } - } - - internal var currentState: MavenBuildProcessSatisfactionSurveyState = MavenBuildProcessSatisfactionSurveyState() - - override fun loadState(state: MavenBuildProcessSatisfactionSurveyState) { - currentState = state - } - - internal fun recordSurveyShown() { - state.userSawSurvey = true - } - - internal fun recordNonKotlinBuild() { - val currentTime = Instant.now() - if (currentState.firstMavenBuildTime == 0L) { - currentState.firstMavenBuildTime = currentTime.epochSecond - } - } - - internal fun recordKotlinBuild() { - val currentTime = Instant.now() - if (currentTime >= Instant.ofEpochSecond(currentState.nextCountedMavenBuild)) { - currentState.daysWithMavenBuilds++ - currentState.nextCountedMavenBuild = (currentTime + Duration.ofDays(1)).epochSecond - } - currentState.lastKotlinMavenBuildTime = currentTime.epochSecond - if (currentState.firstKotlinMavenBuildTime == 0L) { - currentState.firstKotlinMavenBuildTime = currentTime.epochSecond - } - if (currentState.firstMavenBuildTime == 0L) { - currentState.firstMavenBuildTime = currentTime.epochSecond - } - } - - /** - * Returns the date on which the user was first detected to have used Kotlin and Maven. - * Returns null if an error occurred, or the user has not used it before. - */ - internal fun getFirstKotlinMavenUsageDate(): LocalDate? { - if (state.firstKotlinMavenBuildTime == 0L) return null - return Instant.ofEpochSecond(state.firstKotlinMavenBuildTime).atOffset(ZoneOffset.UTC).toLocalDate() - } - - /** - * Returns the date on which the user was first detected to have used Maven (with or without Kotlin). - * Returns null if an error occurred, or the user has not used it before. - */ - internal fun getFirstMavenUsageDate(): LocalDate? { - if (state.firstKotlinMavenBuildTime > 0L && state.firstKotlinMavenBuildTime < state.firstMavenBuildTime) return getFirstKotlinMavenUsageDate() - if (state.firstMavenBuildTime == 0L) return null - return Instant.ofEpochSecond(state.firstMavenBuildTime).atOffset(ZoneOffset.UTC).toLocalDate() - } - - internal fun shouldShowDialog(): Boolean { - val state = currentState - if (state.userSawSurvey || state.firstKotlinMavenBuildTime == 0L || state.daysWithMavenBuilds < MINIMUM_BUILDS_BEFORE_SURVEY) return false - return Duration.between( - Instant.ofEpochSecond(state.firstKotlinMavenBuildTime), - Instant.now() - ) >= MINIMUM_DURATION_SINCE_FIRST_BUILD - } -} diff --git a/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenFeedbackBundle.kt b/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenFeedbackBundle.kt deleted file mode 100644 index 28ec0c0820a7..000000000000 --- a/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/MavenFeedbackBundle.kt +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package org.jetbrains.kotlin.onboarding.maven - -import com.intellij.DynamicBundle -import org.jetbrains.annotations.NonNls -import org.jetbrains.annotations.PropertyKey - -@NonNls -private const val BUNDLE = "messages.MavenFeedbackBundle" - -internal object MavenFeedbackBundle : DynamicBundle(BUNDLE) { - @Suppress("SpreadOperator") - fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any) = getMessage(key, *params) -} diff --git a/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/ShowMavenBuildProcessSatisfactionDialogAction.kt b/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/ShowMavenBuildProcessSatisfactionDialogAction.kt deleted file mode 100644 index 759a16b1cb39..000000000000 --- a/plugins/kotlin/onboarding-maven/src/org/jetbrains/kotlin/onboarding/maven/ShowMavenBuildProcessSatisfactionDialogAction.kt +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package org.jetbrains.kotlin.onboarding.maven - -import com.intellij.openapi.actionSystem.AnAction -import com.intellij.openapi.actionSystem.AnActionEvent - -internal class ShowMavenBuildProcessSatisfactionDialogAction : AnAction() { - override fun actionPerformed(e: AnActionEvent) { - val project = e.project ?: return - MavenBuildProcessSatisfactionDialog(project, false).show() - } -} diff --git a/plugins/kotlin/plugin/k1/BUILD.bazel b/plugins/kotlin/plugin/k1/BUILD.bazel index 9f413e64b93e..b10ccd4e7f7a 100644 --- a/plugins/kotlin/plugin/k1/BUILD.bazel +++ b/plugins/kotlin/plugin/k1/BUILD.bazel @@ -167,7 +167,6 @@ jvm_library( "//plugins/kotlin/injection/base:kotlin-base-injection", "//plugins/kotlin/onboarding", "//plugins/kotlin/onboarding-gradle", - "//plugins/kotlin/onboarding-maven", "//plugins/kotlin/base/code-insight/minimal", "//plugins/kotlin/highlighting/highlighting-minimal:kotlin-highlighting-minimal", "//plugins/kotlin/formatter/minimal", diff --git a/plugins/kotlin/plugin/k1/kotlin.plugin.k1.iml b/plugins/kotlin/plugin/k1/kotlin.plugin.k1.iml index 22a311ed04c4..ab1b9ad77419 100644 --- a/plugins/kotlin/plugin/k1/kotlin.plugin.k1.iml +++ b/plugins/kotlin/plugin/k1/kotlin.plugin.k1.iml @@ -161,7 +161,6 @@ - diff --git a/plugins/kotlin/plugin/k1/resources/kotlin.plugin.k1.xml b/plugins/kotlin/plugin/k1/resources/kotlin.plugin.k1.xml index 03f773031d11..d5781dc8bc11 100644 --- a/plugins/kotlin/plugin/k1/resources/kotlin.plugin.k1.xml +++ b/plugins/kotlin/plugin/k1/resources/kotlin.plugin.k1.xml @@ -62,7 +62,6 @@ - diff --git a/plugins/kotlin/plugin/k2/BUILD.bazel b/plugins/kotlin/plugin/k2/BUILD.bazel index b176b605fa4f..5661dba732c1 100644 --- a/plugins/kotlin/plugin/k2/BUILD.bazel +++ b/plugins/kotlin/plugin/k2/BUILD.bazel @@ -132,7 +132,6 @@ jvm_library( "//plugins/kotlin/injection/base:kotlin-base-injection", "//plugins/kotlin/onboarding", "//plugins/kotlin/onboarding-gradle", - "//plugins/kotlin/onboarding-maven", "//plugins/kotlin/base/code-insight/minimal", "//plugins/kotlin/code-insight/fixes-k2:kotlin-codeInsight-fixes", "//plugins/kotlin/jsr223", diff --git a/plugins/kotlin/plugin/k2/kotlin.plugin.k2.iml b/plugins/kotlin/plugin/k2/kotlin.plugin.k2.iml index 401bc71b59c4..25920bc8d029 100644 --- a/plugins/kotlin/plugin/k2/kotlin.plugin.k2.iml +++ b/plugins/kotlin/plugin/k2/kotlin.plugin.k2.iml @@ -122,7 +122,6 @@ - diff --git a/plugins/kotlin/plugin/k2/resources/kotlin.plugin.k2.xml b/plugins/kotlin/plugin/k2/resources/kotlin.plugin.k2.xml index a3130e18b4b0..18386b7d5651 100644 --- a/plugins/kotlin/plugin/k2/resources/kotlin.plugin.k2.xml +++ b/plugins/kotlin/plugin/k2/resources/kotlin.plugin.k2.xml @@ -217,7 +217,6 @@ - diff --git a/plugins/kotlin/plugin/plugin-content.yaml b/plugins/kotlin/plugin/plugin-content.yaml index 9a40edfb1c97..13540b000c93 100644 --- a/plugins/kotlin/plugin/plugin-content.yaml +++ b/plugins/kotlin/plugin/plugin-content.yaml @@ -209,7 +209,6 @@ - name: intellij.kotlin.j2k - name: intellij.kotlin.onboarding - name: intellij.kotlin.onboarding.gradle - - name: intellij.kotlin.onboarding.maven - name: intellij.kotlin.plugin.updater - name: intellij.kotlin.preferences - name: intellij.kotlin.projectConfiguration