Skip to content

v1.5.0

Compare
Choose a tag to compare
@Gedochao Gedochao released this 22 Aug 21:54
· 90 commits to main since this release
e99f770

Support for Scala 3.5.0

This Scala CLI version switches the default Scala version to 3.5.0.

scala-cli version
# Scala CLI version: 1.5.0
# Scala version (default): 3.5.0

Added by @Gedochao in #3093.

Support for Scala Native 0.5.5

This Scala CLI version switches the default Scala Native version to 0.5.5.

scala-cli -e 'println("Hello from Scala Native 0.5.5!")' --native
# Compiling project (Scala 3.5.0, Scala Native 0.5.5)
# Compiled project (Scala 3.5.0, Scala Native 0.5.5)
# [info] Linking (multithreadingEnabled=true, disable if not used) (894 ms)
# [info] Discovered 888 classes and 5407 methods after classloading
# [info] Checking intermediate code (quick) (31 ms)
# [info] Multithreading was not explicitly enabled - initial class loading has not detected any usage of system threads. Multithreading support will be disabled to improve performance.
# [info] Linking (multithreadingEnabled=false) (299 ms)
# [info] Discovered 499 classes and 2497 methods after classloading
# [info] Checking intermediate code (quick) (5 ms)
# [info] Discovered 478 classes and 1912 methods after optimization
# [info] Optimizing (debug mode) (403 ms)
# [info] Produced 9 LLVM IR files
# [info] Generating intermediate code (368 ms)
# [info] Compiling to native code (1565 ms)
# [info] Linking with [pthread, dl]
# [info] Linking native code (immix gc, none lto) (83 ms)
# [info] Postprocessing (0 ms)
# [info] Total (3625 ms)
# Hello from Scala Native 0.5.5!

Added by @Gedochao in #3117

(⚡️ experimental) Support for exporting to a Maven project

It is now possible to export a Scala CLI project to Maven.

scala-cli export --script-snippet 'println("No need to create the pom.xml yourself!")' --mvn --power -o mvn-demo
# Some utilized features are marked as experimental:
#  - `export` sub-command
#  - `--mvn` option
# Please bear in mind that non-ideal user experience should be expected.
# If you encounter any bugs or have feedback to share, make sure to reach out to the maintenance team at https://github.com/VirtusLab/scala-cli
# Exporting to a maven project...
# Exported to: ~/scala-cli-tests/mvn-demo
cd mvn-demo
mvn scala:run -DmainClass=snippet_sc
# (...)
# No need to create the pom.xml yourself!
# [INFO] ------------------------------------------------------------------------
# [INFO] BUILD SUCCESS
# [INFO] ------------------------------------------------------------------------
# [INFO] Total time:  2.589 s
# [INFO] Finished at: 2024-08-22T12:08:36+02:00
# [INFO] ------------------------------------------------------------------------

Added by @yadavan88 in #3003.

Support for launching apps from dependencies without other inputs

It is now possible to launch an app by just specifying its dependency, without the need to provide any source files.
In such a case the build server will not be started, as there's no compilation to be done.
There's also no need to specify the main class, as it's now being detected automatically in dependencies as well.
Do note that explicitly calling the run sub-command is necessary here, as otherwise Scala CLI will default to the REPL.

scala-cli run --dep io.get-coursier:coursier-cli_2.13:2.1.10 -- version
# 2.1.10

This can be used similarly to Coursier's cs launch.

Added by @kasiaMarek in #3079.

(⚡️ experimental) JMH available in various commands and via using directives

Some improvements have been done to the experimental support for JMH (Java Microbenchmark Harness).

The --jmh and --jmh-version options can now be passed to a number of commands:

  • run, as it was before (note that when --jmh is passed to run, the project's main class will default to running the benchmarks rather than the project's default main method; this behaviour is likely to be changed in future versions).
  • compile, so that a Scala CLI project with benchmarking can be compiled separately from being run;
  • package, although the resulting artifacts will run the project as normal for now, rather than benchmarks;
  • setup-ide, so that benchmarking projects can be imported to your IDE of choice;
  • test and export will now also no longer fail with --jmh, although no specific implementations for benchmarking are in place there yet.

It is now also possible to control JMH with using directives:

  • //> using jmh allows to enable JMH for the project, being the equivalent of the --jmh option.
  • //> using jmhVersion <version> allows to set the JMH version to use, being the equivalent of the --jmh-version option.
//> using jmh
//> using jmhVersion 1.37
package bench

import org.openjdk.jmh.annotations.*
import java.util.concurrent.TimeUnit

@BenchmarkMode(Array(Mode.AverageTime))
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@Warmup(iterations = 1, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 10, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@Fork(0)
class Benchmarks {
  @Benchmark
  def foo(): Unit = {
    (1L to 1000L).sum
  }
}

Expect more improvements in this area in the future.
Also, do play with it and give us feedback about the current implementation!

Added by @Gedochao in #3091 and #3118.

Support for auto-completions in fish

We now have command line auto-completions for the fish shell.

Added by @KristianLentino99 in #3104.

--js-es-module-import-map no longer requires --power mode

A bit of a minor thing, but you can now use the --js-es-module-import-map option without enabling --power mode.

Added by @Gedochao in #3086.

Features

Fixes

  • bugfix: Exclude sourcecode dependency by @tgodzik in #3094
  • bugfix: Exclude both sourcecode and collection-compat correctly by @tgodzik in #3105
  • Make package command handle directories in extra classpath by @joan38 in #3096
  • Add extra try-catch clause + extra logging in LocalRepo by @Gedochao in #3114
  • Fix/changing options from sources should not require reload by @MaciejG604 in #3112
  • fix: remove the --release flag by @kasiaMarek in #3119
  • Remove adding test options to the project/build target name hash by @MaciejG604 in #3107

Internal changes

Documentation changes

  • Add more env vars & generate reference docs for them by @Gedochao in #3075

Updates

New Contributors

Full Changelog: v1.4.3...v1.5.0