scala-cli
scala-cli copied to clipboard
Prevent `scala-cli` from downloading anything with `--offline`
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
- (relevant comment) index.json gets downloaded implicitly
- https://github.com/VirtusLab/scala-cli/issues/1109
- https://github.com/VirtusLab/scala-cli/issues/1379
- https://github.com/VirtusLab/scala-cli/issues/1061
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.