Skip to content
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

WIP: Test Preview 3 #20447

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
9 changes: 9 additions & 0 deletions components/gitpod-protocol/data/gitpod-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,15 @@
"type": "string"
}
},
"projects": {
"type": "array",
"description": "List of additional projects that the JetBrains editor would open",
"additionalProperties": false,
"items": {
"type": "string",
"description": "Project absolute path"
}
},
"intellij": {
"$ref": "#/definitions/jetbrainsProduct",
"description": "Configure IntelliJ integration"
Expand Down
3 changes: 3 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.

4 changes: 4 additions & 0 deletions components/gitpod-protocol/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,10 @@ export interface JetBrainsConfig {
rider?: JetBrainsProductConfig;
clion?: JetBrainsProductConfig;
rustrover?: JetBrainsProductConfig;
/**
* List of additonal projects that JetBrains editor would open with
*/
projects?: string[];
}
export interface JetBrainsProductConfig {
prebuilds?: JetBrainsPrebuilds;
Expand Down
34 changes: 34 additions & 0 deletions components/ide/jetbrains/launcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,14 @@ func launch(launchCtx *LaunchContext) {
log.WithError(err).Error("failed to install gitpod-remote plugin")
}

go func(launchCtx *LaunchContext, additonalProjects []string) {
// TODO: wait until backend is healthy
time.Sleep(5 * time.Second)
for _, project := range additonalProjects {
go appendAdditonalProject(launchCtx, project)
}
}(launchCtx, gitpodConfig.Jetbrains.Projects)

// run backend
run(launchCtx)
}
Expand Down Expand Up @@ -640,6 +648,31 @@ func run(launchCtx *LaunchContext) {
os.Exit(cmd.ProcessState.ExitCode())
}

func appendAdditonalProject(launchCtx *LaunchContext, projectLocation string) {
var args []string
if launchCtx.warmup {
args = append(args, "warmup")
} else if launchCtx.preferToolbox {
args = append(args, "serverMode")
} else {
args = append(args, "run")
}
args = append(args, projectLocation)

cmd := remoteDevServerCmd(args, launchCtx)
// Enable host status endpoint
cmd.Env = append(cmd.Env, "CWM_HOST_STATUS_OVER_HTTP_TOKEN=gitpod")

if err := cmd.Start(); err != nil {
log.WithError(err).Error("failed to start")
}

err := cmd.Wait()
if err != nil {
log.Warn("faild to start additional project", log.WithField("project", projectLocation), log.WithError(err))
}
}

// resolveUserEnvs emulats the interactive login shell to ensure that all user defined shell scripts are loaded
func resolveUserEnvs() (userEnvs []string, err error) {
shell := os.Getenv("SHELL")
Expand Down Expand Up @@ -1113,6 +1146,7 @@ func installPlugins(config *gitpod.GitpodConfig, launchCtx *LaunchContext) error

var args []string
args = append(args, "installPlugins")
// TODO(hw): Do we need project path here?
args = append(args, launchCtx.projectContextDir)
args = append(args, plugins...)
cmd := remoteDevServerCmd(args, launchCtx)
Expand Down
Loading