Skip to content

Commit

Permalink
fix #6508: Allow users to define Jetbrains plugins to be installed on…
Browse files Browse the repository at this point in the history
… a given project
  • Loading branch information
akosyakov authored and roboquat committed Apr 7, 2022
1 parent 9b80bb7 commit 584f8d9
Show file tree
Hide file tree
Showing 14 changed files with 327 additions and 97 deletions.
15 changes: 15 additions & 0 deletions components/gitpod-protocol/data/gitpod-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,21 @@
}
}
},
"jetbrains": {
"type": "object",
"description": "Configure JetBrains integration",
"deprecationMessage": "The 'jetbrains' property is experimental.",
"additionalProperties": false,
"properties": {
"plugins": {
"type": "array",
"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.",
"items": {
"type": "string"
}
}
}
},
"experimentalNetwork": {
"type": "boolean",
"deprecationMessage": "The 'experimentalNetwork' property is deprecated.",
Expand Down
10 changes: 10 additions & 0 deletions components/gitpod-protocol/go/gitpod-config-types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions components/ide/jetbrains/backend-plugin/BUILD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ packages:
- "src/main/resources/*"
config:
commands:
- ["./gradlew", "-PsupervisorApiProjectPath=components-supervisor-api-java--lib/", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "runPluginVerifier"]
- ["./gradlew", "-PsupervisorApiProjectPath=components-supervisor-api-java--lib/", "-PgitpodProtocolProjectPath=components-gitpod-protocol-java--lib/", "buildPlugin"]
6 changes: 3 additions & 3 deletions components/ide/jetbrains/backend-plugin/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ pluginName=gitpod-remote
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
pluginSinceBuild=213
pluginUntilBuild=213.*
pluginUntilBuild=221.*
# 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=2021.3.1
pluginVerifierIdeVersions=2021.3, 2022.1
# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
platformType=IU
platformVersion=213.6777.52
platformVersion=221.4994-EAP-CANDIDATE-SNAPSHOT
platformDownloadSources=true
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.intellij.openapi.client.ClientSessionsManager
import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.io.FileUtilRt
import com.intellij.util.application
import io.netty.channel.ChannelHandlerContext
import io.netty.handler.codec.http.FullHttpRequest
import io.netty.handler.codec.http.QueryStringDecoder
Expand All @@ -25,6 +26,9 @@ class GitpodCLIService : RestService() {
override fun getServiceName() = SERVICE_NAME

override fun execute(urlDecoder: QueryStringDecoder, request: FullHttpRequest, context: ChannelHandlerContext): String? {
if (application.isHeadlessEnvironment) {
return "not supported in headless mode"
}
val operation = getStringParameter("op", urlDecoder)
if (operation == "open") {
val fileStr = getStringParameter("file", urlDecoder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ import com.intellij.openapi.components.Service
import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.extensions.PluginId
import com.intellij.remoteDev.util.onTerminationOrNow
import com.intellij.util.application
import com.jetbrains.rd.util.lifetime.Lifetime
import git4idea.config.GitVcsApplicationSettings
import io.gitpod.gitpodprotocol.api.GitpodClient
import io.gitpod.gitpodprotocol.api.GitpodServerLauncher
import io.gitpod.jetbrains.remote.services.HeartbeatService
import io.gitpod.jetbrains.remote.utils.Retrier.retry
import io.gitpod.supervisor.api.*
import io.gitpod.supervisor.api.Info.WorkspaceInfoResponse
import io.gitpod.supervisor.api.Notification.*
Expand All @@ -40,7 +42,6 @@ import java.time.Duration
import java.util.concurrent.CancellationException
import java.util.concurrent.CompletableFuture
import javax.websocket.DeploymentException
import io.gitpod.jetbrains.remote.utils.Retrier.retry

@Service
class GitpodManager : Disposable {
Expand All @@ -60,6 +61,9 @@ class GitpodManager : Disposable {

init {
GlobalScope.launch {
if (application.isHeadlessEnvironment) {
return@launch
}
try {
val backendPort = BuiltInServerManager.getInstance().waitForStart().port
val httpClient = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.ALWAYS)
Expand Down Expand Up @@ -93,6 +97,9 @@ class GitpodManager : Disposable {

private val notificationGroup = NotificationGroupManager.getInstance().getNotificationGroup("Gitpod Notifications")
private val notificationsJob = GlobalScope.launch {
if (application.isHeadlessEnvironment) {
return@launch
}
val notifications = NotificationServiceGrpc.newStub(supervisorChannel)
val futureNotifications = NotificationServiceGrpc.newFutureStub(supervisorChannel)
while (isActive) {
Expand Down Expand Up @@ -156,6 +163,9 @@ class GitpodManager : Disposable {

val pendingInfo = CompletableFuture<WorkspaceInfoResponse>()
private val infoJob = GlobalScope.launch {
if (application.isHeadlessEnvironment) {
return@launch
}
try {
// TODO(ak) replace retry with proper handling of grpc errors
val infoResponse = retry(3) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.intellij.openapi.project.ModuleListener
import com.intellij.openapi.project.Project
import com.intellij.openapi.projectRoots.ProjectJdkTable
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.roots.ModuleRootManager
import com.intellij.openapi.roots.ModuleRootModificationUtil
import com.intellij.openapi.roots.ProjectRootManager
import com.intellij.util.application
Expand All @@ -26,10 +25,17 @@ class GitpodProjectManager(
private val project: Project
) {

init {
configureSdks()
}

/**
* It is a workaround for https://youtrack.jetbrains.com/issue/GTW-88
*/
init {
private fun configureSdks() {
if (application.isHeadlessEnvironment) {
return
}
val pendingSdk = CompletableFuture<Sdk>()
application.invokeLaterOnWriteThread {
application.runWriteAction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
<id>io.gitpod.jetbrains.remote</id>
<name>Gitpod Remote</name>
<vendor>Gitpod</vendor>
<description>Provides integrations within a Gitpod workspace.</description>


<!-- Product and plugin compatibility requirements -->
<!-- https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html -->
<depends>com.intellij.modules.platform</depends>
<dependencies>
<plugin id="com.intellij.modules.platform"/>
<plugin id="Git4Idea"/>
</dependencies>

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

Expand Down
12 changes: 1 addition & 11 deletions components/ide/jetbrains/image/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ set -euo pipefail
# kill background jobs when the script exits
trap "jobs -p | xargs -r kill" SIGINT SIGTERM EXIT

/ide-desktop/status "$1" "$2" &

echo "Desktop IDE: Waiting for the content initializer ..."
until curl -sS "$SUPERVISOR_ADDR"/_supervisor/v1/status/content/wait/true | grep '"available":true' > /dev/null; do
sleep 1
done
echo "Desktop IDE: Content available."

# instead put them into /ide-desktop/backend/bin/idea64.vmoptions
# otherwise JB will complain to a user on each startup
# by default remote dev already set -Xmx2048m, see /ide-desktop/backend/plugins/remote-dev-server/bin/launcher.sh
Expand All @@ -33,6 +25,4 @@ export IJ_HOST_SYSTEM_BASE_DIR=/workspace/.cache/JetBrains
# Enable host status endpoint
export CWM_HOST_STATUS_OVER_HTTP_TOKEN=gitpod

/ide-desktop/backend/bin/remote-dev-server.sh run "$GITPOD_REPO_ROOT"

echo "Desktop IDE startup script exited"
/ide-desktop/status "$1" "$2"
3 changes: 3 additions & 0 deletions components/ide/jetbrains/image/status/BUILD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ packages:
- CGO_ENABLED=0
- GOOS=linux
deps:
- components/gitpod-protocol/go:lib
- components/supervisor-api/go:lib
- components/common-go:lib
config:
packaging: app
buildCommand: ["go", "build", "-trimpath", "-ldflags", "-buildid= -w -s -X 'github.com/gitpod-io/gitpod/jetbrains/status.Version=commit-${__git_commit}'"]
25 changes: 20 additions & 5 deletions components/ide/jetbrains/image/status/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,33 @@ module github.com/gitpod-io/gitpod/jetbrains/status

go 1.17

replace github.com/gitpod-io/gitpod/supervisor/api => ../../../../supervisor-api/go // leeway

require github.com/gitpod-io/gitpod/supervisor/api v0.0.0-00010101000000-000000000000

require (
github.com/golang/mock v1.6.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/sourcegraph/jsonrpc2 v0.0.0-20200429184054-15c2290dcb37 // indirect
)

require (
github.com/gitpod-io/gitpod/common-go v0.0.0-00010101000000-000000000000
github.com/gitpod-io/gitpod/gitpod-protocol v0.0.0-00010101000000-000000000000
github.com/golang/protobuf v1.5.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.5.0 // indirect
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
golang.org/x/text v0.3.5 // indirect
github.com/hashicorp/go-version v1.4.0
golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced // indirect
google.golang.org/grpc v1.39.1
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/yaml.v2 v2.4.0
)

replace github.com/gitpod-io/gitpod/common-go => ../../../../common-go // leeway

replace github.com/gitpod-io/gitpod/gitpod-protocol => ../../../../gitpod-protocol/go // leeway

replace github.com/gitpod-io/gitpod/supervisor/api => ../../../../supervisor-api/go // leeway
Loading

0 comments on commit 584f8d9

Please sign in to comment.