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

Let repo rule attributes reference extension apparent names #23369

Closed
wants to merge 9 commits into from

Conversation

fmeum
Copy link
Collaborator

@fmeum fmeum commented Aug 20, 2024

Fixes #19055

RELNOTES: Repository rules instantiated in the same module extensions can now refer to each other by their extension-specified names in label attributes.

@fmeum fmeum force-pushed the 19055-lazy-repo-mapping branch 3 times, most recently from 94bd2b6 to 39dde25 Compare August 20, 2024 21:54
@fmeum fmeum changed the title WIP: Lazy repo mappings Let repo rule attributes reference extension apparent names Aug 20, 2024
@fmeum fmeum marked this pull request as ready for review August 20, 2024 21:56
@github-actions github-actions bot added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. team-Documentation Documentation improvements that cannot be directly linked to other team labels awaiting-review PR is awaiting review from an assigned reviewer labels Aug 20, 2024
@fmeum
Copy link
Collaborator Author

fmeum commented Aug 20, 2024

This is currently stacked on #23371.

@fmeum
Copy link
Collaborator Author

fmeum commented Aug 21, 2024

I fixed up the error messages and also rebased on master.

Copy link
Member

@Wyverald Wyverald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks nice!

site/en/external/extension.md Outdated Show resolved Hide resolved
*/
public ImmutableMap<String, RepoSpec> createAndGetRepos(StarlarkSemantics starlarkSemantics)
throws EvalException, InterruptedException {
// LINT.IfChange
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this actually work? I'm wondering if this plays well with copybara.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what copybara does with it in the GitHub -> google3 direction, but Ivo has been adding a bunch of these comments lately, so I would expect them to work at least if you fix them up during import.

// LINT.ThenChange(//src/main/starlark/builtins_bzl/common/cc/link/lto_indexing_action.bzl)
// LINT.IfChange

moduleExtensionMetadata,
repoMappingRecorder.recordedEntries());
} catch (EvalException e) {
env.getListener().handle(Event.error(e.getMessageWithStack()));
Location innermostLocation =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a common pattern? IOW why don't we do this with other catch (EvalException e) clauses? If we should, should we create a helper method for it or something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a helper method and updated all other cases I could find. It's slightly duplicative information as the stack trace also contains locations, but this gets rid of the <builtin> and is also easier to parse and copy-paste.

@fmeum fmeum requested a review from lberki as a code owner August 22, 2024 12:19
@fmeum fmeum requested review from Wyverald and removed request for lberki August 22, 2024 12:20
@Wyverald Wyverald added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Aug 22, 2024
@fmeum
Copy link
Collaborator Author

fmeum commented Aug 22, 2024

@bazel-io fork 7.4.0

@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Aug 23, 2024
@fmeum fmeum deleted the 19055-lazy-repo-mapping branch August 23, 2024 20:24
Wyverald pushed a commit that referenced this pull request Sep 10, 2024
Fixes #19055

RELNOTES: Repository rules instantiated in the same module extensions can now refer to each other by their extension-specified names in label attributes.

Closes #23369.

PiperOrigin-RevId: 666893202
Change-Id: Ib2eaa55fcb563adc86e16dc4a357ac808228ebda
github-merge-queue bot pushed a commit that referenced this pull request Sep 10, 2024
…23585)

Fixes #19055

RELNOTES: Repository rules instantiated in the same module extensions
can now refer to each other by their extension-specified names in label
attributes.

Closes #23369.

PiperOrigin-RevId: 666893202
Change-Id: Ib2eaa55fcb563adc86e16dc4a357ac808228ebda

---------

Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Documentation Documentation improvements that cannot be directly linked to other team labels team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide module extensions with a way to reference extension repos
2 participants