-
Notifications
You must be signed in to change notification settings - Fork 277
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
Information passing between phases #965
Comments
cc @borkaehw |
A few notes: 1 - We should audit the interactions between the current phases. I'm interested in:
At the very least we can use this to establish and document some conventions for fields. 2 - Do we have any cases where a downstream phase needs to override something from an upstream phase? AFAIK we only have two cases close to flavor:
We can support both of these cases without having overrides. |
Sounds good. Can you do this audit?
I guess we can, what's the con of overrides? It sounds to me like a simple and clear pattern. Additionally I'd love to understand what are the cons in your eyes to providers compared to structs/dictionaries. AFAICT providers are that with a bit of more structure and familiarity. |
Moved from #958:
I'm consciously a bystander on the phase stuff. I'm glad you all got this FWIW, I did have similar feelings to the comment above. This is what I understand (you all may already know this): I got the impression providers were intended for "inter-target" This doesn't seem to relate to phases? Putting that special behavior aside, I did explore what behavior providers They do have the I think I'll avoid providers when I'm not using them in the rule impl/dep I will say that I find the current factoring of the scalac provider stuff a
|
Can do, but it will have to be a few weeks from now.
I guess I just don't see where we need to use overrides. AFAIK we either have exactly one thing we need to return (like the final executable) or we have an aggregation (like the output files). @borkaehw might be able to weigh in too, as they've pushed on the phase architecture quite a bit.
What @smparkes said 😄 |
I've been meaning to write here. Re overrides- I think the extra power is valuable. |
As a concrete example, I'm looking to filter out some JARs after rules_scala/scala/private/phases/phase_compile.bzl Lines 123 to 127 in c9cc7c2
so the only way this can be customized is if I substitute Ideally I want the original |
@eed3si9n can you give more context what are you trying to achieve that you need to change jar list? Currently
|
I work for Twitter, and we're trying to migrate existing Pants codebase to Bazel simultaneously since the There are, however, situations where majority of the users would want to use version X of something like Guava, but some needs to stay behind or ahead for specific reasons. Allowing terminal node to perform lightweight filtering can solve this sticky problem of ending up with multiple Guavas on the classpath. Another similar use case is allowing the build users to exclude specific files for deployment images. I assume this is also done to handle conflict with the data processing runtimes such as Hadoop, or to swap out the logging libraries. |
We need to define how information should be passed between phases.
Current strategy is for each phase to return a struct and then following phases get a struct with all the structs nested (keyed by phase name).
This has the following drawbacks:
This means that to achieve this phases need to traverse all previous structs for named attributes.
We'd like to fix both of the above. It's likely that overrides and augmentation should be achieved by using the dependency inversion principle and having downstream phases define their needs and then upstream phases can expose this in whatever strategy we choose.
One option we can choose is to have each phase expose a dict of internal_providers (keyed by the name of the provider). This dict will also be an input to each phase and so phases will be able to both override and augment internal providers.
Another advantage of providers is that they are a recognized in the eco system and tools will support them with respect to docs and such.
To the best of my understanding providers are not a lot more than structs.
@andyscott has suggested we use well defined dictionaries or structs.
We should discuss these options and what value does each bring as well as other options that people might surface.
The text was updated successfully, but these errors were encountered: