Conversation
0747210 to
9448d68
Compare
src/main/java/com/google/devtools/build/lib/bazel/bzlmod/IndexRegistry.java
Outdated
Show resolved
Hide resolved
| vendorDirectory.createDirectoryAndParents(); | ||
| } | ||
|
|
||
| for (RepositoryName repo : reposToVendor) { |
There was a problem hiding this comment.
This could probably be parallelized across all repos.
Do we need to worry about atomicity, e.g. if users interrupt the vendor command? Maybe we should atomically move the marker files into their final location at the end?
There was a problem hiding this comment.
Indeed, I left a TODO for parallelizing.
But I think copying one marker file after vendoring one repo source is fine? If the vendoring is interrupted, the user probably doesn't want to re-vendor what's already been vendored?
There was a problem hiding this comment.
If the copying of the marker file was atomic then I would agree, but what if the marker file is only written partially and then happens to become identical to an up-to-date one even if the contents aren't?
There was a problem hiding this comment.
I see! Updated the code to copy the marker file to a tmp file first and then rename it.
There was a problem hiding this comment.
there's technically still potential for races unless we actually have a proper locking scheme (eg. multiple Bazels can be working in the same workspace). but we can leave that for future PRs.
There was a problem hiding this comment.
then external/A/../B will point to ~/workspace/vendor/B
This only happens when the symlink is resolved somehow, right? Do people actually use this pattern to locate another repo? I would consider this is a hack?
There was a problem hiding this comment.
I have used something like this in the past to point --repo_env=JAVA_HOME to the embedded JDK for r_j_e's coursier and I could see some repo rules doing this, but I do agree it's a hack :-) I just wanted to point out that we should have such breakages on our radar when we make this optimization (I think we still should).
There was a problem hiding this comment.
Yeah moving + leaving a symlink sounds good to me.
I ended up not doing this. It could cause problem in this situation:
- vendor a repo foo: now external/foo -> vendor_dir/foo
- Remove --vendor_dir
- Think vendor mode is off, and I can change vendor_dir/foo freely (e.g. delete it)
- Build breaks because external/foo still points to the modified source
There was a problem hiding this comment.
did you actually run into this scenario? I'd expect step 2 to cause RepositoryDelegatorFunction to re-run and realize that --vendor_dir is now off.
There was a problem hiding this comment.
Yeah, then it will check the marker file, consider it's up-to-date and won't do anything. I guess we can remove the marker file under external/ to make sure the repo is re-refetched when vendor mode is off. I can explore in a next PR.
src/main/java/com/google/devtools/build/lib/bazel/bzlmod/VendorUtil.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/bazel/commands/VendorCommand.java
Show resolved
Hide resolved
2ae5fd0 to
b618862
Compare
src/main/java/com/google/devtools/build/lib/bazel/BazelRepositoryModule.java
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/bazel/commands/VendorCommand.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/bazel/bzlmod/VendorUtil.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/bazel/bzlmod/VendorUtil.java
Outdated
Show resolved
Hide resolved
| vendorDirectory.createDirectoryAndParents(); | ||
| } | ||
|
|
||
| for (RepositoryName repo : reposToVendor) { |
There was a problem hiding this comment.
there's technically still potential for races unless we actually have a proper locking scheme (eg. multiple Bazels can be working in the same workspace). but we can leave that for future PRs.
a979e42 to
3e1c4a3
Compare
| vendorDirectory.createDirectoryAndParents(); | ||
| } | ||
|
|
||
| for (RepositoryName repo : reposToVendor) { |
There was a problem hiding this comment.
Yeah moving + leaving a symlink sounds good to me. In fact I think that was my expectation in the beginning, before we settled on copying (can't remember why now).
src/main/java/com/google/devtools/build/lib/bazel/bzlmod/VendorUtil.java
Show resolved
Hide resolved
- Vendor registry files needed for Bazel module resolution to achieve offline build with vendor mode. - Also refactored bazel_vendor_test to avoid vendoring dependencies of bazel_tools, which speeds up the test significantly. Fixes bazelbuild#22554
4ad573d to
076de9f
Compare
|
Hello, |
|
@malt3 Yes, we plan to back port the full vendor feature into 7.3, as 7.2 will probably be released today. |
- Vendor registry files needed for Bazel module resolution to achieve offline build with vendor mode. - Also refactored bazel_vendor_test to avoid vendoring dependencies of bazel_tools, which speeds up the test significantly. Fixes bazelbuild#22554 Closes bazelbuild#22566. PiperOrigin-RevId: 641246903 Change-Id: I01a78612ad7ca454df2c70dc5dcc38ec2fbfb71c
offline build with vendor mode.
bazel_tools, which speeds up the test significantly.
Fixes #22554