pants
pants copied to clipboard
Polish Scala `repl`
Currently the scala repl
:
- defaults to using
python
unlessrepl --shell=scala
is specified (even if thepython
backend isn't enabled) - fails if a target has
resources
dependencies (likely due to launching for the transitive dependencies, rather than using theClasspath
helper for only the roots).
And we may want to consider how to default to ammonite as well: https://github.com/pantsbuild/pants/pull/13838
Just hit 1) for my OCI backend; and found this in the Pants sources: https://github.com/pantsbuild/pants/blob/ae520ccfc86378dac3bbc651e322c41e8cdfaa05/src/python/pants/core/goals/repl.py#L109-L111 Did you think anything about how to solve it in a generic way?
The ReplImplementation
union could be modified to be more generic in a way similar to how other goal-related unions were: Have ReplImplementation
subclasses declare a specific list of FieldSet
types which apply for that ReplImplementation
. This would allow the repl goal core rules to determine whether targets are compatible with a specific repl implementation.
For example, TestRequest
defines field_set_type
for subclasses to specify which FieldSet
class applies to the test implementation. https://github.com/pantsbuild/pants/blob/9e95a8e154b85e31fa8907117b36e717c99bf206/src/python/pants/core/goals/test.py#L312
Fixing 1) (defaulting to the Python REPL even when your current target universe is all JVM) may relate to https://github.com/pantsbuild/pants/issues/16445 - if Pants gains some concept of "realm of interest" that allows it to know which languages/runtimes/toolchains are relevant to the current target set.