From 25ec374ff733c89a0c38de96bd0b6bc0bbd5c372 Mon Sep 17 00:00:00 2001 From: Luca Di Maio Date: Wed, 29 May 2024 16:01:44 +0200 Subject: [PATCH] feat(ide): add RustRover support Signed-off-by: Luca Di Maio --- cmd/agent/container/setup.go | 8 +- cmd/up.go | 2 + desktop/src/images/rustrover.svg | 132 +++++++++++++++++++++++++++++++ main.go | 4 +- pkg/config/ide.go | 1 + pkg/driver/docker/docker.go | 2 + pkg/ide/ideparse/parse.go | 6 ++ pkg/ide/jetbrains/rustrover.go | 39 +++++++++ 8 files changed, 189 insertions(+), 5 deletions(-) create mode 100644 desktop/src/images/rustrover.svg create mode 100644 pkg/ide/jetbrains/rustrover.go diff --git a/cmd/agent/container/setup.go b/cmd/agent/container/setup.go index 46391c9e2..c25e187db 100644 --- a/cmd/agent/container/setup.go +++ b/cmd/agent/container/setup.go @@ -385,6 +385,8 @@ func (cmd *SetupContainerCmd) installIDE(setupInfo *config.Result, ide *provider return cmd.setupOpenVSCode(setupInfo, ide.Options, log) case string(config2.IDEGoland): return jetbrains.NewGolandServer(config.GetRemoteUser(setupInfo), ide.Options, log).Install() + case string(config2.IDERustRover): + return jetbrains.NewRustRoverServer(config.GetRemoteUser(setupInfo), ide.Options, log).Install() case string(config2.IDEPyCharm): return jetbrains.NewPyCharmServer(config.GetRemoteUser(setupInfo), ide.Options, log).Install() case string(config2.IDEPhpStorm): @@ -443,9 +445,11 @@ func (cmd *SetupContainerCmd) setupVSCode(setupInfo *config.Result, ideOptions m return nil, err } - args := []string{"agent", "container", "vscode-async", + args := []string{ + "agent", "container", "vscode-async", "--setup-info", cmd.SetupInfo, - "--release-channel", string(releaseChannel)} + "--release-channel", string(releaseChannel), + } return exec.Command(binaryPath, args...), nil }) diff --git a/cmd/up.go b/cmd/up.go index 8e01ad9dd..0a9e8e414 100644 --- a/cmd/up.go +++ b/cmd/up.go @@ -257,6 +257,8 @@ func (cmd *UpCmd) Run( cmd.GitToken, log, ) + case string(config.IDERustRover): + return jetbrains.NewRustRoverServer(config2.GetRemoteUser(result), ideConfig.Options, log).OpenGateway(result.SubstitutionContext.ContainerWorkspaceFolder, client.Workspace()) case string(config.IDEGoland): return jetbrains.NewGolandServer(config2.GetRemoteUser(result), ideConfig.Options, log).OpenGateway(result.SubstitutionContext.ContainerWorkspaceFolder, client.Workspace()) case string(config.IDEPyCharm): diff --git a/desktop/src/images/rustrover.svg b/desktop/src/images/rustrover.svg new file mode 100644 index 000000000..bd5621c57 --- /dev/null +++ b/desktop/src/images/rustrover.svg @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/main.go b/main.go index 9c5003366..1e0e2b47f 100644 --- a/main.go +++ b/main.go @@ -1,8 +1,6 @@ package main -import ( - "github.com/loft-sh/devpod/cmd" -) +import "github.com/loft-sh/devpod/cmd" func main() { cmd.Execute() diff --git a/pkg/config/ide.go b/pkg/config/ide.go index 6d57d8c81..a97729645 100644 --- a/pkg/config/ide.go +++ b/pkg/config/ide.go @@ -9,6 +9,7 @@ const ( IDEOpenVSCode IDE = "openvscode" IDEIntellij IDE = "intellij" IDEGoland IDE = "goland" + IDERustRover IDE = "rustrover" IDEPyCharm IDE = "pycharm" IDEPhpStorm IDE = "phpstorm" IDECLion IDE = "clion" diff --git a/pkg/driver/docker/docker.go b/pkg/driver/docker/docker.go index a3bfd1d11..1e78f5651 100644 --- a/pkg/driver/docker/docker.go +++ b/pkg/driver/docker/docker.go @@ -292,6 +292,8 @@ func (d *dockerDriver) RunDockerDevContainer( switch ide { case string(config2.IDEGoland): args = append(args, "--mount", jetbrains.NewGolandServer("", ideOptions, d.Log).GetVolume()) + case string(config2.IDERustRover): + args = append(args, "--mount", jetbrains.NewRustRoverServer("", ideOptions, d.Log).GetVolume()) case string(config2.IDEPyCharm): args = append(args, "--mount", jetbrains.NewPyCharmServer("", ideOptions, d.Log).GetVolume()) case string(config2.IDEPhpStorm): diff --git a/pkg/ide/ideparse/parse.go b/pkg/ide/ideparse/parse.go index ecd7e2bf0..579973859 100644 --- a/pkg/ide/ideparse/parse.go +++ b/pkg/ide/ideparse/parse.go @@ -59,6 +59,12 @@ var AllowedIDEs = []AllowedIDE{ Options: jetbrains.GolandOptions, Icon: "https://devpod.sh/assets/goland.svg", }, + { + Name: config.IDERustRover, + DisplayName: "RustRover", + Options: jetbrains.RustRoverOptions, + Icon: "https://devpod.sh/assets/rustrover.svg", + }, { Name: config.IDEPyCharm, DisplayName: "PyCharm", diff --git a/pkg/ide/jetbrains/rustrover.go b/pkg/ide/jetbrains/rustrover.go new file mode 100644 index 000000000..7a81f68a5 --- /dev/null +++ b/pkg/ide/jetbrains/rustrover.go @@ -0,0 +1,39 @@ +package jetbrains + +import ( + "github.com/loft-sh/devpod/pkg/config" + "github.com/loft-sh/devpod/pkg/ide" + "github.com/loft-sh/log" +) + +const ( + RustRoverProductCode = "RR" + RustRoverDownloadAmd64Template = "https://download.jetbrains.com/rust/rustrover-%s.tar.gz" + RustRoverDownloadArm64Template = "https://download.jetbrains.com/rust/rustrover-%s-aarch64.tar.gz" +) + +var RustRoverOptions = ide.Options{ + VersionOption: { + Name: VersionOption, + Description: "The version for the binary", + Default: "latest", + }, + DownloadArm64Option: { + Name: DownloadArm64Option, + Description: "The download url for the arm64 server binary", + }, + DownloadAmd64Option: { + Name: DownloadAmd64Option, + Description: "The download url for the amd64 server binary", + }, +} + +func NewRustRoverServer(userName string, values map[string]config.OptionValue, log log.Logger) *GenericJetBrainsServer { + amd64Download, arm64Download := getDownloadURLs(RustRoverOptions, values, RustRoverProductCode, RustRoverDownloadAmd64Template, RustRoverDownloadArm64Template) + return newGenericServer(userName, &GenericOptions{ + ID: "rustrover", + DisplayName: "RustRover", + DownloadAmd64: amd64Download, + DownloadArm64: arm64Download, + }, log) +}