pants icon indicating copy to clipboard operation
pants copied to clipboard

Polish Scala `repl`

Open stuhood opened this issue 2 years ago • 5 comments

Currently the scala repl:

  1. defaults to using python unless repl --shell=scala is specified (even if the python backend isn't enabled)
  2. fails if a target has resources dependencies (likely due to launching for the transitive dependencies, rather than using the Classpath helper for only the roots).

stuhood avatar Jan 10 '22 22:01 stuhood

And we may want to consider how to default to ammonite as well: https://github.com/pantsbuild/pants/pull/13838

tdyas avatar Jan 26 '22 10:01 tdyas

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?

tgolsson avatar May 22 '23 16:05 tgolsson

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.

tdyas avatar May 29 '23 22:05 tdyas

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

tdyas avatar May 29 '23 22:05 tdyas

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.

benjyw avatar Jan 21 '24 17:01 benjyw