scala-cli icon indicating copy to clipboard operation
scala-cli copied to clipboard

Allow `run` with no sources / replacing `cs launch`

Open kubukoz opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe.

scala-cli is almost capable of replacing cs launch from Coursier: the only thing that appears to be missing, in order to be able to run an arbitrary application from dependencies, is that scala-cli run requires at least one source file / directory.

For example:

scala-cli run --dep software.amazon.smithy:smithy-cli:1.45.0 . --main-class software.amazon.smithy.cli.SmithyCli

Describe the solution you'd like

If dependencies are provided, relax the requirement of having to pass a file/directory.

In addition, there are a couple nice-to-haves:

  • discover main classes from dependencies, maybe with a flag?
  • if no sources are passed, don't start a compilation server (assume --server=false?)

Describe alternatives you've considered

  • Using cs launch as usual
  • Using a dummy empty directory as the sources

Additional context

This would be nice to enable the usage of code generators, such as smithy4s, without waiting for #610. For example, at the moment:

scala-cli run --scala 2.13 --dep com.disneystreaming.smithy4s::smithy4s-codegen-cli:0.18.15 . --main-class smithy4s.codegen.cli.Main --server=false -- version

which isn't terrible, but still requires that dummy directory (.).

kubukoz avatar Apr 05 '24 19:04 kubukoz