Skip to content

Commit 75d4a98

Browse files
felladrinAndrea Falzetti
and
Andrea Falzetti
committed
Update Platform Version of JetBrains Backend Plugin to 223.7126-EAP-CANDIDATE-SNAPSHOT
Co-authored-by: Andrea Falzetti <[email protected]>
1 parent 7b6959d commit 75d4a98

File tree

12 files changed

+121
-35
lines changed

12 files changed

+121
-35
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
22
# for insight into build numbers and IntelliJ Platform versions.
3-
pluginSinceBuild=223
3+
pluginSinceBuild=223.7126
44
pluginUntilBuild=223.*
55
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
66
# See https://jb.gg/intellij-platform-builds-list for available build versions.
77
pluginVerifierIdeVersions=2022.3
88
# Version from "com.jetbrains.intellij.idea" which can be found at https://www.jetbrains.com/intellij-repository/snapshots
9-
platformVersion=223.6160-EAP-CANDIDATE-SNAPSHOT
9+
platformVersion=223.7126-EAP-CANDIDATE-SNAPSHOT

Diff for: components/ide/jetbrains/backend-plugin/launch-dev-server.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ TEST_BACKEND_DIR="/workspace/ide-backend-$JB_QUALIFIER"
2828
if [ ! -d "$TEST_BACKEND_DIR" ]; then
2929
mkdir -p $TEST_BACKEND_DIR
3030
if [[ $RUN_FROM == "snapshot" ]]; then
31+
SNAPSHOT_VERSION=$(grep "platformVersion=" "gradle-$JB_QUALIFIER.properties" | sed 's/platformVersion=//')
3132
(cd $TEST_BACKEND_DIR &&
32-
SNAPSHOT_VERSION=$(grep "platformVersion=" "gradle-$JB_QUALIFIER.properties" | sed 's/platformVersion=//') &&
3333
echo "Downloading the $JB_QUALIFIER version of IntelliJ IDEA ($SNAPSHOT_VERSION)..." &&
3434
curl -sSLo backend.zip "https://www.jetbrains.com/intellij-repository/snapshots/com/jetbrains/intellij/idea/ideaIU/$SNAPSHOT_VERSION/ideaIU-$SNAPSHOT_VERSION.zip" &&
3535
unzip backend.zip &&
3636
rm backend.zip &&
3737
ln -s "ideaIU-$SNAPSHOT_VERSION" . &&
3838
rm -r "ideaIU-$SNAPSHOT_VERSION" &&
3939
cp -r /ide-desktop/backend/jbr . &&
40-
cp /ide-desktop/backend/bin/idea.properties ./bin &&
41-
cp /ide-desktop/backend/bin/idea64.vmoptions ./bin)
40+
cp ./bin/linux/idea.properties ./bin &&
41+
cp ./bin/linux/idea64.vmoptions ./bin)
4242
else
4343
if [[ $JB_QUALIFIER == "stable" ]]; then
4444
PRODUCT_TYPE="release"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright (c) 2022 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
6+
7+
import java.nio.file.Path
8+
9+
interface GitpodCLIHelper {
10+
suspend fun open(file: Path, shouldWait: Boolean)
11+
}

Diff for: components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/GitpodCLIService.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package io.gitpod.jetbrains.remote
66

77
import com.intellij.codeWithMe.ClientId
88
import com.intellij.ide.BrowserUtil
9-
import com.intellij.ide.CommandLineProcessor
109
import com.intellij.openapi.application.ApplicationManager
1110
import com.intellij.openapi.client.ClientSession
1211
import com.intellij.openapi.client.ClientSessionsManager
@@ -40,6 +39,7 @@ class GitpodCLIService : RestService() {
4039

4140
private val manager = service<GitpodManager>()
4241
private val portsService = service<GitpodPortsService>()
42+
private val cliHelperService = service<GitpodCLIHelper>()
4343

4444
override fun getServiceName() = SERVICE_NAME
4545

@@ -71,7 +71,7 @@ class GitpodCLIService : RestService() {
7171
return withClient(request, context) {
7272
GlobalScope.launch {
7373
withContext(Dispatchers.IO) {
74-
CommandLineProcessor.doOpenFileOrProject(file, shouldWait).future.get()
74+
cliHelperService.open(file, shouldWait)
7575
}
7676
}
7777
}

Diff for: components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/GitpodClientProjectSessionTracker.kt

+8-7
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ import com.intellij.ide.BrowserUtil
99
import com.intellij.notification.NotificationAction
1010
import com.intellij.notification.NotificationType
1111
import com.intellij.openapi.Disposable
12-
import com.intellij.openapi.client.ClientProjectSession
12+
import com.intellij.openapi.client.ClientSessionsManager
1313
import com.intellij.openapi.components.service
1414
import com.intellij.openapi.diagnostic.thisLogger
1515
import com.intellij.openapi.fileEditor.FileEditorManagerEvent
1616
import com.intellij.openapi.fileEditor.FileEditorManagerListener
1717
import com.intellij.openapi.fileTypes.LanguageFileType
18+
import com.intellij.openapi.project.Project
1819
import com.intellij.remoteDev.util.onTerminationOrNow
1920
import com.intellij.util.application
2021
import com.jetbrains.rd.util.lifetime.Lifetime
@@ -32,12 +33,11 @@ import java.util.concurrent.CancellationException
3233
import java.util.concurrent.CompletableFuture
3334

3435
@Suppress("UnstableApiUsage", "OPT_IN_USAGE")
35-
class GitpodClientProjectSessionTracker(
36-
private val session: ClientProjectSession
37-
) : Disposable {
36+
class GitpodClientProjectSessionTracker(private val project: Project) : Disposable {
3837

3938
private val manager = service<GitpodManager>()
4039
private val portsService = service<GitpodPortsService>()
40+
private val session = ClientSessionsManager.getProjectSession(project)
4141

4242
private lateinit var info: Info.WorkspaceInfoResponse
4343
private val lifetime = Lifetime.Eternal.createNested()
@@ -89,7 +89,7 @@ class GitpodClientProjectSessionTracker(
8989
notification.addAction(makePublicAction)
9090
}
9191

92-
ClientId.withClientId(session.clientId) {
92+
ClientId.withClientId(session?.clientId) {
9393
notification.notify(null)
9494
}
9595
}
@@ -108,7 +108,7 @@ class GitpodClientProjectSessionTracker(
108108
}
109109

110110
private fun openBrowser(url: String) {
111-
ClientId.withClientId(session.clientId) {
111+
ClientId.withClientId(session?.clientId) {
112112
BrowserUtil.browse(url)
113113
}
114114
}
@@ -196,7 +196,7 @@ class GitpodClientProjectSessionTracker(
196196

197197
private fun registerActiveLanguageAnalytics() {
198198
val activeLanguages = mutableSetOf<String>()
199-
session.project.messageBus.connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, object : FileEditorManagerListener {
199+
project.messageBus.connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, object : FileEditorManagerListener {
200200
override fun selectionChanged(event: FileEditorManagerEvent) {
201201
super.selectionChanged(event)
202202
if (event.manager.selectedEditor == null) {
@@ -219,6 +219,7 @@ class GitpodClientProjectSessionTracker(
219219
}
220220

221221
private fun trackEvent(eventName: String, props: Map<String, Any?>) {
222+
if (session == null) return
222223
manager.trackEvent(eventName, mapOf(
223224
"sessionId" to session.clientId.value
224225
).plus(props))

Diff for: components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/GitpodTerminalService.kt

+21-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@
44

55
package io.gitpod.jetbrains.remote
66

7-
import com.intellij.openapi.client.ClientProjectSession
7+
import com.intellij.openapi.components.service
88
import com.intellij.openapi.diagnostic.thisLogger
9+
import com.intellij.openapi.project.Project
910
import com.intellij.util.application
1011
import com.jediterm.terminal.ui.TerminalWidget
1112
import com.jediterm.terminal.ui.TerminalWidgetListener
13+
import com.jetbrains.rd.platform.codeWithMe.portForwarding.GlobalPortForwardingManager
14+
import com.jetbrains.rd.platform.codeWithMe.portForwarding.ListeningPort
15+
import com.jetbrains.rd.platform.codeWithMe.portForwarding.ListeningPortHandler
16+
import com.jetbrains.rd.platform.codeWithMe.portForwarding.PortListeningOptions
1217
import com.jetbrains.rdserver.terminal.BackendTerminalManager
1318
import io.gitpod.supervisor.api.Status
1419
import io.gitpod.supervisor.api.StatusServiceGrpc
@@ -25,16 +30,17 @@ import java.util.concurrent.ExecutionException
2530
import java.util.concurrent.TimeUnit
2631

2732
@Suppress("UnstableApiUsage")
28-
class GitpodTerminalService(session: ClientProjectSession) {
33+
class GitpodTerminalService(project: Project) {
2934
private companion object {
3035
var hasStarted = false
3136
}
3237

33-
private val terminalView = TerminalView.getInstance(session.project)
34-
private val backendTerminalManager = BackendTerminalManager.getInstance(session.project)
38+
private val terminalView = TerminalView.getInstance(project)
39+
private val backendTerminalManager = BackendTerminalManager.getInstance(project)
3540
private val terminalServiceFutureStub = TerminalServiceGrpc.newFutureStub(GitpodManager.supervisorChannel)
3641
private val terminalServiceStub = TerminalServiceGrpc.newStub(GitpodManager.supervisorChannel)
3742
private val statusServiceStub = StatusServiceGrpc.newStub(GitpodManager.supervisorChannel)
43+
private val globalPortForwardingManager = service<GlobalPortForwardingManager>()
3844

3945
init {
4046
start()
@@ -186,6 +192,17 @@ class GitpodTerminalService(session: ClientProjectSession) {
186192
exitTaskWhenTerminalWidgetGetsClosed(supervisorTerminal, shellTerminalWidget)
187193

188194
listenForTaskTerminationAndTitleChanges(supervisorTerminal, shellTerminalWidget)
195+
196+
globalPortForwardingManager.monitorPortsOfPid(
197+
shellTerminalWidget,
198+
supervisorTerminal.pid,
199+
object : ListeningPortHandler {
200+
override fun onPortListeningStarted(port: ListeningPort) {
201+
thisLogger().warn("gitpod: onPortListeningStarted ${port.portType} ${port.pid} ${port.socketAddress}")
202+
}
203+
},
204+
PortListeningOptions.INCLUDE_SELF_AND_CHILDREN
205+
)
189206
}
190207

191208
private fun listenForTaskTerminationAndTitleChanges(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) 2022 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.latest
6+
7+
import com.intellij.ide.CommandLineProcessor
8+
import io.gitpod.jetbrains.remote.GitpodCLIHelper
9+
import java.nio.file.Path
10+
11+
@Suppress("UnstableApiUsage")
12+
class GitpodCLIHelperImpl : GitpodCLIHelper {
13+
override suspend fun open(file :Path, shouldWait: Boolean) {
14+
CommandLineProcessor.doOpenFileOrProject(file, shouldWait).future.await()
15+
}
16+
}

Diff for: components/ide/jetbrains/backend-plugin/src/main/kotlin/io/gitpod/jetbrains/remote/latest/GitpodPortForwardingService.kt

+35-12
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@
55
package io.gitpod.jetbrains.remote.latest
66

77
import com.intellij.openapi.Disposable
8-
import com.intellij.openapi.client.ClientProjectSession
98
import com.intellij.openapi.components.service
109
import com.intellij.openapi.diagnostic.thisLogger
10+
import com.intellij.openapi.project.Project
1111
import com.intellij.openapi.util.Disposer
1212
import com.intellij.remoteDev.util.onTerminationOrNow
13+
import com.intellij.ui.RowIcon
1314
import com.intellij.util.application
1415
import com.jetbrains.rd.platform.codeWithMe.portForwarding.*
1516
import com.jetbrains.rd.platform.util.lifetime
1617
import com.jetbrains.rd.util.lifetime.LifetimeStatus
1718
import io.gitpod.jetbrains.remote.GitpodIgnoredPortsForNotificationService
1819
import io.gitpod.jetbrains.remote.GitpodManager
1920
import io.gitpod.jetbrains.remote.GitpodPortsService
21+
import io.gitpod.jetbrains.remote.icons.GitpodIcons
2022
import io.gitpod.supervisor.api.Status
2123
import io.gitpod.supervisor.api.StatusServiceGrpc
2224
import io.grpc.stub.ClientCallStreamObserver
@@ -27,7 +29,7 @@ import java.util.concurrent.TimeUnit
2729
import javax.swing.Icon
2830

2931
@Suppress("UnstableApiUsage")
30-
class GitpodPortForwardingService(private val session: ClientProjectSession) {
32+
class GitpodPortForwardingService(private val project: Project) {
3133
companion object {
3234
const val FORWARDED_PORT_LABEL = "gitpod"
3335
}
@@ -46,7 +48,7 @@ class GitpodPortForwardingService(private val session: ClientProjectSession) {
4648
}
4749

4850
private fun observePortsListWhileProjectIsOpen() = application.executeOnPooledThread {
49-
while (session.project.lifetime.status == LifetimeStatus.Alive) {
51+
while (project.lifetime.status == LifetimeStatus.Alive) {
5052
try {
5153
observePortsList().get()
5254
} catch (throwable: Throwable) {
@@ -74,7 +76,7 @@ class GitpodPortForwardingService(private val session: ClientProjectSession) {
7476
val portsStatusResponseObserver = object :
7577
ClientResponseObserver<Status.PortsStatusRequest, Status.PortsStatusResponse> {
7678
override fun beforeStart(request: ClientCallStreamObserver<Status.PortsStatusRequest>) {
77-
session.project.lifetime.onTerminationOrNow { request.cancel("gitpod: Project terminated.", null) }
79+
project.lifetime.onTerminationOrNow { request.cancel("gitpod: Project terminated.", null) }
7880
}
7981
override fun onNext(response: Status.PortsStatusResponse) {
8082
application.invokeLater { updateForwardedPortsList(response) }
@@ -104,14 +106,16 @@ class GitpodPortForwardingService(private val session: ClientProjectSession) {
104106
hostPort,
105107
PortType.TCP,
106108
setOf(FORWARDED_PORT_LABEL),
107-
hostPort,
108-
ClientPortPickingStrategy.REASSIGN_WHEN_BUSY
109-
) {
110-
this.name = port.name
111-
this.description = port.description
112-
this.icon = null
113-
this.tooltip = "Forwarded Port"
114-
}
109+
ClientPortAttributes(hostPort, ClientPortPickingStrategy.REASSIGN_WHEN_BUSY),
110+
)
111+
112+
forwardedPort.presentation.name = port.name
113+
forwardedPort.presentation.description = port.description
114+
val rowIcon = RowIcon(2)
115+
rowIcon.setIcon(GitpodIcons.Logo, 0)
116+
rowIcon.setIcon(GitpodIcons.Logo, 1)
117+
forwardedPort.presentation.icon = rowIcon
118+
forwardedPort.presentation.tooltip = "Forwarded Port"
115119

116120
val portListenerDisposable = portToDisposableMap.getOrPut(hostPort, fun() = Disposer.newDisposable())
117121

@@ -172,6 +176,25 @@ class GitpodPortForwardingService(private val session: ClientProjectSession) {
172176
portsService.removeForwardedPort(hostPort)
173177
thisLogger().info("gitpod: Stopped forwarding port $hostPort.")
174178
}
179+
180+
// if (!isServed && !isForwarded) {
181+
// val exposedPort = perClientPortForwardingManager.exposePort(
182+
// hostPort,
183+
// port.exposed.url,
184+
// setOf(FORWARDED_PORT_LABEL),
185+
// )
186+
//
187+
// exposedPort.presentation.name = port.name
188+
// exposedPort.presentation.description = port.description
189+
// exposedPort.presentation.icon = GitpodIcons.Logo
190+
// exposedPort.presentation.tooltip = "Exposed Port"
191+
// }
192+
//
193+
// perClientPortForwardingManager.getPorts(hostPort).forEach {
194+
// it.presentation.name = port.name
195+
// it.presentation.description = port.description
196+
// thisLogger().warn("gitpod: changing name and description of port $hostPort")
197+
// }
175198
}
176199
}
177200
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) 2022 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.stable
6+
7+
import com.intellij.ide.CommandLineProcessor
8+
import io.gitpod.jetbrains.remote.GitpodCLIHelper
9+
import java.nio.file.Path
10+
11+
@Suppress("UnstableApiUsage")
12+
class GitpodCLIHelperImpl : GitpodCLIHelper {
13+
override suspend fun open(file :Path, shouldWait: Boolean) {
14+
CommandLineProcessor.doOpenFileOrProject(file, shouldWait).future.get()
15+
}
16+
}

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
<idea-plugin>
88
<extensions defaultExtensionNs="com.intellij">
99
<applicationService serviceInterface="io.gitpod.jetbrains.remote.GitpodIgnoredPortsForNotificationService" serviceImplementation="io.gitpod.jetbrains.remote.latest.GitpodIgnoredPortsForNotificationServiceImpl" preload="true"/>
10-
<projectService serviceImplementation="io.gitpod.jetbrains.remote.latest.GitpodPortForwardingService" preload="true" client="guest"/>
10+
<applicationService serviceInterface="io.gitpod.jetbrains.remote.GitpodCLIHelper" serviceImplementation="io.gitpod.jetbrains.remote.latest.GitpodCLIHelperImpl" preload="true"/>
11+
<projectService serviceImplementation="io.gitpod.jetbrains.remote.GitpodClientProjectSessionTracker" client="controller" preload="true"/>
12+
<projectService serviceImplementation="io.gitpod.jetbrains.remote.GitpodTerminalService" client="controller" preload="true"/>
13+
<projectService serviceImplementation="io.gitpod.jetbrains.remote.latest.GitpodPortForwardingService" preload="true" client="controller"/>
1114
</extensions>
1215
</idea-plugin>

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

+3
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
<idea-plugin>
88
<extensions defaultExtensionNs="com.intellij">
99
<applicationService serviceInterface="io.gitpod.jetbrains.remote.GitpodIgnoredPortsForNotificationService" serviceImplementation="io.gitpod.jetbrains.remote.stable.GitpodIgnoredPortsForNotificationServiceImpl" preload="true"/>
10+
<applicationService serviceInterface="io.gitpod.jetbrains.remote.GitpodCLIHelper" serviceImplementation="io.gitpod.jetbrains.remote.stable.GitpodCLIHelperImpl" preload="true"/>
11+
<projectService serviceImplementation="io.gitpod.jetbrains.remote.GitpodClientProjectSessionTracker" client="guest" preload="true"/>
12+
<projectService serviceImplementation="io.gitpod.jetbrains.remote.GitpodTerminalService" client="guest" preload="true"/>
1013
</extensions>
1114
</idea-plugin>

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

-4
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@
2828
<applicationService serviceImplementation="io.gitpod.jetbrains.remote.GitpodPortsService" preload="true"/>
2929
<notificationGroup id="Gitpod Notifications" displayType="BALLOON" isLogByDefault="false"/>
3030
<httpRequestHandler implementation="io.gitpod.jetbrains.remote.GitpodCLIService"/>
31-
<projectService serviceImplementation="io.gitpod.jetbrains.remote.GitpodClientProjectSessionTracker"
32-
client="guest" preload="true"/>
3331
<projectService serviceImplementation="io.gitpod.jetbrains.remote.GitpodProjectManager" preload="true"/>
34-
<projectService serviceImplementation="io.gitpod.jetbrains.remote.GitpodTerminalService" client="guest"
35-
preload="true"/>
3632
<gateway.customization.name
3733
implementation="io.gitpod.jetbrains.remote.GitpodGatewayClientCustomizationProvider"/>
3834
<gateway.customization.performance id="gitpodMetricsControl" order="before cpuControl"

0 commit comments

Comments
 (0)