Extracted out rule strip source roots failing due ...
# development
h
Extracted out rule strip source roots failing due to:
Copy code
Exception: WithDeps(Inner(InnerEntry { params: {PythonTestsAdaptor, OptionsBootstrapper}, rule: Task(Task { product: TestResult, clause: [Select { product: PythonTestsAdaptor }, Select { product: PyTest }, Select { product: PythonSetup }, Select { product: SubprocessEncodingEnvironment }], gets: [Get { product: TransitiveHydratedTargets, subject: BuildFileAddresses }, Get { product: RequirementsPex, subject: RequirementsPexRequest }, Get { product: SourceRootStrippedSources, subject: TargetAdaptor }, Get { product: Digest, subject: DirectoriesToMerge }, Get { product: InjectedInitDigest, subject: Digest }, Get { product: FallibleExecuteProcessResult, subject: ExecuteProcessRequest }], func: run_python_test(), cacheable: true }) })) did not declare a dependency on JustGet(Get { product: SourceRootStrippedSources, subject: PythonTestsAdaptor })
I’m not sure how to interpret this. If someone could take a look at https://github.com/pantsbuild/pants/pull/8284/files please, would be much appreciated
w
Copy code
Get(SourceRootStrippedSources, TargetAdaptor, target_adaptor)
inheritance is not used here
and
target_adaptor
is not exactly a TargetAdaptor: it's a subclass:
PythonTestsAdaptor
in this case.
h
Hm so it should be
yield Get(SourceRootStrippedSources, PythonTestsAdaptor, test_target)
? Inheritance will wok with that?
w
no: inheritance is not used anywhere in the engine
👍 1
so the second and third types need to exactly match.
we could fail a lot faster there, with a better error message
...in the
Get
constructor
(the only exception is for
@union
)
h
Got it. Is there any way to make this work with inheritance? We need the rule
strip_source_root
to stay general in accepting
TargetAdaptor
w
not really... would either need an
@union
declared for the relevant legal types ("things that might have python sources") or would need to lean further in on https://github.com/pantsbuild/pants/issues/4535
🤔 1
a
hack week hack week
👌 1
i was absolutely thinking that we could attempt to infer `@union`s from subtypes, but only as syntax sugar