Skip to content

[JetBrains] Add Rider & CLion to beta #14524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/jetbrains-auto-update-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ jobs:
echo $IDE_VERSION
- name: Leeway build
if: ${{ steps.ide-version.outputs.result }}
env:
LEEWAY_MAX_PROVENANCE_BUNDLE_SIZE: '8388608'
run: |
gcloud auth configure-docker --quiet
export LEEWAY_WORKSPACE_ROOT=$(pwd)
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/jetbrains-auto-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,21 @@ jobs:
projectId: ${{ secrets.GCP_PROJECT_ID }}
serviceAccountKey: ${{ secrets.GCP_SA_KEY }}
slackWebhook: ${{ secrets.IDE_SLACK_WEBHOOK }}
rider:
uses: ./.github/workflows/jetbrains-auto-update-template.yml
with:
productId: rider
productCode: RD
secrets:
projectId: ${{ secrets.GCP_PROJECT_ID }}
serviceAccountKey: ${{ secrets.GCP_SA_KEY }}
slackWebhook: ${{ secrets.IDE_SLACK_WEBHOOK }}
clion:
uses: ./.github/workflows/jetbrains-auto-update-template.yml
with:
productId: clion
productCode: CL
secrets:
projectId: ${{ secrets.GCP_PROJECT_ID }}
serviceAccountKey: ${{ secrets.GCP_SA_KEY }}
slackWebhook: ${{ secrets.IDE_SLACK_WEBHOOK }}
2 changes: 2 additions & 0 deletions WORKSPACE.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ defaultArgs:
phpstormDownloadUrl: "https://download.jetbrains.com/webide/PhpStorm-2022.2.3.tar.gz"
rubymineDownloadUrl: "https://download.jetbrains.com/ruby/RubyMine-2022.2.3.tar.gz"
webstormDownloadUrl: "https://download.jetbrains.com/webstorm/WebStorm-2022.2.3.tar.gz"
riderDownloadUrl: "https://download.jetbrains.com/rider/JetBrains.Rider-2022.2.3.tar.gz"
clionDownloadUrl: "https://download.jetbrains.com/cpp/CLion-2022.2.3.tar.gz"
REPLICATED_API_TOKEN: ""
REPLICATED_APP: ""
provenance:
Expand Down
4 changes: 4 additions & 0 deletions components/BUILD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ packages:
- components/ide/jetbrains/image:rubymine-latest
- components/ide/jetbrains/image:webstorm
- components/ide/jetbrains/image:webstorm-latest
- components/ide/jetbrains/image:rider
- components/ide/jetbrains/image:rider-latest
- components/ide/jetbrains/image:clion
- components/ide/jetbrains/image:clion-latest
- components/image-builder-bob:docker
- components/image-builder-mk3:docker
- components/local-app:docker
Expand Down
2 changes: 1 addition & 1 deletion components/dashboard/src/settings/SelectIDE.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default function SelectIDE(props: SelectIDEProps) {
<>
{allIdeOptions && (
<>
<div className={`my-4 gap-3 flex flex-wrap max-w-2xl`}>
<div className={`my-4 gap-3 flex flex-wrap max-w-3xl`}>
{allIdeOptions.map(([id, option]) => {
const selected = defaultIde === id;
const onSelect = () => actuallySetDefaultIde(id);
Expand Down
2 changes: 1 addition & 1 deletion components/dashboard/src/settings/SelectIDEModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function (props: SelectIDEModalProps) {
visible={visible}
onClose={handleContinue}
closeable={true}
className="max-w-2xl"
className="max-w-51.5"
buttons={<button onClick={handleContinue}>Continue</button>}
>
<p className="text-gray-500 dark:text-gray-400 text-base pb-3">
Expand Down
4 changes: 4 additions & 0 deletions components/dashboard/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ module.exports = {
112: "28rem",
128: "32rem",
},
maxWidth: {
// TODO(andreafalzetti): remove custom ide-modal class once we implement https://github.com/gitpod-io/gitpod/issues/13116
51.5: "51.5rem",
},
},
fontFamily: {
sans: [
Expand Down
8 changes: 8 additions & 0 deletions components/gitpod-protocol/data/gitpod-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,14 @@
"webstorm": {
"$ref": "#/definitions/jetbrainsProduct",
"description": "Configure WebStorm integration"
},
"rider": {
"$ref": "#/definitions/jetbrainsProduct",
"description": "Configure Rider integration"
},
"clion": {
"$ref": "#/definitions/jetbrainsProduct",
"description": "Configure CLion integration"
}
}
},
Expand Down
36 changes: 36 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.

2 changes: 2 additions & 0 deletions components/gitpod-protocol/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,8 @@ export interface JetBrainsConfig {
phpstorm?: JetBrainsProductConfig;
rubymine?: JetBrainsProductConfig;
webstorm?: JetBrainsProductConfig;
rider?: JetBrainsProductConfig;
clion?: JetBrainsProductConfig;
}
export interface JetBrainsProductConfig {
prebuilds?: JetBrainsPrebuilds;
Expand Down
1 change: 1 addition & 0 deletions components/ide-proxy/static/image/ide-logo/clionLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions components/ide-proxy/static/image/ide-logo/riderLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions components/ide/jetbrains/image/BUILD.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ const ideConfigs = [
name: "webstorm",
productCode: "WS",
},
{
name: "rider",
productCode: "RD",
},
{
name: "clion",
productCode: "CL",
},
];

const packages = [];
Expand Down
14 changes: 14 additions & 0 deletions components/ide/jetbrains/image/gha-update-image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ const IDEs = [
productType: "release",
exampleRepo: "https://github.com/gitpod-io/template-jetbrains-webstorm",
},
{
productName: "Rider",
productId: "rider",
productCode: "RD",
productType: "release",
exampleRepo: "https://github.com/gitpod-io/template-dotnet-core-cli-csharp",
},
{
productName: "CLion",
productId: "clion",
productCode: "CL",
productType: "release",
exampleRepo: "https://github.com/gitpod-io/template-cpp",
},
];

(async () => {
Expand Down
2 changes: 1 addition & 1 deletion components/ide/jetbrains/image/hot-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ echo "Image Version: $version"
bldfn="/tmp/build-$version.tar.gz"

docker ps &> /dev/null || (echo "You need a working Docker daemon. Maybe set DOCKER_HOST?"; exit 1)
leeway build -Dversion="$version" -DimageRepoBase=eu.gcr.io/gitpod-core-dev/build ".:$component" --save "$bldfn" --dont-retag
leeway build -Dversion="$version" -DimageRepoBase=eu.gcr.io/gitpod-core-dev/build ".:$component" --save "$bldfn"
dev_image="$(tar xfO "$bldfn" ./imgnames.txt | head -n1)"
echo "Dev Image: $dev_image"

Expand Down
85 changes: 71 additions & 14 deletions components/ide/jetbrains/image/status/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"os/signal"
"path/filepath"
"reflect"
"regexp"
"strconv"
"strings"
"syscall"
Expand Down Expand Up @@ -48,12 +49,54 @@ const BackendPath = "/ide-desktop/backend"
const ProductInfoPath = BackendPath + "/product-info.json"

type LaunchContext struct {
alias string
projectDir string
configDir string
systemDir string
projectConfigDir string
wsInfo *supervisor.WorkspaceInfoResponse
alias string
projectDir string
configDir string
systemDir string
projectConfigDir string
projectContextDir string
riderSolutionFile string
wsInfo *supervisor.WorkspaceInfoResponse
}

// TODO(andreafalzetti): remove dir scanning once this is implemented https://youtrack.jetbrains.com/issue/GTW-2402/Rider-Open-Project-dialog-not-displaying-in-remote-dev
func findRiderSolutionFile(root string) (string, error) {
slnRegEx := regexp.MustCompile(`^.+\.sln$`)
projRegEx := regexp.MustCompile(`^.+\.csproj$`)

var slnFiles []string
var csprojFiles []string

err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
} else if slnRegEx.MatchString(info.Name()) {
slnFiles = append(slnFiles, path)
} else if projRegEx.MatchString(info.Name()) {
csprojFiles = append(csprojFiles, path)
}
return nil
})

if err != nil {
return "", err
}

if len(slnFiles) > 0 {
return slnFiles[0], nil
} else if len(csprojFiles) > 0 {
return csprojFiles[0], nil
}

return root, nil
}

func resolveProjectContextDir(launchCtx *LaunchContext) string {
if launchCtx.alias == "rider" {
return launchCtx.riderSolutionFile
}

return launchCtx.projectDir
}

// JB startup entrypoint
Expand Down Expand Up @@ -114,16 +157,29 @@ func main() {
} else {
qualifier = "-" + qualifier
}

var riderSolutionFile string
if alias == "rider" {
riderSolutionFile, err = findRiderSolutionFile(projectDir)
if err != nil {
log.WithError(err).Error("failed to find a rider solution file")
}
}

configDir := fmt.Sprintf("/workspace/.config/JetBrains%s", qualifier)
launchCtx := &LaunchContext{
alias: alias,
wsInfo: wsInfo,
projectDir: projectDir,
configDir: configDir,
systemDir: fmt.Sprintf("/workspace/.cache/JetBrains%s", qualifier),
projectConfigDir: fmt.Sprintf("%s/RemoteDev-%s/%s", configDir, info.ProductCode, strings.ReplaceAll(projectDir, "/", "_")),
alias: alias,
wsInfo: wsInfo,
projectDir: projectDir,
projectContextDir: projectDir,
configDir: configDir,
systemDir: fmt.Sprintf("/workspace/.cache/JetBrains%s", qualifier),
riderSolutionFile: riderSolutionFile,
}

launchCtx.projectContextDir = resolveProjectContextDir(launchCtx)
launchCtx.projectConfigDir = fmt.Sprintf("%s/RemoteDev-%s/%s", configDir, info.ProductCode, strings.ReplaceAll(launchCtx.projectContextDir, "/", "_"))

// sync initial options
err = syncOptions(launchCtx)
if err != nil {
Expand Down Expand Up @@ -362,7 +418,8 @@ func resolveWorkspaceInfo(ctx context.Context) (*supervisor.WorkspaceInfoRespons
func run(launchCtx *LaunchContext) {
var args []string
args = append(args, "run")
args = append(args, launchCtx.projectDir)
args = append(args, launchCtx.projectContextDir)

cmd := remoteDevServerCmd(args, launchCtx)
cmd.Env = append(cmd.Env, "JETBRAINS_GITPOD_BACKEND_KIND="+launchCtx.alias)
workspaceUrl, err := url.Parse(launchCtx.wsInfo.WorkspaceUrl)
Expand Down Expand Up @@ -599,7 +656,7 @@ func installPlugins(config *gitpod.GitpodConfig, launchCtx *LaunchContext) error

var args []string
args = append(args, "installPlugins")
args = append(args, launchCtx.projectDir)
args = append(args, launchCtx.projectContextDir)
args = append(args, plugins...)
cmd := remoteDevServerCmd(args, launchCtx)
installErr := cmd.Run()
Expand Down
10 changes: 10 additions & 0 deletions components/ide/jetbrains/image/supervisor-ide-config_clion.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"entrypoint": "/ide-desktop/startup.sh",
"entrypointArgs": [ "{DESKTOPIDEPORT}", "clion", "Open in CLion" ],
"readinessProbe": {
"type": "http",
"http": {
"path": "/status"
}
}
}
10 changes: 10 additions & 0 deletions components/ide/jetbrains/image/supervisor-ide-config_rider.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"entrypoint": "/ide-desktop/startup.sh",
"entrypointArgs": [ "{DESKTOPIDEPORT}", "rider", "Open in Rider" ],
"readinessProbe": {
"type": "http",
"http": {
"path": "/status"
}
}
}
4 changes: 4 additions & 0 deletions components/server/src/ide-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export class IDEService {
productCode = "RM";
} else if (key === "webstorm") {
productCode = "WS";
} else if (key === "rider") {
productCode = "RD";
} else if (key === "clion") {
productCode = "CL";
}
const prebuilds = productCode && ws.config.jetbrains[key as keyof JetBrainsConfig]?.prebuilds;
if (prebuilds) {
Expand Down
Loading