bazelbuild / intellij

IntelliJ plugin for Bazel projects
https://ij.bazel.build/
Apache License 2.0
761 stars 303 forks source link

Deriving targets do not respect excluded directories #6439

Closed kusaeva closed 1 month ago

kusaeva commented 4 months ago

Description of the issue. Please be specific.

I've noticed that with such .bazelproject:

directories:
  .
  -project2
  -etc

derive_targets_from_directories: true

The command to query targets is this:

Command: /opt/homebrew/bin/bazel query --tool_tag=ijwb:IDEA:community --output=label_kind --keep_going "attr(\"tags\", \"^((?!manual).)*$\", //...:all - //etc/...:all)" --

In Sync log it says:

Sync targets from project view directories:
  //project1:java-maven-lib
  //project2:java-maven-lib
  //project1:java-maven
  //project1:tests
  //project2:java-maven
  //project2:tests

So it does not exclude the directories in the workspace but exclude etc. It turned out that is because I have /etc directory at the root. I assumed that the path to the excluded directory would be counted from the root of workspace, not the system root.

What's the simplest set of steps to reproduce this issue? Please provide an example project, if possible.

Example project: https://github.com/kusaeva/ij-examples Just run sync in IDEA and you'll see mentioned command in Query targets in project directory

I expected exclusion of targets in project2 directory from sync

Version information

IdeaCommunity: 2024.1.1 Platform: Mac OS X 12.7.3 Bazel for IntelliJ plugin: 2024.04.23.0.1-api-version-241 Bazel: 7.1.2