intellij icon indicating copy to clipboard operation
intellij copied to clipboard

Sync broken with Jetbrains Gateway

Open LittleHuba opened this issue 1 year ago • 1 comments

Description of the bug:

Jetbrains Gateway now stores configuration and plugins in a different directory. This means, that the aspect of the Bazel plugin can no longer be found. The sync command in CLion then shows an awkward path for the aspect repository.

Command: bazel build --tool_tag=ijwb:CLion --keep_going --build_event_binary_file=/tmp/intellij-bep-524eeb54-5c83-4781-a28e-f1810c725574 --nobuild_event_binary_file_path_conversion --curses=no --color=yes --progress_in_terminal_title=no --config=clion --verbose_failures --nokeep_going --noexperimental_run_validations --aspects=@@intellij_aspect//:intellij_info_bundled.bzl%intellij_info_aspect --override_repository=intellij_aspect=?/.local/share/JetBrains/CLion2023.3/clwb/aspect --output_groups=intellij-resolve-cpp,intellij-resolve-py,intellij-info-cpp,intellij-info-generic,intellij-info-py -- //some_target/...
INFO: Invocation ID: 9d4e587d-e160-4b3a-a284-197566d06337
Loading: 
Loading: 
Loading: 0 packages loaded
Analyzing: 1101 targets (0 packages loaded, 0 targets configured)
ERROR: Analysis of aspects '[@intellij_aspect//:intellij_info_bundled.bzl%intellij_info_aspect] with parameters {} on //some_target' failed; build aborted: no such package '@intellij_aspect//': The repository's path is "intellij_aspect" (absolute: "/home/user/some_project/?/.local/share/JetBrains/CLion2023.3/clwb/aspect") but it does not exist or is not a directory.
INFO: Elapsed time: 0.330s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)
INFO: Build Event Protocol files produced successfully.

When investigating, ~/.local/share/JetBrains/CLion2023.3/clwb/aspect does not actually exist. It is now placed in ~/.config/JetBrains/RemoteDev-CL/_home_user_some_project/plugins/clwb/. Further, the path in the sync command --override_repository=intellij_aspect=?/.local/share/JetBrains/CLion2023.3/clwb/aspect is broken (the question mark).

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

  1. Set up a remote project with Jetbrains Gateway with a Bazel project.
  2. In the Bazelproject file put the following to see the explicit error:
    sync_flags:
      --verbose_failures
      --nokeep_going
    
  3. Try to sync the project
  4. Inspect the logs of the sync

Which Intellij IDE are you using? Please provide the specific version.

Jetbrains Gateway 2023.3.3 (Build #GW-233.14015.129) with CLion 2023.3.3 (Build #JBC-233.14015.92)

What programming languages and tools are you using? Please provide specific versions.

C++

What Bazel plugin version are you using?

2024.01.16.0.1-api-version-233

Have you found anything relevant by searching the web?

To me it looks like https://github.com/bazelbuild/intellij/blob/35c0942a9b2ec9f16a329585312777c6976c6913/java/src/com/google/idea/blaze/java/fastbuild/BazelFastBuildAspectStrategy.java#L42C23-L42C42 is broken and no longer supports the new plugin location.

Any other information, logs, or outputs that you want to share?

No response

LittleHuba avatar Feb 05 '24 14:02 LittleHuba

It seems that this is partially the Jetbrains IDE and partially the plugin.

Jetbrains seems to really put the aspect in a directory called ~/'?'. But the Bazel plugin assumes that this directory is within the project directory and not in the home directory.

A temporary fix is to add a symlink to the project directory that points to the right directory.

LittleHuba avatar Feb 21 '24 15:02 LittleHuba

So honestly I can't reproduce that. I just need more details. Btw is it possible it was caused by the fact that your remote machine has been setup with the old directory layout and then the update happened?

tpasternak avatar Feb 28 '24 12:02 tpasternak

This is related to https://youtrack.jetbrains.com/issue/IDEA-347274

Since you are already assigned to that ticket, you might already be aware of that.

It might be that this is the case, but I tried to fully clean the remote machine of any kind of Jetbrains config directories and did the same for my local machine. After setting everything up again, I ended with the same result. It might be that I missed something. So if you have clear instructions what I need to clean, I'm happy to try once more.

LittleHuba avatar Feb 28 '24 12:02 LittleHuba

I would try with this :

~/.local/share/JetBrains/
~/.cache/JetBrains/
~/.config/JetBrains/

and also .ijwb, .clwb and .idea (if you have one) in the project dir.

I was trying it by myself on a clean machine (but with 2024.1 so far) and observed no issues at all

tpasternak avatar Feb 28 '24 13:02 tpasternak

Same for 2023.3.4 - on a clean machine I just can't reproduce it

tpasternak avatar Feb 28 '24 13:02 tpasternak

Removed all directories and still I immediately get a directory called ~/? recreated. I'm using the option to upload the CLion installer via Gateway. Maybe this has an impact?

LittleHuba avatar Feb 28 '24 15:02 LittleHuba

nope, I've used the same

tpasternak avatar Feb 28 '24 15:02 tpasternak

I need to investigate further, at the moment I have no idea how it could happen

tpasternak avatar Feb 28 '24 15:02 tpasternak

what's your OS btw?

tpasternak avatar Feb 28 '24 15:02 tpasternak

Client uses Windows 10 and Host uses Ubuntu 20.04.

I found one line in the logs of Gateway that might help? The list of users only contains ? and the ideIdentityString contains the broken path.

2024-02-28 15:46:30,701 [ 324885]   INFO - #c.j.g.s.d.m.HostRunMethods - Host status: UnattendedHostStatus(appPid=3266645, appVersion=CL-233.14475.31, runtimeVersion=17.0.10b1087.17, unattendedMode=true, backendUnresponsive=false, modalDialogIsOpened=false, idePath=/home/someuser/.cache/JetBrains/RemoteDev/dist/eae2e1646387e_CLion-2023.3.4, ideIdentityString=?/.config/JetBrains/CLion2023.3, joinLink=tcp://127.0.0.1:5990#jt=90419232-2867-439c-a965-674db53ff157&p=CL&fp=E02C4A2B0B8EB1957D51DAEFDCF11B0BB2BBAD0AF368DB0F280185AC2B604273&cb=233.14475.31&newUi=true&jb=17.0.10b1087.17, httpLink=https://code-with-me.jetbrains.com/remoteDev#idePath=%2Fhome%2Fsomeuser%2F.cache%2FJetBrains%2FRemoteDev%2Fdist%2Feae2e1646387e_CLion-2023.3.4&projectPath=%2Fhome%2Fsomeuser%2Fsomeproject&host=somehost&port=22&user=someuser&type=ssh&deploy=false&newUi=true, gatewayLink=jetbrains-gateway://connect#idePath=%2Fhome%2Fsomeuser%2F.cache%2FJetBrains%2FRemoteDev%2Fdist%2Feae2e1646387e_CLion-2023.3.4&projectPath=%2Fhome%2Fsomeuser%2Fsomeproject&host=somehost&port=22&user=someuser&type=ssh&deploy=false&newUi=true, projects=[UnattendedHostPerProjectStatus(projectName=someproject, projectPath=/home/someuser/someproject, projectPathLink=null, dateLastOpened=1709131590614, joinLink=tcp://127.0.0.1:5990#jt=90419232-2867-439c-a965-674db53ff157&p=CL&fp=E02C4A2B0B8EB1957D51DAEFDCF11B0BB2BBAD0AF368DB0F280185AC2B604273&cb=233.14475.31&newUi=true&jb=17.0.10b1087.17, httpLink=https://code-with-me.jetbrains.com/remoteDev#idePath=%2Fhome%2Fsomeuser%2F.cache%2FJetBrains%2FRemoteDev%2Fdist%2Feae2e1646387e_CLion-2023.3.4&projectPath=%2Fhome%2Fsomeuser%2Fsomeproject&host=somehost&port=22&user=someuser&type=ssh&deploy=false&newUi=true, gatewayLink=jetbrains-gateway://connect#idePath=%2Fhome%2Fsomeuser%2F.cache%2FJetBrains%2FRemoteDev%2Fdist%2Feae2e1646387e_CLion-2023.3.4&projectPath=%2Fhome%2Fsomeuser%2Fsomeproject&host=somehost&port=22&user=someuser&type=ssh&deploy=false&newUi=true, controllerConnected=false, secondsSinceLastControllerActivity=0, backgroundTasksRunning=false, users=[?])])

LittleHuba avatar Feb 28 '24 15:02 LittleHuba

oh, that's a good clue

tpasternak avatar Feb 28 '24 15:02 tpasternak

I found a workaround that fixes the behavior within the IDE. And it also points to Gateway messing up this ideIdentityString which leads to the IDE itself messing up its configuration.

  1. Open the custom properties (Help/Edit Custom Properties... (On Host))
  2. Add the following four lines
    idea.config.path=/home/someuser/.config/JetBrains/CLion2023.3
    idea.system.path=/home/someuser/.cache/JetBrains/CLion2023.3
    idea.plugins.path=/home/someuser/.config/JetBrains/CLion2023.3/plugins
    idea.log.path=/home/someuser/.cache/JetBrains/CLion2023.3/log
    
  3. Reconfigure the IDE Settings to your wishes (this includes installing all plugins)
  4. Bazel Sync as well as indexing works again

LittleHuba avatar Feb 29 '24 09:02 LittleHuba

So I'm closing it as the problem seems to be unrelated to the Bazel Plugin. You can track progress in YouTrack. Feel free to reopen if I misunderstood it

tpasternak avatar Mar 01 '24 11:03 tpasternak