-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Loading top-level targets in local_path_override modules in child directory breaks the build #22208
Comments
Is this fixed by adding |
It does seem to fix my example repo; I'll have to try it in my actual project later to confirm. But if |
We should probably just fix this and align the behavior with that of your WORKSPACE example. |
I think this is because we have some special handling to check if there's a WORKSPACE This is related to #21515. (or maybe even just a dupe) |
Can confirm the |
Looking at this again due to #22754. I verified that in the WORKSPACE world, the package In the Bzlmod world, we don't have such a check. Implementing such a check can also be difficult, since what is cc @katre, who originally implemented the cross-repo check, for ideas. |
When I implemented The implementation is actually kind of stupid: it doesn't check whether a directory is actually a repository, it just checks if there's a WORKSPACE file. It'd be equivalent to look for a REPO.bazel or MODULE.bazel file and declare that directory a sub-module. Or do |
One other facet to the conversation: Just today I stumbled upon Vendor Mode in the documentation. I also stumbled on #19563 and #20366, which indicate it's not quite ready yet (at least for Bzlmod). Would a Also, FWIW, I did get a report that using |
Not sure if this was changed after your initial implementation, but LRLF does more than just check for existence of a WORKSAPCE file under a directory; it also checks whether a In the Bzlmod world we do indeed have REPO.bazel or MODULE.bazel etc, but I was wondering if just checking for the existence of these files would be sufficient or too much. |
…le_workspace` This still leaves the question of "what do we do instead?". See issues bazelbuild#22208 and bazelbuild#21515. Fixes bazelbuild#22754. Closes bazelbuild#22774. PiperOrigin-RevId: 645148811 Change-Id: Ib9d07d2ecbc3a79e3341de6739de1c3349124d6b
…le_workspace` This still leaves the question of "what do we do instead?". See issues bazelbuild#22208 and bazelbuild#21515. Fixes bazelbuild#22754. Closes bazelbuild#22774. PiperOrigin-RevId: 645148811 Change-Id: Ib9d07d2ecbc3a79e3341de6739de1c3349124d6b
…le_workspace` This still leaves the question of "what do we do instead?". See issues bazelbuild#22208 and bazelbuild#21515. Fixes bazelbuild#22754. Closes bazelbuild#22774. PiperOrigin-RevId: 645148811 Change-Id: Ib9d07d2ecbc3a79e3341de6739de1c3349124d6b
…--noenable_workspace` (bazelbuild#22837) This still leaves the question of "what do we do instead?". See issues bazelbuild#22208 and bazelbuild#21515. Fixes bazelbuild#22754. Closes bazelbuild#22774. PiperOrigin-RevId: 645148811 Change-Id: Ib9d07d2ecbc3a79e3341de6739de1c3349124d6b Commit bazelbuild@1246ff4 Co-authored-by: Xdng Yng <wyverald@gmail.com>
Requested by @laszlocsomor during review of the upcoming EngFlow blog post: "Migrating to Bazel Modules (a.k.a. Bzlmod) - Repo Names and Runfiles". The .bazelignore file is required for now to prevent `bazel build //...` from recursing into the modules under `runfiles/` pending resolution of: - bazelbuild/bazel#22208 - bazelbuild/bazel#21515
Have Bazel ignore third_party/test/example_external_workspace explicitly until bazelbuild/bazel#22208 is resolved. Fixes `bazel test //third_party/...`. See also: - https://blog.engflow.com/2024/06/27/migrating-to-bazel-modules-aka-bzlmod---the-easy-parts/#ignore-local_repository-and-local_path_override-paths
Description of the bug:
Using a Bazel module within a child directory (i.e., in the same repository, via
local_path_override()
) that callsload()
on a top-level target breaks the build. The equivalent build usinglocal_repository()
in aWORKSPACE
file succeeds.In my mbland/bzlmod-local-module-bug example repo:
local_path_override()
and the bzmlod mechanism seem to assume the module will not reside within the same repo. The WORKSPACE or MODULE.bazel repository boundary marker files don't appear to have an effect.Please see the README.md in my example repo for more information.
Which category does this issue belong to?
Core
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Which operating system are you running Bazel on?
macOS 14.4.1 (23E224)
What is the output of
bazel info release
?release 8.0.0-pre.20240415.1
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
No. This happens in the current 7.1.1 release, as well as 7.0.0, 6.5.0, and 6.0.0.
Have you found anything relevant by searching the web?
No. All
local_path_override()
examples and issues I found presume the local module is outside the current directory.Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: