-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Allow Bazel commands to run in repository subdirectories #13523
chore: Allow Bazel commands to run in repository subdirectories #13523
Conversation
Thanks for opening a PR! 💯
Howto
More infoPlease take a moment to read through the Magma project's
If this is your first Magma PR, also consider reading
|
ece6839
to
4768d45
Compare
.bazelrc
Outdated
@@ -48,7 +48,7 @@ run:remote_caching_ro --remote_download_toplevel | |||
|
|||
# Import the bazel caching config, with default disk cache, | |||
# which in CI gets overwritten by the remote caching config. | |||
import bazel/bazelrcs/cache.bazelrc | |||
import /var/cache/cache.bazelrc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also use import %workspace%/bazel/bazelrcs/cache.bazelrc
, see https://docs.bazel.build/versions/main/guide.html#imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really clean solution, the other PR setting up symbolic links is not even needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to replace all links by %workspace%/.bazel-cache/
etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried %workspace%/.bazel-cache/
and it works fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, good to know. Then we might refactor the mechanics at some point to get rid of all the linking. But for now let us just keep it as it is as this is a larger refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Krisztián Varga <krisztian.varga@tngtech.com>
4768d45
to
265e881
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally
Signed-off-by: Krisztián Varga krisztian.varga@tngtech.com
Summary
Since #12987 was merged, the bazel commands will only work in the magma folder, because the cache setup was reworked to use a relative path: bazel/bazelrcs/cache.bazelrc
This PR changes the path to use the workspace root.
Test Plan
Try using Bazel in subdirectories.
For example:
cd $MAGMA_ROOT/lte/gateway && bazel build //:buildifier
Additional Information