Add Native Debug plugin advertising
This commit is contained in:
+10
-1
@@ -79,9 +79,16 @@ open class KotlinMPPGradleProjectResolver : AbstractProjectResolverExtension() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun populateModuleContentRoots(gradleModule: IdeaModule, ideModule: DataNode<ModuleData>) {
|
override fun populateModuleContentRoots(gradleModule: IdeaModule, ideModule: DataNode<ModuleData>) {
|
||||||
if (resolverCtx.getExtraProject(gradleModule, KotlinMPPGradleModel::class.java) == null) {
|
val mppModel = resolverCtx.getExtraProject(gradleModule, KotlinMPPGradleModel::class.java)
|
||||||
|
if (mppModel == null) {
|
||||||
return super.populateModuleContentRoots(gradleModule, ideModule)
|
return super.populateModuleContentRoots(gradleModule, ideModule)
|
||||||
|
} else {
|
||||||
|
if (!nativeDebugAdvertised && mppModel.kotlinNativeHome.isNotEmpty()) {
|
||||||
|
nativeDebugAdvertised = true
|
||||||
|
suggestNativeDebug(resolverCtx.projectPath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
populateContentRoots(gradleModule, ideModule, resolverCtx)
|
populateContentRoots(gradleModule, ideModule, resolverCtx)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,6 +223,8 @@ open class KotlinMPPGradleProjectResolver : AbstractProjectResolverExtension() {
|
|||||||
Key.create<MutableMap<String/* artifact path */, MutableList<String> /* module ids*/>>("gradleMPPArtifactsMap")
|
Key.create<MutableMap<String/* artifact path */, MutableList<String> /* module ids*/>>("gradleMPPArtifactsMap")
|
||||||
val proxyObjectCloningCache = WeakHashMap<Any, Any>()
|
val proxyObjectCloningCache = WeakHashMap<Any, Any>()
|
||||||
|
|
||||||
|
private var nativeDebugAdvertised = false
|
||||||
|
|
||||||
fun initializeModuleData(
|
fun initializeModuleData(
|
||||||
gradleModule: IdeaModule,
|
gradleModule: IdeaModule,
|
||||||
mainModuleNode: DataNode<ModuleData>,
|
mainModuleNode: DataNode<ModuleData>,
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.idea.configuration
|
||||||
|
|
||||||
|
import com.intellij.ide.plugins.PluginManager
|
||||||
|
import com.intellij.notification.Notification
|
||||||
|
import com.intellij.notification.NotificationAction
|
||||||
|
import com.intellij.notification.NotificationType
|
||||||
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
|
import com.intellij.openapi.extensions.PluginId
|
||||||
|
import com.intellij.openapi.project.ProjectManager
|
||||||
|
import com.intellij.openapi.updateSettings.impl.pluginsAdvertisement.PluginsAdvertiser
|
||||||
|
import com.intellij.util.PlatformUtils
|
||||||
|
|
||||||
|
const val NATIVE_DEBUG_ID = "com.intellij.nativeDebug"
|
||||||
|
|
||||||
|
fun suggestNativeDebug(projectPath: String) {
|
||||||
|
if (!PlatformUtils.isIdeaUltimate() ||
|
||||||
|
PluginManager.isPluginInstalled(PluginId.getId(NATIVE_DEBUG_ID))) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val project = ProjectManager.getInstance().openProjects.firstOrNull { it.basePath == projectPath } ?: return
|
||||||
|
|
||||||
|
PluginsAdvertiser.NOTIFICATION_GROUP.createNotification(
|
||||||
|
PluginsAdvertiser.DISPLAY_ID,
|
||||||
|
"Native Debug plugin allows debug from Idea",
|
||||||
|
NotificationType.INFORMATION, null
|
||||||
|
).addAction(object : NotificationAction("Install") {
|
||||||
|
override fun actionPerformed(e: AnActionEvent, notification: Notification) {
|
||||||
|
PluginsAdvertiser.installAndEnablePlugins(setOf(NATIVE_DEBUG_ID)) { notification.expire() }
|
||||||
|
}
|
||||||
|
}).notify(project)
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.idea.configuration
|
||||||
|
|
||||||
|
fun suggestNativeDebug(projectPath: String) {}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.idea.configuration
|
||||||
|
|
||||||
|
fun suggestNativeDebug(projectPath: String) {}
|
||||||
Reference in New Issue
Block a user