-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…21009) If a local registry is specified using a workspace placeholder, the lockfile stores location details of the files with resolved workspace information, including user-specific paths. To fix that: Updating the logic to use the workspace placeholder %workspace% during lockfile writing and reverting to the resolved paths when reading. PiperOrigin-RevId: 600876401 Change-Id: I6162d8e8f1fe5e29b7899fc5bb218d1b6be926d0
- Loading branch information
Showing
4 changed files
with
48 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1286,6 +1286,7 @@ def testExtensionEvaluationOnlyRerunOnRelevantUsagesChanges(self): | |
|
||
def testLockfileWithNoUserSpecificPath(self): | ||
self.my_registry = BazelRegistry(os.path.join(self._test_cwd, 'registry')) | ||
self.my_registry.setModuleBasePath('projects') | ||
patch_file = self.ScratchFile( | ||
'ss.patch', | ||
[ | ||
|
@@ -1301,9 +1302,27 @@ def testLockfileWithNoUserSpecificPath(self): | |
' }', | ||
], | ||
) | ||
# Module with a local patch & extension | ||
self.my_registry.createCcModule( | ||
'ss', '1.3-1', patches=[patch_file], patch_strip=1 | ||
'ss', | ||
'1.3-1', | ||
{'ext': '1.0'}, | ||
patches=[patch_file], | ||
patch_strip=1, | ||
extra_module_file_contents=[ | ||
'my_ext = use_extension("@ext//:ext.bzl", "ext")', | ||
'use_repo(my_ext, "justRepo")', | ||
], | ||
) | ||
ext_src = [ | ||
'def _repo_impl(ctx): ctx.file("BUILD")', | ||
'repo = repository_rule(_repo_impl)', | ||
'def _ext_impl(ctx): repo(name=justRepo)', | ||
'ext=module_extension(_ext_impl)', | ||
] | ||
self.my_registry.createLocalPathModule('ext', '1.0', 'ext') | ||
scratchFile(self.my_registry.projects.joinpath('ext', 'BUILD')) | ||
scratchFile(self.my_registry.projects.joinpath('ext', 'ext.bzl'), ext_src) | ||
|
||
self.ScratchFile( | ||
'MODULE.bazel', | ||
|
@@ -1318,10 +1337,14 @@ def testLockfileWithNoUserSpecificPath(self): | |
|
||
with open('MODULE.bazel.lock', 'r') as json_file: | ||
lockfile = json.load(json_file) | ||
remote_patches = lockfile['moduleDepGraph']['[email protected]']['repoSpec'][ | ||
'attributes' | ||
]['remote_patches'] | ||
ss_dep = lockfile['moduleDepGraph']['[email protected]'] | ||
remote_patches = ss_dep['repoSpec']['attributes']['remote_patches'] | ||
ext_usage_location = ss_dep['extensionUsages'][0]['location']['file'] | ||
|
||
self.assertNotIn(self.my_registry.getURL(), ext_usage_location) | ||
self.assertIn('%workspace%', ext_usage_location) | ||
for key in remote_patches.keys(): | ||
self.assertNotIn(self.my_registry.getURL(), key) | ||
self.assertIn('%workspace%', key) | ||
|
||
def testExtensionEvaluationRerunsIfDepGraphOrderChanges(self): | ||
|