You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sadly this is not feasible given the size of our codebases.
Describe the solution you'd like
I may be in the wrong, but it seems like the directive should match the start of the import and then follow the rest of the import path. I'm not exactly sure how, or even if, this would work though (see example 2).
# gazelle resolve py hello.world //goodbye:world
# import hello --> //hello # no change because it's not matched by resolve.
# import hello.world --> //goodbye:world # no change from current functionality
# import hello.world.again --> ... I donno. Can't be //goodbye:world:again haha
Describe alternatives you've considered
We might be able to run buildozer and modify all the deps in ./main_project_repo/src after Gazelle generates them, but I haven't looked into how feasible that actually is.
The text was updated successfully, but these errors were encountered:
but Gazelle doesn't complete because it can't validate dependencies:
gazelle: ERROR: failed to validate dependencies for target "//src/main_project/fab:doug": "other_project.util.file" at line 9 from "src/main_project/fab/doug.py" is an invalid dependency: possible solutions:
1. Add it as a dependency in the requirements.txt file.
2. Instruct Gazelle to resolve to a known dependency using the gazelle:resolve directive.
3. Ignore it with a comment '# gazelle:ignore other_project.util.file' in the Python file.
"other_project.util" at line 9 from "src/main_project/fab/doug.py" is an invalid dependency: possible solutions:
1. Add it as a dependency in the requirements.txt file.
2. Instruct Gazelle to resolve to a known dependency using the gazelle:resolve directive.
3. Ignore it with a comment '# gazelle:ignore other_project.util' in the Python file.
"other_project" at line 9 from "src/main_project/fab/doug.py" is an invalid dependency: possible solutions:
1. Add it as a dependency in the requirements.txt file.
2. Instruct Gazelle to resolve to a known dependency using the gazelle:resolve directive.
3. Ignore it with a comment '# gazelle:ignore other_project' in the Python file.
β question | possible π feature request
Relevant Rules
Description
Can Gazelle's 'resolve' directive be smarter? Or am I just using it wrong?
Example:
import foo.bar.baz
"@other//foo/bar:baz"
"@other//foo"
from foo import bar
"@other//foo:bar"
"@other//foo"
import foo.bar as bar
"@other//foo/bar"
"@other//foo"
This is coming about because we have a nested project with a dir structure like:
And
./main_project_repo/src/main_project/BUILD.bazel
looks like so to work:With the current functionality, I'd have to write out resolve directives for every import used
Sadly this is not feasible given the size of our codebases.
Describe the solution you'd like
I may be in the wrong, but it seems like the directive should match the start of the import and then follow the rest of the import path. I'm not exactly sure how, or even if, this would work though (see example 2).
Example 1
Example 2
Describe alternatives you've considered
We might be able to run buildozer and modify all the deps in
./main_project_repo/src
after Gazelle generates them, but I haven't looked into how feasible that actually is.The text was updated successfully, but these errors were encountered: