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

Move from label collection to label stamping #839

Open
Tracked by #938
ittaiz opened this issue Sep 2, 2019 · 7 comments
Open
Tracked by #938

Move from label collection to label stamping #839

ittaiz opened this issue Sep 2, 2019 · 7 comments
Labels
dep-tracking Strict/unused deps, label collections related issues

Comments

@ittaiz
Copy link
Member

ittaiz commented Sep 2, 2019

Currently we collect labels in various places (scala_library/scala_binary/scala_import/etc) and propagate them onwards.
This is valuable since when we want to report to the user on a problem with a transitive dependency (unused deps/strict deps) we have a meaningful label and not just a file path.
Java rules also used a similar (but different) approach but have moved a year or more ago to a different approach.
Their current approach "stamps" the jar upon creation* with its label (k/v in the manifest.mf) and so if they ever need to report (which is the rare case) then and only then they pay the (higher) price of opening the jar and reading the manifest to improve the user reporting.
This doesn't actually happen on jar creation but implicitly on ijar creation.
This means that we need to explicitly stamp our outputs for scala_import and scala_macro_library since they don't go through ijar. java_common has a special API for this.

Note that some tests will fail with this change since our existing mechanism allows us to remap labels (if bar exports foo then when someone uses bar the outputs of foo will be listed as bar). This is valuable in having facade targets for logical libraries.
After lengthy discussions it was agreed that the solution for this pattern should be in a smarter tool that will use bazel query to find the fact that bar exports foo and will add bar to the caller.
Also the changes in #716 are needed.

@ittaiz
Copy link
Member Author

ittaiz commented Sep 2, 2019

@long-stripe wdyt about taking this one? Shouldn't be very complicated and will be a nice win (remove a lot of noise from our code)

@long-stripe
Copy link
Contributor

@ittaiz Yeah if you think it's a good thing to start on! I can't promise anything timeline wise, but I will try and carve out some personal time in the coming week or so to look at this.

@ittaiz
Copy link
Member Author

ittaiz commented Sep 2, 2019 via email

@long-stripe
Copy link
Contributor

FYI small heartbeat - I am still interested in tackling this, but haven't had time lately.

@ittaiz
Copy link
Member Author

ittaiz commented Sep 21, 2019 via email

@long-stripe
Copy link
Contributor

@ittaiz I was just gonna meander about and deep dive in when I have the time, but if you have links to relevant parts of the codebase that I should be focusing on, that would be super helpful!

@ittaiz
Copy link
Member Author

ittaiz commented Sep 22, 2019

Unfortunately it’s spread throughout the codebase. I’d start in the lead (compiler plugin) and trace back.

@liucijus liucijus added the dep-tracking Strict/unused deps, label collections related issues label Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dep-tracking Strict/unused deps, label collections related issues
Projects
None yet
Development

No branches or pull requests

3 participants