Skip to content

Commit

Permalink
Enable new UI on first start (#19169)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanp413 authored Nov 30, 2023
1 parent a6f4722 commit 172145e
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions components/ide/jetbrains/launcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,14 +421,15 @@ func launch(launchCtx *LaunchContext) {
launchCtx.riderSolutionFile = riderSolutionFile
launchCtx.projectContextDir = resolveProjectContextDir(launchCtx)
launchCtx.projectConfigDir = fmt.Sprintf("%s/RemoteDev-%s/%s", launchCtx.configDir, launchCtx.info.ProductCode, strings.ReplaceAll(launchCtx.projectContextDir, "/", "_"))
launchCtx.env = resolveLaunchContextEnv(launchCtx.configDir, launchCtx.systemDir)

err = syncInitialContent(launchCtx, Options)
alreadySync, err := syncInitialContent(launchCtx, Options)
if err != nil {
log.WithError(err).Error("failed to sync initial options")
}

err = syncInitialContent(launchCtx, Plugins)
launchCtx.env = resolveLaunchContextEnv(launchCtx.configDir, launchCtx.systemDir, !alreadySync)

_, err = syncInitialContent(launchCtx, Plugins)
if err != nil {
log.WithError(err).Error("failed to sync initial plugins")
}
Expand Down Expand Up @@ -539,7 +540,7 @@ func resolveUserEnvs() (userEnvs []string, err error) {
return
}

func resolveLaunchContextEnv(configDir string, systemDir string) []string {
func resolveLaunchContextEnv(configDir string, systemDir string, enableNewUI bool) []string {
var launchCtxEnv []string
userEnvs, err := resolveUserEnvs()
if err == nil {
Expand All @@ -561,6 +562,10 @@ func resolveLaunchContextEnv(configDir string, systemDir string) []string {
// by default remote dev already set -Xmx2048m, see /ide-desktop/${alias}${qualifier}/backend/plugins/remote-dev-server/bin/launcher.sh
launchCtxEnv = append(launchCtxEnv, "JAVA_TOOL_OPTIONS=")

if enableNewUI {
launchCtxEnv = append(launchCtxEnv, "REMOTE_DEV_NEW_UI_ENABLED=1")
}

log.WithField("env", strings.Join(launchCtxEnv, "\n")).Info("resolved launch env")

return launchCtxEnv
Expand Down Expand Up @@ -724,30 +729,30 @@ const (
Plugins SyncTarget = "plugins"
)

func syncInitialContent(launchCtx *LaunchContext, target SyncTarget) error {
func syncInitialContent(launchCtx *LaunchContext, target SyncTarget) (bool, error) {
destDir, err, alreadySynced := ensureInitialSyncDest(launchCtx, target)
if alreadySynced {
log.Infof("initial %s is already synced, skipping", target)
return nil
return alreadySynced, nil
}
if err != nil {
return err
return alreadySynced, err
}

srcDirs, err := collectSyncSources(launchCtx, target)
if err != nil {
return err
return alreadySynced, err
}
if len(srcDirs) == 0 {
// nothing to sync
return nil
return alreadySynced, nil
}

for _, srcDir := range srcDirs {
if target == Plugins {
files, err := ioutil.ReadDir(srcDir)
if err != nil {
return err
return alreadySynced, err
}

for _, file := range files {
Expand All @@ -760,11 +765,11 @@ func syncInitialContent(launchCtx *LaunchContext, target SyncTarget) error {
cp := exec.Command("cp", "-rf", srcDir+"/.", destDir)
err = cp.Run()
if err != nil {
return err
return alreadySynced, err
}
}
}
return nil
return alreadySynced, nil
}

func syncPlugin(file fs.FileInfo, srcDir, destDir string) error {
Expand Down

0 comments on commit 172145e

Please sign in to comment.