Skip to content

Commit 409a431

Browse files
committed
Fix rider build
1 parent 94092ec commit 409a431

File tree

8 files changed

+38
-9
lines changed

8 files changed

+38
-9
lines changed

components/ide/jetbrains/backend-plugin/build.gradle-stable.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ project(":") {
3838
if (properties("platformType") == "RD") {
3939
print("Rider: exclude unnecessary files")
4040
sourceSets["main"].kotlin.exclude("**/GitpodForceUpdateMavenProjectsActivity.kt")
41+
sourceSets["main"].kotlin.exclude("**/GitpodPortForwardingServiceImpl.kt")
4142
sourceSets["main"].kotlin.exclude("**/maven.xml")
4243
}
4344
}

components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/AbstractGitpodPortForwardingService.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import com.intellij.util.application
1313
import com.jetbrains.rd.platform.codeWithMe.portForwarding.*
1414
import com.jetbrains.rd.util.URI
1515
import com.jetbrains.rd.util.lifetime.Lifetime
16-
import fleet.util.async.throttleLatest
1716
import io.gitpod.supervisor.api.Status
1817
import io.gitpod.supervisor.api.Status.PortsStatus
1918
import io.gitpod.supervisor.api.StatusServiceGrpc
@@ -41,10 +40,10 @@ abstract class AbstractGitpodPortForwardingService : GitpodPortForwardingService
4140
private val portStatusFlow = MutableSharedFlow<Status.PortsStatusResponse>()
4241

4342
init {
44-
// Start collecting port status updates with throttling
43+
// Start collecting port status updates
4544
runJob(lifetime) {
4645
portStatusFlow
47-
.throttleLatest(1000) // Throttle to 1 second
46+
.let { flow -> applyThrottling(flow) }
4847
.collect { response ->
4948
withContext(Dispatchers.IO) {
5049
syncPortsListWithClient(response)
@@ -55,6 +54,10 @@ abstract class AbstractGitpodPortForwardingService : GitpodPortForwardingService
5554
start()
5655
}
5756

57+
protected abstract fun runJob(lifetime: Lifetime, block: suspend CoroutineScope.() -> Unit): Job;
58+
59+
protected abstract suspend fun <T> applyThrottling(flow: kotlinx.coroutines.flow.Flow<T>): kotlinx.coroutines.flow.Flow<T>
60+
5861
private fun start() {
5962
if (application.isHeadlessEnvironment) return
6063

@@ -65,8 +68,6 @@ abstract class AbstractGitpodPortForwardingService : GitpodPortForwardingService
6568
observePortsListWhileProjectIsOpen()
6669
}
6770

68-
protected abstract fun runJob(lifetime: Lifetime, block: suspend CoroutineScope.() -> Unit): Job;
69-
7071
private fun observePortsListWhileProjectIsOpen() = runJob(lifetime) {
7172
while (isActive) {
7273
try {

components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/GitpodPortForwardingServiceImpl.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ package io.gitpod.jetbrains.remote
66

77
import com.jetbrains.rd.util.lifetime.Lifetime
88
import com.jetbrains.rd.util.threading.coroutines.launch
9-
import io.gitpod.jetbrains.remote.AbstractGitpodPortForwardingService
109
import kotlinx.coroutines.CoroutineScope
10+
import fleet.util.async.throttleLatest
11+
import kotlinx.coroutines.flow.Flow
1112

1213
@Suppress("UnstableApiUsage")
1314
class GitpodPortForwardingServiceImpl : AbstractGitpodPortForwardingService() {
1415
override fun runJob(lifetime: Lifetime, block: suspend CoroutineScope.() -> Unit) = lifetime.launch { block() }
16+
17+
override suspend fun <T> applyThrottling(flow: Flow<T>): Flow<T> = flow.throttleLatest(1000)
1518
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (c) 2025 Gitpod GmbH. All rights reserved.
2+
// Licensed under the GNU Affero General Public License (AGPL).
3+
// See License.AGPL.txt in the project root for license information.
4+
5+
package io.gitpod.jetbrains.remote.optional
6+
7+
import com.jetbrains.rd.util.lifetime.Lifetime
8+
import com.jetbrains.rd.util.threading.coroutines.launch
9+
import io.gitpod.jetbrains.remote.AbstractGitpodPortForwardingService
10+
import kotlinx.coroutines.CoroutineScope
11+
import kotlinx.coroutines.flow.Flow
12+
13+
@Suppress("UnstableApiUsage")
14+
class GitpodRiderPortForwardingService : AbstractGitpodPortForwardingService() {
15+
override fun runJob(lifetime: Lifetime, block: suspend CoroutineScope.() -> Unit) = lifetime.launch { block() }
16+
17+
override suspend fun <T> applyThrottling(flow: Flow<T>): Flow<T> = flow
18+
}

components/ide/jetbrains/backend-plugin/src/main/resources-latest/META-INF/extensions.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@
66
<!--suppress PluginXmlValidity -->
77
<idea-plugin>
88
<extensions defaultExtensionNs="com.intellij">
9+
<applicationService serviceInterface="io.gitpod.jetbrains.remote.GitpodPortForwardingService"
10+
serviceImplementation="io.gitpod.jetbrains.remote.GitpodPortForwardingServiceImpl"
11+
client="controller" preload="true"/>
912
</extensions>
1013
</idea-plugin>

components/ide/jetbrains/backend-plugin/src/main/resources-rider/META-INF/plugin.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
description="Disable the forced update of Maven projects when IDE opens."
5151
restartRequired="true"/>
5252

53+
<applicationService serviceInterface="io.gitpod.jetbrains.remote.GitpodPortForwardingService"
54+
serviceImplementation="io.gitpod.jetbrains.remote.optional.GitpodRiderPortForwardingService"
55+
client="controller" preload="true" />
5356

5457
<applicationService serviceInterface="io.gitpod.jetbrains.remote.GitpodIgnoredPortsForNotificationService"
5558
serviceImplementation="io.gitpod.jetbrains.remote.internal.GitpodIgnoredPortsForNotificationServiceImpl"

components/ide/jetbrains/backend-plugin/src/main/resources-stable/META-INF/extensions.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@
66
<!--suppress PluginXmlValidity -->
77
<idea-plugin>
88
<extensions defaultExtensionNs="com.intellij">
9+
<applicationService serviceInterface="io.gitpod.jetbrains.remote.GitpodPortForwardingService"
10+
serviceImplementation="io.gitpod.jetbrains.remote.GitpodPortForwardingServiceImpl"
11+
client="controller" preload="true"/>
912
</extensions>
1013
</idea-plugin>

components/ide/jetbrains/backend-plugin/src/main/resources/META-INF/plugin.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@
5555
preload="true"/>
5656

5757

58-
<applicationService serviceInterface="io.gitpod.jetbrains.remote.GitpodPortForwardingService"
59-
serviceImplementation="io.gitpod.jetbrains.remote.GitpodPortForwardingServiceImpl"
60-
client="controller" preload="true"/>
6158
<gateway.customization.performance id="gitpodMetricsControl" order="before cpuControl"
6259
implementation="io.gitpod.jetbrains.remote.GitpodMetricControlProvider"/>
6360
</extensions>

0 commit comments

Comments
 (0)