-
-
Notifications
You must be signed in to change notification settings - Fork 636
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
Complete support for parametrize
in overrides
#14430
Comments
stuhood
added a commit
that referenced
this issue
Feb 11, 2022
…copies of a target (#14408) As introduced in #13882 and designed in https://docs.google.com/document/d/1mzZWnXiE6OkgMH_Dm7WeA3ck9veusQmr_c6GWPb_tsQ/edit#, this change adds the `parametrize` builtin. Examples: ```python # Create two copies of each generated target, with addresses qualified with `@resolve=a` and `@resolve=b`. python_sources( .., resolve=parametrize(“a”, “b”), ) # ...alternatively, define an alias for some or all of the values: python_sources( .., resolve=parametrize(“a”, b="bread and butter"), ) # Create four copies of each generated target, with addresses qualified with both parametrized fields. scala_sources( .., resolve=parametrize(“a”, “b”), jdk=parametrize("c", "d"), ) # Apply parametrization to only some of the generated targets: scala_sources( .., overrides={ "JdkDependent.scala": {"jdk": parametrize("c", "d")}, }, ) ``` ---- `parametrize` may be used in any field (other than `name`) of non-generator targets, but is limited to `moved` fields of generator targets (i.e., those which will be moved from the generator to the generated target). Using `parametrize` in the `overrides` of a target generator requires adjustments to the target generator's implementation (see #14430): this change only adjusts the implementation for target file generators (`TargetFileGenerator`).
Is this still relevant? |
Yes. All usages of |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Supporting
parametrize
in theoverrides
of a target generator (in #14408) required changing the shape ofoverrides
, in order to allow some override "keys" to result in multiple targets. Sinceoverrides
are implemented separately by eachGenerateTargetsRequest
instance, fully supportingparametrize
for all of them will require changes to each of them.Un-ported implementations (those not yet supporting
parametrize
inoverrides
) useGenerateTargetsRequest.require_unparametrized_overrides
to assert thatparametrize
has not been used inoverrides
. Porting them involves removing usage of that method, and consuming theoverrides
directly to potentially generate multiple targets for some override keys.It's also possible that during the course of porting we'll be able to remove duplication from
GenerateTargetsRequest
in the area of overrides... perhaps by adjusting target generation into a@rule
that returns the list of keys to generate for...?The text was updated successfully, but these errors were encountered: