Skip to content

Commit

Permalink
Fix vendoring immediatelly after a normal repo fetch
Browse files Browse the repository at this point in the history
Repo wasn't vendored as expected due to wrong SkyValue cache caused incorrect
equals function.
  • Loading branch information
meteorcloudy committed Jul 4, 2024
1 parent 6e2e3a1 commit 8b3a693
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ public boolean equals(Object other) {
return Objects.equal(path, otherValue.path)
&& Objects.equal(sourceDir, otherValue.sourceDir)
&& Arrays.equals(digest, otherValue.digest)
&& Objects.equal(fileValues, otherValue.fileValues);
&& Objects.equal(fileValues, otherValue.fileValues)
&& Objects.equal(excludeFromVendoring, otherValue.excludeFromVendoring);
}
return false;
}
Expand Down
19 changes: 19 additions & 0 deletions src/test/py/bazel/bzlmod/bazel_vendor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,25 @@ def testVendorFailsWithNofetch(self):
'ERROR: You cannot run the vendor command with --nofetch', stderr
)

def testVendorAfterFetch(self):
self.main_registry.createCcModule('aaa', '1.0')
self.ScratchFile(
'MODULE.bazel',
[
'bazel_dep(name = "aaa", version = "1.0")',
'local_path_override(module_name="bazel_tools", path="tools_mock")',
'local_path_override(module_name="local_config_platform", ',
'path="platforms_mock")',
],
)
self.ScratchFile('BUILD')

self.RunBazel(['fetch', '--repo=@@aaa~'])
self.RunBazel(['vendor', '--vendor_dir=vendor', '--repo=@@aaa~'])

repos_vendored = os.listdir(self._test_cwd + '/vendor')
self.assertIn('aaa~', repos_vendored)

def testVendoringMultipleTimes(self):
self.main_registry.createCcModule('aaa', '1.0')
self.ScratchFile(
Expand Down

0 comments on commit 8b3a693

Please sign in to comment.