VirtusLab / scala-cli

Scala CLI is a command-line tool to interact with the Scala language. It lets you compile, run, test, and package your Scala code (and more!)
https://scala-cli.virtuslab.org
Apache License 2.0
547 stars 129 forks source link

hard guarantees about not downloading new JVM or Scala version #2242

Open aschofie opened 1 year ago

aschofie commented 1 year ago

At the moment, specifying the JVM arg of corretto:11 will actually download corretto:11.0.19.7.1-- which is fine, but what happens if AWS releases corretto:11.0.19.7.1.1? Will scala-cli check for and download it? If so, it makes scala-cli unsuitable for use in containers, as while I can specify the version in the Dockerfile and make sure it downloads into the image, I cannot be sure a new sub-version will be released and scala-cli will download it on every container instance run. The same for the scala version.

There needs to be a way to specify that scala-cli should not check for any new versions of the JVM or scala-- just make a best-effort to use what is specified and fail if not found.

MaciejG604 commented 1 year ago

There is a way to specify the JVM used with --java-home option and using javaHome directive. E.g: //> using javaHome /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home or --java-home /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home

However, JVM 17 is mandatory when using Bloop and it will be installed if the one provided has a lower version. You can opt for using scalac instead of Bloop with option server=false. Note that the bsp command always uses Bloop.

For the version of Scala You can specify a version down to it's patch version e.g. 3.3.0, that way only this version is used always.