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 by incorrect equals function.

Related: #19563

Closes #22953.

PiperOrigin-RevId: 650648957
Change-Id: Id31aa7d6f9bcbe2e3eb9e556ae31b3b8e42436bf
  • Loading branch information
meteorcloudy authored and bazel-io committed Jul 9, 2024
1 parent 5ff06d9 commit 2ab73dd
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 @@ -125,7 +125,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 @@ -141,6 +141,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 2ab73dd

Please sign in to comment.