Skip to content

Commit c258193

Browse files
author
Andrea Falzetti
committed
feat(jetbrains): add rider and clion
1 parent cd144de commit c258193

File tree

36 files changed

+970
-44
lines changed

36 files changed

+970
-44
lines changed

.github/workflows/jetbrains-auto-update-template.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ jobs:
5757
echo $IDE_VERSION
5858
- name: Leeway build
5959
if: ${{ steps.ide-version.outputs.result }}
60+
env:
61+
LEEWAY_MAX_PROVENANCE_BUNDLE_SIZE: '8388608'
6062
run: |
6163
gcloud auth configure-docker --quiet
6264
export LEEWAY_WORKSPACE_ROOT=$(pwd)

.github/workflows/jetbrains-auto-update.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,21 @@ jobs:
6565
projectId: ${{ secrets.GCP_PROJECT_ID }}
6666
serviceAccountKey: ${{ secrets.GCP_SA_KEY }}
6767
slackWebhook: ${{ secrets.IDE_SLACK_WEBHOOK }}
68+
rider:
69+
uses: ./.github/workflows/jetbrains-auto-update-template.yml
70+
with:
71+
productId: rider
72+
productCode: RD
73+
secrets:
74+
projectId: ${{ secrets.GCP_PROJECT_ID }}
75+
serviceAccountKey: ${{ secrets.GCP_SA_KEY }}
76+
slackWebhook: ${{ secrets.IDE_SLACK_WEBHOOK }}
77+
clion:
78+
uses: ./.github/workflows/jetbrains-auto-update-template.yml
79+
with:
80+
productId: clion
81+
productCode: CL
82+
secrets:
83+
projectId: ${{ secrets.GCP_PROJECT_ID }}
84+
serviceAccountKey: ${{ secrets.GCP_SA_KEY }}
85+
slackWebhook: ${{ secrets.IDE_SLACK_WEBHOOK }}

WORKSPACE.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ defaultArgs:
1717
phpstormDownloadUrl: "https://download.jetbrains.com/webide/PhpStorm-2022.2.3.tar.gz"
1818
rubymineDownloadUrl: "https://download.jetbrains.com/ruby/RubyMine-2022.2.3.tar.gz"
1919
webstormDownloadUrl: "https://download.jetbrains.com/webstorm/WebStorm-2022.2.3.tar.gz"
20+
riderDownloadUrl: "https://download.jetbrains.com/rider/JetBrains.Rider-2022.2.3.tar.gz"
21+
clionDownloadUrl: "https://download.jetbrains.com/cpp/CLion-2022.2.3.tar.gz"
2022
REPLICATED_API_TOKEN: ""
2123
REPLICATED_APP: ""
2224
provenance:

components/BUILD.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ packages:
5454
- components/ide/jetbrains/image:rubymine-latest
5555
- components/ide/jetbrains/image:webstorm
5656
- components/ide/jetbrains/image:webstorm-latest
57+
- components/ide/jetbrains/image:rider
58+
- components/ide/jetbrains/image:rider-latest
59+
- components/ide/jetbrains/image:clion
60+
- components/ide/jetbrains/image:clion-latest
5761
- components/image-builder-bob:docker
5862
- components/image-builder-mk3:docker
5963
- components/local-app:docker

components/dashboard/src/settings/SelectIDE.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export default function SelectIDE(props: SelectIDEProps) {
9292
<>
9393
{allIdeOptions && (
9494
<>
95-
<div className={`my-4 gap-3 flex flex-wrap max-w-2xl`}>
95+
<div className={`my-4 gap-3 flex flex-wrap max-w-3xl`}>
9696
{allIdeOptions.map(([id, option]) => {
9797
const selected = defaultIde === id;
9898
const onSelect = () => actuallySetDefaultIde(id);

components/dashboard/src/settings/SelectIDEModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default function (props: SelectIDEModalProps) {
4444
visible={visible}
4545
onClose={handleContinue}
4646
closeable={true}
47-
className="max-w-2xl"
47+
className="max-w-51.5"
4848
buttons={<button onClick={handleContinue}>Continue</button>}
4949
>
5050
<p className="text-gray-500 dark:text-gray-400 text-base pb-3">

components/dashboard/tailwind.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ module.exports = {
4242
112: "28rem",
4343
128: "32rem",
4444
},
45+
maxWidth: {
46+
// TODO(andreafalzetti): remove custom ide-modal class once we implement https://github.com/gitpod-io/gitpod/issues/13116
47+
51.5: "51.5rem",
48+
},
4549
},
4650
fontFamily: {
4751
sans: [

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,14 @@
283283
"webstorm": {
284284
"$ref": "#/definitions/jetbrainsProduct",
285285
"description": "Configure WebStorm integration"
286+
},
287+
"rider": {
288+
"$ref": "#/definitions/jetbrainsProduct",
289+
"description": "Configure Rider integration"
290+
},
291+
"clion": {
292+
"$ref": "#/definitions/jetbrainsProduct",
293+
"description": "Configure CLion integration"
286294
}
287295
}
288296
},

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

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/gitpod-protocol/src/protocol.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,8 @@ export interface JetBrainsConfig {
801801
phpstorm?: JetBrainsProductConfig;
802802
rubymine?: JetBrainsProductConfig;
803803
webstorm?: JetBrainsProductConfig;
804+
rider?: JetBrainsProductConfig;
805+
clion?: JetBrainsProductConfig;
804806
}
805807
export interface JetBrainsProductConfig {
806808
prebuilds?: JetBrainsPrebuilds;
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

components/ide/jetbrains/image/BUILD.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ const ideConfigs = [
2727
name: "webstorm",
2828
productCode: "WS",
2929
},
30+
{
31+
name: "rider",
32+
productCode: "RD",
33+
},
34+
{
35+
name: "clion",
36+
productCode: "CL",
37+
},
3038
];
3139

3240
const packages = [];

components/ide/jetbrains/image/gha-update-image/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ const IDEs = [
4949
productType: "release",
5050
exampleRepo: "https://github.com/gitpod-io/template-jetbrains-webstorm",
5151
},
52+
{
53+
productName: "Rider",
54+
productId: "rider",
55+
productCode: "RD",
56+
productType: "release",
57+
exampleRepo: "https://github.com/gitpod-io/template-dotnet-core-cli-csharp",
58+
},
59+
{
60+
productName: "CLion",
61+
productId: "clion",
62+
productCode: "CL",
63+
productType: "release",
64+
exampleRepo: "https://github.com/gitpod-io/template-cpp",
65+
},
5266
];
5367

5468
(async () => {

components/ide/jetbrains/image/hot-deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ echo "Image Version: $version"
3131
bldfn="/tmp/build-$version.tar.gz"
3232

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

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

Lines changed: 72 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
1+
// Copyright (c) 2021 Gitpod GmbH. All rights reserved.
22
// Licensed under the GNU Affero General Public License (AGPL).
33
// See License-AGPL.txt in the project root for license information.
44

@@ -18,6 +18,7 @@ import (
1818
"os/signal"
1919
"path/filepath"
2020
"reflect"
21+
"regexp"
2122
"strconv"
2223
"strings"
2324
"syscall"
@@ -48,12 +49,54 @@ const BackendPath = "/ide-desktop/backend"
4849
const ProductInfoPath = BackendPath + "/product-info.json"
4950

5051
type LaunchContext struct {
51-
alias string
52-
projectDir string
53-
configDir string
54-
systemDir string
55-
projectConfigDir string
56-
wsInfo *supervisor.WorkspaceInfoResponse
52+
alias string
53+
projectDir string
54+
configDir string
55+
systemDir string
56+
projectConfigDir string
57+
projectContextDir string
58+
riderSolutionFile string
59+
wsInfo *supervisor.WorkspaceInfoResponse
60+
}
61+
62+
// 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
63+
func findRiderSolutionFile(root string) (string, error) {
64+
slnRegEx := regexp.MustCompile(`^.+\.sln$`)
65+
projRegEx := regexp.MustCompile(`^.+\.csproj$`)
66+
67+
var slnFiles []string
68+
var csprojFiles []string
69+
70+
err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
71+
if err != nil {
72+
return err
73+
} else if slnRegEx.MatchString(info.Name()) {
74+
slnFiles = append(slnFiles, path)
75+
} else if projRegEx.MatchString(info.Name()) {
76+
csprojFiles = append(csprojFiles, path)
77+
}
78+
return nil
79+
})
80+
81+
if err != nil {
82+
return "", err
83+
}
84+
85+
if len(slnFiles) > 0 {
86+
return slnFiles[0], nil
87+
} else if len(csprojFiles) > 0 {
88+
return csprojFiles[0], nil
89+
}
90+
91+
return root, nil
92+
}
93+
94+
func resolveProjectContextDir(launchCtx *LaunchContext) string {
95+
if launchCtx.alias == "rider" {
96+
return launchCtx.riderSolutionFile
97+
}
98+
99+
return launchCtx.projectDir
57100
}
58101

59102
// JB startup entrypoint
@@ -114,16 +157,29 @@ func main() {
114157
} else {
115158
qualifier = "-" + qualifier
116159
}
160+
161+
var riderSolutionFile string
162+
if alias == "rider" {
163+
riderSolutionFile, err = findRiderSolutionFile(projectDir)
164+
if err != nil {
165+
log.WithError(err).Error("failed to find a rider solution file")
166+
}
167+
}
168+
117169
configDir := fmt.Sprintf("/workspace/.config/JetBrains%s", qualifier)
118170
launchCtx := &LaunchContext{
119-
alias: alias,
120-
wsInfo: wsInfo,
121-
projectDir: projectDir,
122-
configDir: configDir,
123-
systemDir: fmt.Sprintf("/workspace/.cache/JetBrains%s", qualifier),
124-
projectConfigDir: fmt.Sprintf("%s/RemoteDev-%s/%s", configDir, info.ProductCode, strings.ReplaceAll(projectDir, "/", "_")),
171+
alias: alias,
172+
wsInfo: wsInfo,
173+
projectDir: projectDir,
174+
projectContextDir: projectDir,
175+
configDir: configDir,
176+
systemDir: fmt.Sprintf("/workspace/.cache/JetBrains%s", qualifier),
177+
riderSolutionFile: riderSolutionFile,
125178
}
126179

180+
launchCtx.projectContextDir = resolveProjectContextDir(launchCtx)
181+
launchCtx.projectConfigDir = fmt.Sprintf("%s/RemoteDev-%s/%s", configDir, info.ProductCode, strings.ReplaceAll(launchCtx.projectContextDir, "/", "_"))
182+
127183
// sync initial options
128184
err = syncOptions(launchCtx)
129185
if err != nil {
@@ -362,7 +418,7 @@ func resolveWorkspaceInfo(ctx context.Context) (*supervisor.WorkspaceInfoRespons
362418
func run(launchCtx *LaunchContext) {
363419
var args []string
364420
args = append(args, "run")
365-
args = append(args, launchCtx.projectDir)
421+
args = append(args, launchCtx.projectContextDir)
366422
cmd := remoteDevServerCmd(args, launchCtx)
367423
cmd.Env = append(cmd.Env, "JETBRAINS_GITPOD_BACKEND_KIND="+launchCtx.alias)
368424
workspaceUrl, err := url.Parse(launchCtx.wsInfo.WorkspaceUrl)
@@ -567,7 +623,7 @@ func syncOptions(launchCtx *LaunchContext) error {
567623
return nil
568624
}
569625

570-
destDir := fmt.Sprintf("%s/options", launchCtx.projectConfigDir)
626+
destDir := fmt.Sprintf("%s/options", launchCtx.projectContextDir)
571627
_, err = os.Stat(destDir)
572628
if !os.IsNotExist(err) {
573629
// already synced skipping, i.e. restart of jb backend
@@ -599,7 +655,7 @@ func installPlugins(config *gitpod.GitpodConfig, launchCtx *LaunchContext) error
599655

600656
var args []string
601657
args = append(args, "installPlugins")
602-
args = append(args, launchCtx.projectDir)
658+
args = append(args, launchCtx.projectContextDir)
603659
args = append(args, plugins...)
604660
cmd := remoteDevServerCmd(args, launchCtx)
605661
installErr := cmd.Run()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"entrypoint": "/ide-desktop/startup.sh",
3+
"entrypointArgs": [ "{DESKTOPIDEPORT}", "clion", "Open in CLion" ],
4+
"readinessProbe": {
5+
"type": "http",
6+
"http": {
7+
"path": "/status"
8+
}
9+
}
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"entrypoint": "/ide-desktop/startup.sh",
3+
"entrypointArgs": [ "{DESKTOPIDEPORT}", "rider", "Open in Rider" ],
4+
"readinessProbe": {
5+
"type": "http",
6+
"http": {
7+
"path": "/status"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)