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
Change
Please consider changing the common/ast package's bazel visibility to //visibility:public.
common/ast is not an internal package, so go build and friends have no issue building code that uses the package, but common/ast's BUILD.bazel sets the default_visibility to __subpackages__.
It appears this change was made intentionally, but it causes issues when trying to build code that uses common/ast with bazel/gazelle, because common/ast is not externally visible:
ERROR: <my_code>/BUILD.bazel:3:11: in go_library rule <my_code>: target '@com_github_google_cel_go//common/ast:ast' is not visible from target '<my_code>'. Check the visibility declaration of the former target if you think the dependency is legitimate
Use case
I'm using ast.Visitor to walk the ast and perform extra validation on parsed expressions. There doesn't seem to be any reason to make this very useful library private just for bazel/gazelle builds.
This is a hack that causes gazelle to ignore the BUILD.bazel files in the repo because the case-sensitivity doesn't match the build file names, and generate it's own. Note: build_file_generation = "on" on it's own won't write it's own build files.
The other option is to omit the build_file_name directive from above, and reference the dep as @com_github_google_cel_go//common/ast:go_default_library instead of @com_github_google_cel_go//common/ast.
This works because build_file_generation = "on" adds a :go_default_library -> :ast alias with //visibility:public.
P.S.
Thanks for the great library ❤️
The text was updated successfully, but these errors were encountered:
I would be happy to make it public. I had kept it private until someone asked. ;) Truth be told the package was in development for some time and I didn't want people to use it while I was still actively modifying the internals. It should be ready for public consumption now.
Feature request checklist
Change
Please consider changing the common/ast package's bazel visibility to
//visibility:public
.common/ast is not an internal package, so
go build
and friends have no issue building code that uses the package, but common/ast's BUILD.bazel sets thedefault_visibility
to__subpackages__
.It appears this change was made intentionally, but it causes issues when trying to build code that uses common/ast with bazel/gazelle, because common/ast is not externally visible:
Use case
I'm using
ast.Visitor
to walk the ast and perform extra validation on parsed expressions. There doesn't seem to be any reason to make this very useful library private just for bazel/gazelle builds.Workarounds
I've found a couple work arounds:
This is a hack that causes gazelle to ignore the
BUILD.bazel
files in the repo because the case-sensitivity doesn't match the build file names, and generate it's own. Note:build_file_generation = "on"
on it's own won't write it's own build files.The other option is to omit the
build_file_name
directive from above, and reference the dep as@com_github_google_cel_go//common/ast:go_default_library
instead of@com_github_google_cel_go//common/ast
.This works because
build_file_generation = "on"
adds a:go_default_library
->:ast
alias with//visibility:public
.P.S.
Thanks for the great library ❤️
The text was updated successfully, but these errors were encountered: