Skip to content

v1.8.0

Latest
Compare
Choose a tag to compare
@Gedochao Gedochao released this 08 May 14:28
· 15 commits to main since this release
1fb78ff

Support for Scala 3.7.0 and 3.3.6

This Scala CLI version switches the default Scala version to 3.7.0.
The CLI internals are now built with Scala 3.3.6.

scala-cli version
# Scala CLI version: 1.8.0
# Scala version (default): 3.7.0

Added by @Gedochao in #3661

Support for Scala.js 1.19.0

This Scala CLI version adds support for Scala.js 1.19.0.

scala-cli -e 'println("Hello")' --js
# Compiling project (Scala 3.7.0, Scala.js 1.19.0)
# Compiled project (Scala 3.7.0, Scala.js 1.19.0)
# Hello

Added in #3643 and VirtusLab/scala-js-cli#134

Drop support for Scala <3.3 in runner and test-runner modules

Starting with Scala CLI v1.8.0, the runner and test-runner modules are built with Scala 3.3.6 LTS (on par with other modules built with Scala 3). They used to be built with Scala 3.0.2, as those modules may get added to the project class path when running, respectively, the main scope and tests. This means that if the application is using pre-3.3 Scala 3, TASTy versions will be incompatible.

This is mostly informative, as the change should not be breaking for standard Scala CLI usage, even if an older Scala 3 version is being used. For builds using Scala <3.3, the CLI will automatically fall back to version 1.7.1 of the modules, with an appropriate warning being printed. As the fallback will not be updated in the future, some Scala CLI features might start breaking at some point, as the APIs will stop being fully in sync.

scala-cli -e 'println("Hello")' --runner -S 3.1
# [warn] Scala 3.1.3 is no longer supported by the runner module.
# [warn] Defaulting to a legacy runner module version: 1.7.1.
# [warn] To use the latest runner, upgrade Scala to at least Scala 3.3.
# Compiling project (Scala 3.1.3, JVM (17))
# Compiled project (Scala 3.1.3, JVM (17))
# Hello
scala-cli test . -S 3.2
# [warn] Scala 3.2.2 is no longer supported by the test-runner module.
# [warn] Defaulting to a legacy test-runner module version: 1.7.1.
# [warn] To use the latest test-runner, upgrade Scala to at least 3.3.
# Compiling project (test, Scala 3.2.2, JVM (17))
# Compiled project (test, Scala 3.2.2, JVM (17))
# Test run started
# Test MyTests.foo started
# Hello, world!
# Test MyTests.foo finished, took 0.001 sec
# Test run finished: 0 failed, 0 ignored, 1 total, 0.003s

Realistically, the change is only breaking for apps using those modules directly themselves, either depending on them or using them to run things. In either case, it is recommended to update Scala up to at least 3.3 LTS.

Added by @Gedochao in #3650

Scala CLI now detects and runs multiple test frameworks, rather than just one

When running tests in a project with multiple test frameworks in use, Scala CLI will now attempt to detect and run all of them, rather than just one.

scala-cli test .
# Compiling project (Scala 3.7.0, JVM (23))
# Compiled project (Scala 3.7.0, JVM (23))
# Compiling project (test, Scala 3.7.0, JVM (23))
# Compiled project (test, Scala 3.7.0, JVM (23))
# Munit:
#   + foo 0.007s
# -------------------------------- Running Tests --------------------------------
# + MyTests.foo 1ms  
# Tests: 1, Passed: 1, Failed: 0
# + SimpleSpec
# Hello from zio-test
#   + print hello and assert true
# 1 tests passed. 0 tests failed. 0 tests ignored.
# 
# Executed in 97 ms
# 
# Completed tests
# ScalaTestSpec:
# example
# - should work
# Run completed in 44 milliseconds.
# Total number of tests run: 1
# Suites: completed 1, aborted 0
# Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
# All tests passed.

Additionally, it is now possible to pre-define multiple test frameworks to use (rather than just one, as before).

//> using test.frameworks org.scalatest.tools.Framework munit.Framework custom.CustomFramework

Pre-defining test frameworks may be preferable for bigger projects, as it allows to skip framework detection and run them directly. This is significant particularly for running tests with Scala Native and Scala.js.

Added by @Gedochao in #3653

Features

  • Support the --test flag with the publish & publish local sub-commands by @Gedochao in #3538
  • Misc no-op and/or error handling for the --test command line flag by @Gedochao in #3586
  • Add scala-cli version to the BuildInfo by @yadavan88 in #3617
  • fix sub-command tweaks by @Gedochao in #3646
  • Run all found test frameworks, rather than just one by @Gedochao in #3621
  • Allow to preconfigure multiple test frameworks by @Gedochao in #3653
  • Add support for some missing Scala compiler options & aliases without the need for -O by @Gedochao in #3665
  • Add support for the --repl-quit-after-init REPL option by @Gedochao in #3664

Fixes

  • Fix fmt to format the project.scala configuration file as any other Scala input by @Gedochao in #3609
  • Apply scalafix rules to test scope inputs, too by @Gedochao in #3641

Internal and build changes

  • Cross compile everything on the CI by @Gedochao in #3570
  • Add tests for the current behaviour of --cross by @Gedochao in #3589
  • Run test sub-command integration tests on default JVM settings by @Gedochao in #3592
  • Retry docs' tests on the CI by @Gedochao in #3618
  • Move ScopeOptions to SharedOptions by @Gedochao in #3612
  • Include missing Scala 3.6.* versions in Scala.listAll by @Gedochao in #3652
  • Check formatting with Scala CLI, rather than the scalafmt launcher itself by @Gedochao in #3660

Documentation changes

  • compileOnly option added to the documentation by @yadavan88 in #3600
  • Back port of documentation changes to main by @github-actions in #3601
  • docs: guide for compile only deps by @scarf005 in #3602
  • Back port of documentation changes to main by @github-actions in #3607
  • Add missing using directive reference docs by @Gedochao in #3608
  • Back port of documentation changes to main by @github-actions in #3610
  • Fix formatting in directives' reference docs by @Gedochao in #3611
  • Back port of documentation changes to main by @github-actions in #3616
  • Fixed DEV.md file related to test command by @yadavan88 in #3619
  • Correct doc with --project-version by @joan38 in #3662

Updates

Full Changelog: v1.7.1...v1.8.0