[performance plugin] IJPL-165636 IJ-CR-149885 Add backend-specific module with an option to download generated snapshot to the client machine

(cherry picked from commit 346ddc7cb3de2ee64a16f94cad5c47cd9dcaa541)

GitOrigin-RevId: cf9a64d8a7874a649d4db3f9ba9e32d0b2a57122
This commit is contained in:
Nikita Katkov
2024-11-06 20:35:57 +01:00
committed by intellij-monorepo-bot
parent bfe066b595
commit 8f34fe5c3a
5 changed files with 66 additions and 0 deletions

1
.idea/modules.xml generated
View File

@@ -585,6 +585,7 @@
<module fileurl="file://$PROJECT_DIR$/notebooks/notebook-ui/intellij.notebooks.ui.iml" filepath="$PROJECT_DIR$/notebooks/notebook-ui/intellij.notebooks.ui.iml" />
<module fileurl="file://$PROJECT_DIR$/notebooks/visualization/intellij.notebooks.visualization.iml" filepath="$PROJECT_DIR$/notebooks/visualization/intellij.notebooks.visualization.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/performanceTesting/core/intellij.performanceTesting.iml" filepath="$PROJECT_DIR$/plugins/performanceTesting/core/intellij.performanceTesting.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/performanceTesting/backend-split/intellij.performanceTesting.backend.split.iml" filepath="$PROJECT_DIR$/plugins/performanceTesting/backend-split/intellij.performanceTesting.backend.split.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/performanceTesting/remote-driver/intellij.performanceTesting.remoteDriver.iml" filepath="$PROJECT_DIR$/plugins/performanceTesting/remote-driver/intellij.performanceTesting.remoteDriver.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/performanceTesting/scripts-ui/intellij.performanceTesting.ui.iml" filepath="$PROJECT_DIR$/plugins/performanceTesting/scripts-ui/intellij.performanceTesting.ui.iml" />
<module fileurl="file://$PROJECT_DIR$/plugins/performanceTesting/vcs/intellij.performanceTesting.vcs.iml" filepath="$PROJECT_DIR$/plugins/performanceTesting/vcs/intellij.performanceTesting.vcs.iml" />

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<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="module" module-name="intellij.platform.backend.split" />
<orderEntry type="library" name="kotlin-stdlib" level="project" />
<orderEntry type="module" module-name="intellij.performanceTesting" />
<orderEntry type="module" module-name="intellij.platform.ide" />
<orderEntry type="module" module-name="intellij.rd.platform" />
<orderEntry type="module" module-name="intellij.rd.ide.model.generated" />
</component>
</module>

View File

@@ -0,0 +1,12 @@
<idea-plugin package="com.intellij.performanceTesting.backend.split">
<!-- This module is currently included into backend IDE via CWM plugin because there is no way to depend on backend.split module yet.
The correct setup would be to make this module a content module in the perf testing plugin and add an explicit backend.split dependency to it-->
<dependencies>
<plugin id="com.jetbrains.performancePlugin"/>
</dependencies>
<extensions defaultExtensionNs="com.jetbrains">
<performancePlugin.snapshotOpener implementation="com.intellij.performanceTesting.backend.split.RemoteClientSnapshotUploader"/>
</extensions>
</idea-plugin>

View File

@@ -0,0 +1,34 @@
package com.intellij.performanceTesting.backend.split
import com.intellij.idea.AppMode
import com.intellij.openapi.client.ClientSessionsManager
import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.project.Project
import com.jetbrains.performancePlugin.PerformanceTestingBundle
import com.jetbrains.performancePlugin.profilers.SnapshotOpener
import com.jetbrains.rd.ide.model.RemoteFileAddress
import com.jetbrains.rd.ide.model.SplitIde
import com.jetbrains.rd.ide.model.fileTransferModel
import com.jetbrains.rdserver.core.protocolModel
import org.jetbrains.annotations.Nls
import java.io.File
internal class RemoteClientSnapshotUploader : SnapshotOpener {
override fun canOpen(snapshot: File, project: Project?): Boolean {
return project != null && AppMode.isRemoteDevHost()
}
override fun getPresentableName(): @Nls String? {
return PerformanceTestingBundle.message("profiling.load.snapshot.to.client.action.text")
}
override fun open(snapshot: File, project: Project?) {
if (project == null) {
thisLogger().warn("Unable to load a snapshot without a project")
return
}
val remoteFileAddress = RemoteFileAddress(snapshot.absolutePath, SplitIde.Host)
ClientSessionsManager.getProjectSession(project)?.protocolModel?.fileTransferModel?.chooseTargetDirectoryAndDownloadFile?.fire(listOf(remoteFileAddress))
}
}

View File

@@ -3,6 +3,7 @@ profiling.capture.snapshot.success=Captured snapshot ''{0}'' is placed in user h
profiling.capture.snapshot.error=Failed to capture snapshot: {0}
profiling.capture.snapshot.action.showInFolder=Show in {0}
profiling.capture.snapshot.action.open=Open With Intellij Profiler
profiling.load.snapshot.to.client.action.text=Download to Client Machine
command.goto.finish=GoTo was executed
command.inspection.extension=No files with extension: