hundreds-father-404
05/20/2020, 11:46 PMdependencies
in your BUILD file and Pants will do the right thing based on import statements)
--
We need to convert Dependencies
from a PrimitiveField
to AsyncField
so that the engine can do its magic. Call sites would look like:
await Get[Addresses](DependenciesRequest(tgt.get(Dependencies))
This means we have one rule to go from DependenciesRequest -> Addresses
, just like we have one rule to go from HydrateSourcesRequest -> HydratedSources
.
Fine and good.
--
The challenge is with codegen dependency injection. Specifically, that that injection will need to access subsystem options, e.g. --protoc-runtime-targets
. It will need a SubsystemRule
.
But, we can’t have our generic DependenciesRequest -> Addresses
rule request that subsystem because it has no idea it’s needed. Instead, in the rule, we need a way to say something like “If there are any injected dependencies for this Dependencies
field, run the rule to inject those.”
This is unions, right? Something like:
injected_deps = await Get[InjectedDependencies](InjectDependenciesRequest, dependencies_field)
And then the Protoc backend would define a rule that goes from (ProtocDependencies, Protoc) -> InjectedDependencies
, where ProtocDependencies
belongs to the union?