Skip to content

Retain module map names as Labels#633

Open
fmeum wants to merge 2 commits intobazelbuild:mainfrom
fmeum:header-modules
Open

Retain module map names as Labels#633
fmeum wants to merge 2 commits intobazelbuild:mainfrom
fmeum:header-modules

Conversation

@fmeum
Copy link
Copy Markdown
Collaborator

@fmeum fmeum commented Mar 12, 2026

With the exception of special module map names, all of them are effectively labels. This commit ensures that they are retained as Labels, not label string and thus:

  • memory usage is reduced for module maps from external repos, whose module map name previously resulted in a newly retained string;
  • module map names now use properly formatted external repo labels as names, which makes it more obvious what they are;
  • the roundtrip in header module compilation flows is avoided. This actually fixes a bug where the missing @@ prefix for label strings resulted in incorrect or even failing Label calls due to main repo labels being resolved relative to the rules_cc repo and external repo labels failing the validation of the Label constructor.

With the exception of special module map names, all of them are effectively labels. This commit ensures that they are retained as `Label`s, not label string and thus:
* memory usage is reduced for module maps from external repos, whose module map name previously resulted in a newly retained string;
* module map names now use properly formatted external repo labels as names, which makes it more obvious what they are;
* the roundtrip in header module compilation flows is avoided. This actually fixes a bug where the missing `@@` prefix for label strings resulted in incorrect or even failing `Label` calls due to main repo labels being resolved relative to the rules_cc repo and external repo labels failing the validation of the `Label` constructor.
@armandomontanez armandomontanez added type: bug Something that should be working isn't working P2 We'll consider working on this in future. (Assignee optional) category: core rules labels Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: core rules P2 We'll consider working on this in future. (Assignee optional) type: bug Something that should be working isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants