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

Prevent `scala-cli` from downloading anything with `--offline`

Open Gedochao opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. We need an option preventing scala-cli from using the internet. Even when network connection is available, it should be possible to disable scala-cli from relying on it.

Describe the solution you'd like Passing --offline should prevent downloading any dependencies which aren't already in the local cache. Java should be used from the cache or PATH. Bloop should be used if available locally, otherwise scala-cli should silently fallback to --server=false when --offline is passed.

It is acceptable for some features to be unavailable when running --offline:

  • compiling and running non-latest Scala versions
  • compiling with dependencies from outside the local cache
  • running bloop if not pre-loaded
  • potentially other non-basic usecases

Describe alternatives you've considered Even when the coursier cache is pre-filled, scala-cli tends to download things in many contexts, some them non-obvious to users (i.e. when _.java code is piped to scala-cli). So simply pre-filling the coursier and bloop cache isn't sufficient.

Additional context

Gedochao avatar Oct 05 '22 13:10 Gedochao

Btw. falling back to server=false effectively shuts down our IDE support in the --offline mode (no Bloop, no BSP 😞), which is something we should keep in mind.

Gedochao avatar Oct 05 '22 13:10 Gedochao