From 6f7298d2cb485adcdbda75e3f0cead5c1c4fbbfc Mon Sep 17 00:00:00 2001 From: mustard Date: Tue, 24 Sep 2024 02:03:09 +0800 Subject: [PATCH] Upgrade platform version of JetBrains Backend Plugin (EAP) (#20236) * Update Platform Version of JetBrains Backend Plugin (EAP) to * Fix latest editor build * Fixup * revert year changes * fix rider build * 1 --------- Co-authored-by: Robo Quat --- .../ide/jetbrains/backend-plugin/BUILD.yaml | 3 ++- .../backend-plugin/gradle-latest.properties | 9 +++++---- .../jetbrains/backend-plugin/gradle.properties | 2 +- .../AbstractGitpodMetricControlProvider.kt | 17 ++++++++++------- .../gitpod/jetbrains/remote/GitpodCLIService.kt | 9 +++++++-- .../latest/GitpodMetricControlProvider.kt | 14 +++++++++++++- .../stable/GitpodMetricControlProvider.kt | 14 +++++++++++++- 7 files changed, 51 insertions(+), 17 deletions(-) diff --git a/components/ide/jetbrains/backend-plugin/BUILD.yaml b/components/ide/jetbrains/backend-plugin/BUILD.yaml index 5e5c19b54ef7b8..e96154dc7b94fd 100644 --- a/components/ide/jetbrains/backend-plugin/BUILD.yaml +++ b/components/ide/jetbrains/backend-plugin/BUILD.yaml @@ -147,7 +147,8 @@ packages: - "build.sh" env: - JB_QUALIFIER=stable-rider - - NO_VERIFY_JB_PLUGIN=${noVerifyJBPlugin} + # Force skip plugin verification for Rider + - NO_VERIFY_JB_PLUGIN=true config: commands: - ["mv", "build.gradle-stable.kts", "build.gradle.kts"] diff --git a/components/ide/jetbrains/backend-plugin/gradle-latest.properties b/components/ide/jetbrains/backend-plugin/gradle-latest.properties index 95074f69674336..64feec2edf3b0f 100644 --- a/components/ide/jetbrains/backend-plugin/gradle-latest.properties +++ b/components/ide/jetbrains/backend-plugin/gradle-latest.properties @@ -1,10 +1,11 @@ # Code generated by gha-update-image/index-jb-platform-update.ts. DO NOT EDIT. # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html # for insight into build numbers and IntelliJ Platform versions. -pluginSinceBuild=242.19533 -pluginUntilBuild=242.* +# revert pluginSinceBuild if it's unnecessary +pluginSinceBuild=243.15521 +pluginUntilBuild=243.* # Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl # See https://jb.gg/intellij-platform-builds-list for available build versions. -pluginVerifierIdeVersions=2024.2 +pluginVerifierIdeVersions=2024.3 # Version from "com.jetbrains.intellij.idea" which can be found at https://www.jetbrains.com/intellij-repository/snapshots -platformVersion=242.21829.142 +platformVersion=243.15521.24 diff --git a/components/ide/jetbrains/backend-plugin/gradle.properties b/components/ide/jetbrains/backend-plugin/gradle.properties index e348979a8261ed..21cbcefd39e9df 100644 --- a/components/ide/jetbrains/backend-plugin/gradle.properties +++ b/components/ide/jetbrains/backend-plugin/gradle.properties @@ -1,7 +1,7 @@ pluginVersion=0.0.1 gitpodVersion=dev # Supported environments: stable, latest (via https://github.com/stevesaliman/gradle-properties-plugin) -environmentName=stable-rider +environmentName=latest # IntelliJ Platform Artifacts Repositories # -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html pluginGroup=io.gitpod.jetbrains diff --git a/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/AbstractGitpodMetricControlProvider.kt b/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/AbstractGitpodMetricControlProvider.kt index 465145ce9f3821..53b5cff8d80894 100644 --- a/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/AbstractGitpodMetricControlProvider.kt +++ b/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/AbstractGitpodMetricControlProvider.kt @@ -5,24 +5,27 @@ package io.gitpod.jetbrains.remote import com.jetbrains.ide.model.uiautomation.BeControl -import com.jetbrains.ide.model.uiautomation.BeMargin import com.jetbrains.ide.model.uiautomation.DefiniteProgress import com.jetbrains.rd.platform.codeWithMe.unattendedHost.metrics.Metric import com.jetbrains.rd.ui.bedsl.dsl.* -import com.jetbrains.rd.ui.bedsl.dsl.util.BeMarginsBuilder import com.jetbrains.rd.util.lifetime.Lifetime import com.jetbrains.rd.util.reactive.Property -import com.jetbrains.rdserver.diagnostics.BackendDiagnosticsService import com.jetbrains.rdserver.unattendedHost.customization.controlCenter.performance.MetricControlProvider import com.jetbrains.rdserver.unattendedHost.customization.controlCenter.performance.createProgressBar +interface IBackendDiagnosticsService { + fun getMetric(name: String): com.jetbrains.rd.platform.codeWithMe.unattendedHost.metrics.Metric +} + abstract class AbstractGitpodMetricControlProvider : MetricControlProvider { override val id: String = "gitpodMetricsControl" abstract fun setMargin(element: BeControl, left: Int, top: Int, right: Int, bottom: Int): BeControl; + abstract fun getBackendDiagnosticsService(): IBackendDiagnosticsService + override fun getControl(lifetime: Lifetime): BeControl { - val backendDiagnosticsService = BackendDiagnosticsService.Companion.getInstance() + val backendDiagnosticsService = this.getBackendDiagnosticsService() return verticalGrid { row { horizontalGrid { @@ -49,7 +52,7 @@ abstract class AbstractGitpodMetricControlProvider : MetricControlProvider { } } - private fun createWorkspaceHeaderRow(ctx: VerticalGridBuilder, backendDiagnosticsService: BackendDiagnosticsService, lifetime: Lifetime) { + private fun createWorkspaceHeaderRow(ctx: VerticalGridBuilder, backendDiagnosticsService: IBackendDiagnosticsService, lifetime: Lifetime) { val labelProperty = Property("") val workspaceClassMetric = backendDiagnosticsService.getMetric("gitpod_workspace_class") @@ -78,7 +81,7 @@ abstract class AbstractGitpodMetricControlProvider : MetricControlProvider { } } - private fun createCpuControl(ctx: VerticalGridBuilder, backendDiagnosticsService: BackendDiagnosticsService, lifetime: Lifetime) { + private fun createCpuControl(ctx: VerticalGridBuilder, backendDiagnosticsService: IBackendDiagnosticsService, lifetime: Lifetime) { val cpuUsed = backendDiagnosticsService.getMetric("gitpod_workspace_cpu_used") val cpuTotal = backendDiagnosticsService.getMetric("gitpod_workspace_cpu_total") val cpuPercentage = backendDiagnosticsService.getMetric("gitpod_workspace_cpu_percentage") @@ -100,7 +103,7 @@ abstract class AbstractGitpodMetricControlProvider : MetricControlProvider { createProgressControl(ctx, lifetime, label, cpuPercentage, labelProperty, cpuPercentageProperty, progressBar) } - private fun createMemoryControl(ctx: VerticalGridBuilder, backendDiagnosticsService: BackendDiagnosticsService, lifetime: Lifetime) { + private fun createMemoryControl(ctx: VerticalGridBuilder, backendDiagnosticsService: IBackendDiagnosticsService, lifetime: Lifetime) { val memoryUsed = backendDiagnosticsService.getMetric("gitpod_workspace_memory_used") val memoryTotal = backendDiagnosticsService.getMetric("gitpod_workspace_memory_total") val memoryPercentage = backendDiagnosticsService.getMetric("gitpod_workspace_memory_percentage") diff --git a/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/GitpodCLIService.kt b/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/GitpodCLIService.kt index 0a97da3720b21d..e4bd69c3efca77 100644 --- a/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/GitpodCLIService.kt +++ b/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/GitpodCLIService.kt @@ -27,7 +27,10 @@ import io.netty.channel.ChannelHandlerContext import io.netty.handler.codec.http.FullHttpRequest import io.netty.handler.codec.http.QueryStringDecoder import io.prometheus.client.exporter.common.TextFormat -import kotlinx.coroutines.* +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking import org.jetbrains.ide.RestService import org.jetbrains.io.response import java.io.OutputStreamWriter @@ -113,7 +116,9 @@ class GitpodCLIService : RestService() { GlobalScope.launch { getClientSessionAndProjectAsync().let { (session, project) -> ClientId.withClientId(session.clientId) { - action(project) + runBlocking { + action(project) + } sendOk(request, context) } } diff --git a/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/latest/GitpodMetricControlProvider.kt b/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/latest/GitpodMetricControlProvider.kt index b956968905a4d5..cb86ddc49e5887 100644 --- a/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/latest/GitpodMetricControlProvider.kt +++ b/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/latest/GitpodMetricControlProvider.kt @@ -7,15 +7,27 @@ package io.gitpod.jetbrains.remote.latest import com.jetbrains.ide.model.uiautomation.BeControl import com.jetbrains.ide.model.uiautomation.DefiniteProgress import com.jetbrains.rd.platform.codeWithMe.unattendedHost.metrics.Metric -import com.jetbrains.rd.ui.bedsl.dsl.* +import com.jetbrains.rd.ui.bedsl.dsl.VerticalGridBuilder +import com.jetbrains.rd.ui.bedsl.dsl.withMargin import com.jetbrains.rd.util.lifetime.Lifetime import com.jetbrains.rd.util.reactive.Property import com.jetbrains.rdserver.unattendedHost.customization.controlCenter.performance.createProgressRow +import com.jetbrains.rdserver.unattendedHost.diagnostics.BackendDiagnosticsService import io.gitpod.jetbrains.remote.AbstractGitpodMetricControlProvider +import io.gitpod.jetbrains.remote.IBackendDiagnosticsService class GitpodMetricControlProvider: AbstractGitpodMetricControlProvider() { override fun setMargin(element: BeControl, left: Int, top: Int, right: Int, bottom: Int) = element.withMargin(left, top, right, bottom) + override fun getBackendDiagnosticsService(): IBackendDiagnosticsService { + val obj = BackendDiagnosticsService.Companion.getInstance() + return object : IBackendDiagnosticsService { + override fun getMetric(name: String): Metric { + return obj.getMetric(name) + } + } + } + override fun createProgressControl(ctx: VerticalGridBuilder, lifetime: Lifetime, label: String, cpuPercentage: Metric, labelProperty: Property, cpuPercentageProperty: Property, progressBar: DefiniteProgress) { createProgressRow(ctx, id, lifetime, label, cpuPercentage.statusProperty, labelProperty, cpuPercentageProperty, progressBar) } diff --git a/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/stable/GitpodMetricControlProvider.kt b/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/stable/GitpodMetricControlProvider.kt index 03d08e5bab335e..baa133d3668fa5 100644 --- a/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/stable/GitpodMetricControlProvider.kt +++ b/components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/stable/GitpodMetricControlProvider.kt @@ -8,12 +8,15 @@ import com.jetbrains.ide.model.uiautomation.BeControl import com.jetbrains.ide.model.uiautomation.BeMargin import com.jetbrains.ide.model.uiautomation.DefiniteProgress import com.jetbrains.rd.platform.codeWithMe.unattendedHost.metrics.Metric -import com.jetbrains.rd.ui.bedsl.dsl.* +import com.jetbrains.rd.ui.bedsl.dsl.VerticalGridBuilder import com.jetbrains.rd.ui.bedsl.dsl.util.BeMarginsBuilder +import com.jetbrains.rd.ui.bedsl.dsl.withMargin import com.jetbrains.rd.util.lifetime.Lifetime import com.jetbrains.rd.util.reactive.Property import com.jetbrains.rdserver.unattendedHost.customization.controlCenter.performance.createProgressRow +import com.jetbrains.rdserver.diagnostics.BackendDiagnosticsService import io.gitpod.jetbrains.remote.AbstractGitpodMetricControlProvider +import io.gitpod.jetbrains.remote.IBackendDiagnosticsService class GitpodMetricControlProvider: AbstractGitpodMetricControlProvider() { override fun setMargin(element: BeControl, left: Int, top: Int, right: Int, bottom: Int): BeControl { @@ -22,6 +25,15 @@ class GitpodMetricControlProvider: AbstractGitpodMetricControlProvider() { return element } + override fun getBackendDiagnosticsService(): IBackendDiagnosticsService { + val obj = BackendDiagnosticsService.Companion.getInstance() + return object : IBackendDiagnosticsService { + override fun getMetric(name: String): Metric { + return obj.getMetric(name) + } + } + } + override fun createProgressControl(ctx: VerticalGridBuilder, lifetime: Lifetime, label: String, cpuPercentage: Metric, labelProperty: Property, cpuPercentageProperty: Property, progressBar: DefiniteProgress) { createProgressRow(ctx, id, lifetime, label, cpuPercentage.statusProperty, labelProperty, cpuPercentageProperty, progressBar) }