Skip to content

Commit bf05f06

Browse files
committed
fix #6508: Allow users to define Jetbrains plugins to be installed on a given project
1 parent e99c65f commit bf05f06

File tree

14 files changed

+327
-97
lines changed

14 files changed

+327
-97
lines changed

components/gitpod-protocol/data/gitpod-schema.json

+15
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,21 @@
247247
}
248248
}
249249
},
250+
"jetbrains": {
251+
"type": "object",
252+
"description": "Configure JetBrains integration",
253+
"deprecationMessage": "The 'jetbrains' property is experimental.",
254+
"additionalProperties": false,
255+
"properties": {
256+
"plugins": {
257+
"type": "array",
258+
"description": "List of plugins which should be installed for users of this workspace. From the JetBrains Marketplace page, find a page of the required plugin, select 'Versions' tab, click any version to copy pluginId (short name such as org.rust.lang) of the plugin you want to install.",
259+
"items": {
260+
"type": "string"
261+
}
262+
}
263+
}
264+
},
250265
"experimentalNetwork": {
251266
"type": "boolean",
252267
"deprecationMessage": "The 'experimentalNetwork' property is deprecated.",

components/gitpod-protocol/go/gitpod-config-types.go

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/ide/jetbrains/backend-plugin/BUILD.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ packages:
1414
- "src/main/resources/*"
1515
config:
1616
commands:
17+
- ["./gradlew", "-PsupervisorApiProjectPath=components-supervisor-api-java--lib/", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "runPluginVerifier"]
1718
- ["./gradlew", "-PsupervisorApiProjectPath=components-supervisor-api-java--lib/", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "buildPlugin"]

components/ide/jetbrains/backend-plugin/gradle.properties

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ pluginName=gitpod-remote
66
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
77
# for insight into build numbers and IntelliJ Platform versions.
88
pluginSinceBuild=213
9-
pluginUntilBuild=213.*
9+
pluginUntilBuild=221.*
1010
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
1111
# See https://jb.gg/intellij-platform-builds-list for available build versions.
12-
pluginVerifierIdeVersions=2021.3.1
12+
pluginVerifierIdeVersions=2021.3, 2022.1
1313
# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
1414
platformType=IU
15-
platformVersion=213.6777.52
15+
platformVersion=221.4994-EAP-CANDIDATE-SNAPSHOT
1616
platformDownloadSources=true
1717
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
1818
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22

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

-41
This file was deleted.

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

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import com.intellij.openapi.client.ClientSessionsManager
1212
import com.intellij.openapi.diagnostic.thisLogger
1313
import com.intellij.openapi.project.Project
1414
import com.intellij.openapi.util.io.FileUtilRt
15+
import com.intellij.util.application
1516
import io.netty.channel.ChannelHandlerContext
1617
import io.netty.handler.codec.http.FullHttpRequest
1718
import io.netty.handler.codec.http.QueryStringDecoder
@@ -25,6 +26,9 @@ class GitpodCLIService : RestService() {
2526
override fun getServiceName() = SERVICE_NAME
2627

2728
override fun execute(urlDecoder: QueryStringDecoder, request: FullHttpRequest, context: ChannelHandlerContext): String? {
29+
if (application.isHeadlessEnvironment) {
30+
return "not supported in headless mode"
31+
}
2832
val operation = getStringParameter("op", urlDecoder)
2933
if (operation == "open") {
3034
val fileStr = getStringParameter("file", urlDecoder)

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

+11-1
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ import com.intellij.openapi.components.Service
1313
import com.intellij.openapi.diagnostic.thisLogger
1414
import com.intellij.openapi.extensions.PluginId
1515
import com.intellij.remoteDev.util.onTerminationOrNow
16+
import com.intellij.util.application
1617
import com.jetbrains.rd.util.lifetime.Lifetime
1718
import git4idea.config.GitVcsApplicationSettings
1819
import io.gitpod.gitpodprotocol.api.GitpodClient
1920
import io.gitpod.gitpodprotocol.api.GitpodServerLauncher
2021
import io.gitpod.jetbrains.remote.services.HeartbeatService
22+
import io.gitpod.jetbrains.remote.utils.Retrier.retry
2123
import io.gitpod.supervisor.api.*
2224
import io.gitpod.supervisor.api.Info.WorkspaceInfoResponse
2325
import io.gitpod.supervisor.api.Notification.*
@@ -40,7 +42,6 @@ import java.time.Duration
4042
import java.util.concurrent.CancellationException
4143
import java.util.concurrent.CompletableFuture
4244
import javax.websocket.DeploymentException
43-
import io.gitpod.jetbrains.remote.utils.Retrier.retry
4445

4546
@Service
4647
class GitpodManager : Disposable {
@@ -60,6 +61,9 @@ class GitpodManager : Disposable {
6061

6162
init {
6263
GlobalScope.launch {
64+
if (application.isHeadlessEnvironment) {
65+
return@launch
66+
}
6367
try {
6468
val backendPort = BuiltInServerManager.getInstance().waitForStart().port
6569
val httpClient = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.ALWAYS)
@@ -93,6 +97,9 @@ class GitpodManager : Disposable {
9397

9498
private val notificationGroup = NotificationGroupManager.getInstance().getNotificationGroup("Gitpod Notifications")
9599
private val notificationsJob = GlobalScope.launch {
100+
if (application.isHeadlessEnvironment) {
101+
return@launch
102+
}
96103
val notifications = NotificationServiceGrpc.newStub(supervisorChannel)
97104
val futureNotifications = NotificationServiceGrpc.newFutureStub(supervisorChannel)
98105
while (isActive) {
@@ -156,6 +163,9 @@ class GitpodManager : Disposable {
156163

157164
val pendingInfo = CompletableFuture<WorkspaceInfoResponse>()
158165
private val infoJob = GlobalScope.launch {
166+
if (application.isHeadlessEnvironment) {
167+
return@launch
168+
}
159169
try {
160170
// TODO(ak) replace retry with proper handling of grpc errors
161171
val infoResponse = retry(3) {

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import com.intellij.openapi.project.ModuleListener
1212
import com.intellij.openapi.project.Project
1313
import com.intellij.openapi.projectRoots.ProjectJdkTable
1414
import com.intellij.openapi.projectRoots.Sdk
15-
import com.intellij.openapi.roots.ModuleRootManager
1615
import com.intellij.openapi.roots.ModuleRootModificationUtil
1716
import com.intellij.openapi.roots.ProjectRootManager
1817
import com.intellij.util.application
@@ -26,10 +25,17 @@ class GitpodProjectManager(
2625
private val project: Project
2726
) {
2827

28+
init {
29+
configureSdks()
30+
}
31+
2932
/**
3033
* It is a workaround for https://youtrack.jetbrains.com/issue/GTW-88
3134
*/
32-
init {
35+
private fun configureSdks() {
36+
if (application.isHeadlessEnvironment) {
37+
return
38+
}
3339
val pendingSdk = CompletableFuture<Sdk>()
3440
application.invokeLaterOnWriteThread {
3541
application.runWriteAction {

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

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
<id>io.gitpod.jetbrains.remote</id>
99
<name>Gitpod Remote</name>
1010
<vendor>Gitpod</vendor>
11+
<description>Provides integrations within a Gitpod workspace.</description>
12+
1113

1214
<!-- Product and plugin compatibility requirements -->
1315
<!-- https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html -->
16+
<depends>com.intellij.modules.platform</depends>
1417
<dependencies>
15-
<plugin id="com.intellij.modules.platform"/>
1618
<plugin id="Git4Idea"/>
1719
</dependencies>
1820

@@ -22,9 +24,6 @@
2224
<notificationGroup id="Gitpod Notifications" displayType="BALLOON" isLogByDefault="false" />
2325
<httpRequestHandler implementation="io.gitpod.jetbrains.remote.GitpodCLIService"/>
2426
<projectService serviceImplementation="io.gitpod.jetbrains.remote.GitpodClientProjectSessionTracker" client="guest" preload="true"/>
25-
<!-- <applicationService serviceImplementation="io.gitpod.jetbrains.remote.GitpodBranding"
26-
serviceInterface="com.intellij.remoteDev.customization.GatewayBranding"
27-
overrides="true" /> -->
2827
<projectService serviceImplementation="io.gitpod.jetbrains.remote.GitpodProjectManager" preload="true"/>
2928
</extensions>
3029

components/ide/jetbrains/image/startup.sh

+1-11
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ set -euo pipefail
88
# kill background jobs when the script exits
99
trap "jobs -p | xargs -r kill" SIGINT SIGTERM EXIT
1010

11-
/ide-desktop/status "$1" "$2" &
12-
13-
echo "Desktop IDE: Waiting for the content initializer ..."
14-
until curl -sS "$SUPERVISOR_ADDR"/_supervisor/v1/status/content/wait/true | grep '"available":true' > /dev/null; do
15-
sleep 1
16-
done
17-
echo "Desktop IDE: Content available."
18-
1911
# instead put them into /ide-desktop/backend/bin/idea64.vmoptions
2012
# otherwise JB will complain to a user on each startup
2113
# by default remote dev already set -Xmx2048m, see /ide-desktop/backend/plugins/remote-dev-server/bin/launcher.sh
@@ -33,6 +25,4 @@ export IJ_HOST_SYSTEM_BASE_DIR=/workspace/.cache/JetBrains
3325
# Enable host status endpoint
3426
export CWM_HOST_STATUS_OVER_HTTP_TOKEN=gitpod
3527

36-
/ide-desktop/backend/bin/remote-dev-server.sh run "$GITPOD_REPO_ROOT"
37-
38-
echo "Desktop IDE startup script exited"
28+
/ide-desktop/status "$1" "$2"

components/ide/jetbrains/image/status/BUILD.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ packages:
99
- CGO_ENABLED=0
1010
- GOOS=linux
1111
deps:
12+
- components/gitpod-protocol/go:lib
1213
- components/supervisor-api/go:lib
14+
- components/common-go:lib
1315
config:
1416
packaging: app
17+
buildCommand: ["go", "build", "-trimpath", "-ldflags", "-buildid= -w -s -X 'github.com/gitpod-io/gitpod/jetbrains/status.Version=commit-${__git_commit}'"]

components/ide/jetbrains/image/status/go.mod

+20-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,33 @@ module github.com/gitpod-io/gitpod/jetbrains/status
22

33
go 1.17
44

5-
replace github.com/gitpod-io/gitpod/supervisor/api => ../../../../supervisor-api/go // leeway
6-
75
require github.com/gitpod-io/gitpod/supervisor/api v0.0.0-00010101000000-000000000000
86

97
require (
8+
github.com/golang/mock v1.6.0 // indirect
9+
github.com/gorilla/websocket v1.4.2 // indirect
10+
github.com/sirupsen/logrus v1.8.1 // indirect
11+
github.com/sourcegraph/jsonrpc2 v0.0.0-20200429184054-15c2290dcb37 // indirect
12+
)
13+
14+
require (
15+
github.com/gitpod-io/gitpod/common-go v0.0.0-00010101000000-000000000000
16+
github.com/gitpod-io/gitpod/gitpod-protocol v0.0.0-00010101000000-000000000000
1017
github.com/golang/protobuf v1.5.2 // indirect
1118
github.com/grpc-ecosystem/grpc-gateway/v2 v2.5.0 // indirect
12-
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
13-
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
14-
golang.org/x/text v0.3.5 // indirect
19+
github.com/hashicorp/go-version v1.4.0
20+
golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect
21+
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
22+
golang.org/x/text v0.3.7 // indirect
1523
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
1624
google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced // indirect
1725
google.golang.org/grpc v1.39.1
1826
google.golang.org/protobuf v1.27.1 // indirect
27+
gopkg.in/yaml.v2 v2.4.0
1928
)
29+
30+
replace github.com/gitpod-io/gitpod/common-go => ../../../../common-go // leeway
31+
32+
replace github.com/gitpod-io/gitpod/gitpod-protocol => ../../../../gitpod-protocol/go // leeway
33+
34+
replace github.com/gitpod-io/gitpod/supervisor/api => ../../../../supervisor-api/go // leeway

0 commit comments

Comments
 (0)