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
This commit is contained in:
Frederik Haselmeier
2026-03-02 18:45:17 +00:00
committed by intellij-monorepo-bot
parent 9f17523382
commit bfb1a45ae5
23 changed files with 0 additions and 567 deletions
-1
View File
@@ -804,7 +804,6 @@
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/navigation/tests/intellij.kotlin.navigation.tests.iml" filepath="$PROJECT_DIR$/plugins/kotlin/navigation/tests/intellij.kotlin.navigation.tests.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/onboarding/intellij.kotlin.onboarding.iml" filepath="$PROJECT_DIR$/plugins/kotlin/onboarding/intellij.kotlin.onboarding.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/onboarding-gradle/intellij.kotlin.onboarding.gradle.iml" filepath="$PROJECT_DIR$/plugins/kotlin/onboarding-gradle/intellij.kotlin.onboarding.gradle.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/onboarding-maven/intellij.kotlin.onboarding.maven.iml" filepath="$PROJECT_DIR$/plugins/kotlin/onboarding-maven/intellij.kotlin.onboarding.maven.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/onboarding-promoter/intellij.kotlin.onboarding.promoter.iml" filepath="$PROJECT_DIR$/plugins/kotlin/onboarding-promoter/intellij.kotlin.onboarding.promoter.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/kotlin.performanceExtendedPlugin/intellij.kotlin.performanceExtendedPlugin.iml" filepath="$PROJECT_DIR$/plugins/kotlin/kotlin.performanceExtendedPlugin/intellij.kotlin.performanceExtendedPlugin.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/intellij.kotlin.plugin.community.main.iml" filepath="$PROJECT_DIR$/plugins/kotlin/intellij.kotlin.plugin.community.main.iml" />
-1
View File
@@ -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
@@ -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",
-1
View File
@@ -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",
@@ -215,7 +215,6 @@
<orderEntry type="module" module-name="intellij.kotlin.compilerPlugins.support.bundled" exported="" />
<orderEntry type="module" module-name="intellij.kotlin.onboarding" exported="" />
<orderEntry type="module" module-name="intellij.kotlin.onboarding.gradle" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.kotlin.onboarding.maven" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.kotlin.base.codeInsight.minimal" exported="" />
<orderEntry type="module" module-name="intellij.kotlin.highlighting.minimal" exported="" />
<orderEntry type="module" module-name="intellij.kotlin.formatter.minimal" exported="" />
@@ -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
@@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="kotlin-language" name="Kotlin">
<configuration version="5" platform="JVM 21" allPlatforms="JVM [21]" useProjectSettings="false">
<compilerSettings>
<option name="additionalArguments" value="-Xjvm-default=all -XXLanguage:+AllowEagerSupertypeAccessibilityChecks -progressive" />
</compilerSettings>
<compilerArguments>
<stringArguments>
<stringArg name="jvmTarget" arg="21" />
<stringArg name="apiVersion" arg="2.3" />
<stringArg name="languageVersion" arg="2.3" />
</stringArguments>
<arrayArguments>
<arrayArg name="pluginClasspaths">
<args>$KOTLIN_BUNDLED$/lib/kotlinx-serialization-compiler-plugin.jar</args>
</arrayArg>
</arrayArguments>
</compilerArguments>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="kotlin-stdlib" level="project" />
<orderEntry type="library" name="kotlinc.kotlin-compiler-common" level="project" />
<orderEntry type="module" module-name="intellij.platform.core" />
<orderEntry type="module" module-name="intellij.platform.editor.ui" />
<orderEntry type="module" module-name="intellij.platform.projectModel" />
<orderEntry type="module" module-name="intellij.platform.statistics" />
<orderEntry type="module" module-name="intellij.platform.analysis" />
<orderEntry type="module" module-name="intellij.platform.feedback" />
<orderEntry type="module" module-name="intellij.platform.ide" />
<orderEntry type="module" module-name="intellij.platform.ide.impl" />
<orderEntry type="module" module-name="intellij.kotlin.base.plugin" />
<orderEntry type="module" module-name="intellij.libraries.kotlinx.datetime" />
<orderEntry type="module" module-name="intellij.libraries.kotlinx.serialization.core" />
<orderEntry type="module" module-name="intellij.libraries.kotlinx.serialization.json" />
<orderEntry type="module" module-name="intellij.kotlin.projectConfiguration" />
<orderEntry type="module" module-name="intellij.kotlin.base.facet" />
<orderEntry type="module" module-name="intellij.kotlin.base.resources" />
<orderEntry type="module" module-name="intellij.kotlin.onboarding" />
<orderEntry type="module" module-name="intellij.maven" />
<orderEntry type="module" module-name="intellij.platform.externalSystem" />
</component>
</module>
@@ -1,26 +0,0 @@
<idea-plugin package="org.jetbrains.kotlin.onboarding.maven">
<dependencies>
<plugin id="org.jetbrains.idea.maven"/>
<module name="intellij.kotlin.onboarding"/>
</dependencies>
<resource-bundle>messages.MavenFeedbackBundle</resource-bundle>
<extensions defaultExtensionNs="com.intellij">
<applicationService serviceImplementation="org.jetbrains.kotlin.onboarding.maven.MavenBuildProcessSatisfactionSurveyStore"/>
<feedback.idleFeedbackSurvey implementation="org.jetbrains.kotlin.onboarding.maven.MavenBuildProcessSatisfactionSurvey"/>
<externalSystemTaskNotificationListener implementation="org.jetbrains.kotlin.onboarding.maven.MavenBuildProcessSatisfactionListener"/>
<registryKey
key="test.maven.survey"
description="Enables the testing mode for Maven build process satisfaction survey"
defaultValue="false"
restartRequired="false"/>
</extensions>
<actions resource-bundle="messages.MavenFeedbackBundle">
<group id="MavenBuildProcessSatisfaction" internal="true">
<action id="org.jetbrains.kotlin.onboarding.maven.ShowMavenBuildProcessSatisfactionDialogAction"
class="org.jetbrains.kotlin.onboarding.maven.ShowMavenBuildProcessSatisfactionDialogAction" internal="true"/>
<add-to-group group-id="FeedbackDialogGroup" anchor="last"/>
</group>
</actions>
</idea-plugin>
@@ -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
@@ -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<MavenBuildProcessSatisfactionDialogData>(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<String> {
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<FeedbackBlock> = 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)
}
}
@@ -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()
}
}
}
@@ -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<InIdeFeedbackSurveyConfig> =
InIdeFeedbackSurveyType(MavenBuildProcessSatisfactionSurveyConfig())
}
@@ -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<out SystemDataJsonSerializable> {
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
}
}
@@ -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<MavenBuildProcessSatisfactionSurveyState> {
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
}
}
@@ -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)
}
@@ -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()
}
}
-1
View File
@@ -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",
@@ -161,7 +161,6 @@
<orderEntry type="module" module-name="kotlin.base.injection" />
<orderEntry type="module" module-name="intellij.kotlin.onboarding" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.kotlin.onboarding.gradle" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.kotlin.onboarding.maven" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.kotlin.base.codeInsight.minimal" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.kotlin.highlighting.minimal" />
<orderEntry type="module" module-name="intellij.kotlin.formatter.minimal" />
@@ -62,7 +62,6 @@
<module name="intellij.kotlin.maven"/>
<module name="intellij.kotlin.onboarding"/>
<module name="intellij.kotlin.onboarding.gradle"/>
<module name="intellij.kotlin.onboarding.maven"/>
<module name="intellij.kotlin.projectWizard.idea"/>
<module name="kotlin.project-wizard.idea.k1"/>
<module name="intellij.kotlin.projectWizard.gradle"/>
-1
View File
@@ -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",
@@ -122,7 +122,6 @@
<orderEntry type="module" module-name="kotlin.base.injection" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.kotlin.onboarding" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.kotlin.onboarding.gradle" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.kotlin.onboarding.maven" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.kotlin.base.codeInsight.minimal" scope="RUNTIME" />
<orderEntry type="module" module-name="intellij.kotlin.highlighting.minimal" />
<orderEntry type="module" module-name="intellij.kotlin.formatter.minimal" />
@@ -217,7 +217,6 @@
<module name="intellij.kotlin.onboarding"/>
<module name="intellij.kotlin.onboarding.gradle"/>
<module name="intellij.kotlin.onboarding.maven"/>
<module name="intellij.kotlin.projectWizard.idea"/>
<module name="intellij.kotlin.projectWizard.gradle"/>
@@ -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