Skip to content
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

[6.2.0] Allow WORKSPACE and WORKSPACE-loaded .bzl files to see Bzlmod root mo… #17714

Closed
wants to merge 2 commits into from
Closed

Conversation

ShreeM01
Copy link
Contributor

@ShreeM01 ShreeM01 commented Mar 9, 2023

…dule's mappings

Currently, we evaluate WORKSPACE (WorkspaceFileFunction) and WORKSPACE-loaded .bzl files (BzlLoadFunction with BzlLoadValue.KeyForWorkspace) with the repo mapping purely computed from previous WORKSPACE chunks. This is unlike BUILD-loaded .bzl files from WORKSPACE-defined repos (BzlLoadFunction with BzlLoadValue.KeyForBuild, which is the same as RepositoryMappingFunction), which take the mappings of the Bzlmod root module into account. This CL fixes that discrepancy by doing the same "repo mapping composition" everywhere.

Fixes #17655

RELNOTES: Fixed an issue where WORKSPACE and WORKSPACE-loaded .bzl files couldn't see the Bzlmod root module's mappings when Bzlmod is enabled.
PiperOrigin-RevId: 515318590
Change-Id: I4babc922f6cdb932d17ce18d9a9d9d427dbed2eb

tjgq and others added 2 commits March 9, 2023 09:09
While non-empty tree artifacts in the inputs to an action are expanded into the files they contain and omitted from the input mapping, empty tree artifacts are still present, as they signal the need to create the directory.

I'm explicitly skipping the empty tree artifacts in prefetchFiles() as otherwise they get skipped as a result of FileArtifactValue#isRemote() returning false for the FileArtifactValue associated with an empty tree artifact (even if it was produced remotely!), which is extremely subtle.

Closes #17183.

[NOTE: this is a combined cherry pick of 763f966 and 4c57def, as the former left Bazel in a broken state.]

PiperOrigin-RevId: 501207095
Change-Id: Ib52727d6fdc6b7a291a61fba33914e57531fb1f4
…dule's mappings

Currently, we evaluate WORKSPACE (`WorkspaceFileFunction`) and WORKSPACE-loaded .bzl files (`BzlLoadFunction` with `BzlLoadValue.KeyForWorkspace`) with the repo mapping purely computed from previous WORKSPACE chunks. This is unlike BUILD-loaded .bzl files from WORKSPACE-defined repos (`BzlLoadFunction` with `BzlLoadValue.KeyForBuild`, which is the same as `RepositoryMappingFunction`), which take the mappings of the Bzlmod root module into account. This CL fixes that discrepancy by doing the same "repo mapping composition" everywhere.

Fixes #17655

RELNOTES: Fixed an issue where WORKSPACE and WORKSPACE-loaded .bzl files couldn't see the Bzlmod root module's mappings when Bzlmod is enabled.
PiperOrigin-RevId: 515318590
Change-Id: I4babc922f6cdb932d17ce18d9a9d9d427dbed2eb
@Wyverald
Copy link
Member

Hello! Why was this closed?

@ShreeM01 ShreeM01 reopened this Mar 10, 2023
@Wyverald
Copy link
Member

ah, I see the presubmits have been failing due to a botched merge. Never mind then, I'll send a cherry-pick PR myself.

@Wyverald Wyverald closed this Mar 10, 2023
@ShreeM01
Copy link
Contributor Author

ah, I see the presubmits have been failing due to a botched merge. Never mind then, I'll send a cherry-pick PR myself.

Okay, thanks @Wyverald!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants