Project views directory inference doesn't seem to work
lukaszwawrzyk opened this issue · comments
It is not documented enough. I didn't know where to put the projectview.bazelproject
, I hoped it would be .bsp dir, but it seems to be at repository root. It is hard to figure out from code. Also I found some undocumented way of passing targets through command line (?). Not sure how to use it.
I tried with following content:
directories:
server/src/main/java/org/jetbrains/bsp/bazel/server/bep
derive_targets_from_directories: true
targets:
additional_languages:
kotlin
python
scala
Nothing was imported. I had to add targets as well:
directories:
server/src/main/java/org/jetbrains/bsp/bazel/server/bep
derive_targets_from_directories: true
targets:
//server/src/main/java/org/jetbrains/bsp/bazel/server/bep/...:all
additional_languages:
kotlin
python
scala
It is not documented enough.
i'll create a documentation
I didn't know where to put the projectview.bazelproject, I hoped it would be .bsp dir, but it seems to be at repository root. It is hard to figure out from code. Also I found some undocumented way of passing targets through command line (?). Not sure how to use it.
i want to change it - projectview will be loaded also during a workspace/reload
call, so it would be nice to configure which projectview file should be loaded, but I'm not sure how to do that yet
I tried with following content:
directories: server/src/main/java/org/jetbrains/bsp/bazel/server/bep derive_targets_from_directories: true targets: additional_languages: kotlin python scalaNothing was imported. I had to add targets as well:
directories: server/src/main/java/org/jetbrains/bsp/bazel/server/bep derive_targets_from_directories: true targets: //server/src/main/java/org/jetbrains/bsp/bazel/server/bep/...:all additional_languages: kotlin python scala
derive_targets_from_directories: true
is not supported yet (again, lack of documentation, sorryy)
i want to change it - projectview will be loaded also during a
workspace/reload
call, so it would be nice to configure which projectview file should be loaded, but I'm not sure how to do that yet
In fastpass we reload the project during workspace/buildTargets call which is invoked during sync. I am not sure when workspace/reload is used.
As I said in the multiproject support issue, it would be best if the file would sit somewhere close or in .bsp/.bazelbsp directory to be easily accessible and editable and scoped to specific IntelliJ project.
Selecting project view file is nice feature, from my perspective very low priority though. For most of the users it will be enough to modify their projectview file. If they want to work on a different project, they will create separate project with separate project view. This is because we want multiple projects open at once.
Anyway, we were implementing such features in additional intellij plugin, like fastpass integration is implemented inside pants plugin. Such bazel-bsp plugin should probably support build files, some extra actions and settings that help with changing configuration etc.
derive_targets_from_directories: true
is not supported yet (again, lack of documentation, sorryy)
Oh, I thought it might work as when I put wrong path for the directory, I had an error from I think io_bazel, that no targets are under this dir.
It is not documented enough. I didn't know where to put the projectview.bazelproject, I hoped it would be .bsp dir, but it seems to be at repository root
Shouldn't it be at the same place where IntelliJ Bazel plugin expects it?
In fastpass we reload the project during workspace/buildTargets call which is invoked during sync. I am not sure when workspace/reload is used.
workspace/reload
is invoked as a first step on project reload by the client to ensure it is up to date with project configuration. We added the request since we didn't want to enforce workspace/buildTargets
to reload config in all servers, especially sbt where this can be expensive.
It is not documented enough. I didn't know where to put the projectview.bazelproject, I hoped it would be .bsp dir, but it seems to be at repository root
Shouldn't it be at the same place where IntelliJ Bazel plugin expects it?
as far as i know, bazel plugin allows to specify a path to the file
workspace/reload
is invoked as a first step on project reload by the client to ensure it is up to date with project configuration. We added the request since we didn't want to enforceworkspace/buildTargets
to reload config in all servers, especially sbt where this can be expensive.
Expected behavior for bazel in my opinion is that when build file is changed or the scope of the project (project view) I need a way to sync it with IntelliJ's view of the project. The only way that I know now is to run Reload All BSP Projects action. If it invokes workspace/reload then it sounds right to me.
as far as i know, bazel plugin allows to specify a path to the file
Yes. When project is created from UI, you may select existing path or create new file. It will be placed inside .ijwb directory which is created in the workspace root. It also contains .idea dir. We have a custom command line implementation for preparing bazel project. It creates a dir WORKSPACE_ROOT/bazel-imports/PROJ_NAME/ and puts there generated .bazelproject file and .idea dir with some xml file that specifies path to this .bazelproject so that when this project is opened, bazel plugin picks it up and syncs the project.
things to do:
- add
directories
andderive_targets_from_directories
to project view - use
bazel query
to collect all targets in directories - pass this information to workspaceContext