Skip to content

v1.6.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@Gedochao Gedochao released this 21 Jan 08:55
· 30 commits to main since this release
59c11b3

Scala CLI 1.6.0 will not be available on all distribution channels

Due to technical difficulties with our release pipeline, Scala CLI 1.6.0 release distribution channels were limited to:

  • its GitHub release page, where launchers for all platforms are available as normal
  • Maven Central
  • WinGet
  • Chocolatey

While it can be used as such, it was followed up with a hotfix 1.6.1 release, which should be available through all standard distribution channels.

Fixed commas being treated as using directive value separators & deprecated using them with whitespace

NOTE: these are breaking changes affecting using directives syntax.
They're technically fixes + a deprecation, but in a very rare scenario existing builds could break, if they were relying on the erroneous syntax.

This Scala CLI version fixes commas (,) being treated as using directive value separators on their own.

Formerly, a directive like:

//> using options -Wunused:locals,privates

Would be (erroneously) interpreted as the following 2 options for the compiler: -Wunused:locals and privates.
As a comma will now no longer be treated as a separator (which it never should have been), it will now be interpreted correctly as
a single option: -Wunused:locals,privates.
Before this change, the only way to pass this value to the options directive key was escaping the comma with double quotes:

//> using options "-Wunused:locals,privates"

The escaping is no longer necessary.

Additionally, using commas along with whitespace as separators is now deprecated for future removal.

scala-cli compile --scala-snippet '//> using options -Wunused:locals, -Wunused:privates'
# [warn] <snippet>-scala-snippet:1:34
# [warn] Use of commas as separators is deprecated. Only whitespace is neccessary.
# Starting compilation server
# Compiling project (Scala 3.6.3, JVM (23))
# Compiled project (Scala 3.6.3, JVM (23))

Finally, the use of /* (..) */ comments in using directives is no longer supported.

//> using /* some comment */ options -Wunused:locals /* some other comment */ -Wunused:privates
// this syntax used to be supported, but will now fail.

Added by @Gedochao in #3381 and #3333 and

Cap vague Scala versions at defaults

NOTE: this is a breaking change regarding how the Scala version is resolved.

We have changed how a Scala version is picked when major or major.minor prefixes are passed, rather than the full version tag:

For example:

//> using scala 3
// When compiled with Scala CLI v1.6.0, this snippet will use Scala 3.6.3 (the built-in default), even if a newer version has been released.

Added by @Gedochao in #3259

Support for Scala 3.6.3 and 2.13.16

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

scala-cli version
# Scala CLI version: 1.6.0
# Scala version (default): 3.6.3

It has also been tested with Scala 2.13.16.

Added by @Gedochao in #3426 and #3418

Support for Scala.js 1.18.1

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

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

Added in #3440 and VirtusLab/scala-js-cli#113

(⚡️ experimental) scalafix integration

We now support running scalafix rules with the fix sub-command.

scala-cli fix . --power
# The `fix` sub-command is experimental
# 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
# Running built-in rules...
# Writing project.scala
# Removing directives from Smth.scala
# Built-in rules completed.
# Running scalafix rules...
# Starting compilation server
# Compiling project (Scala 3.6.3, JVM (23))
# [warn] ./Main.scala:2:7
# [warn] unused local definition
# [warn]   val unused = "unused"
# [warn]       ^^^^^^
# Compiled project (Scala 3.6.3, JVM (23))
# scalafix rules completed.

Former fix functionalities are now referred to in the code as the built-in rules.
Effectively, fix now runs 2 separate sets of rules (both enabled by default): built-in and scalafix.
They can be controlled via the --enable-scalafix and --enable-built-in command line options.

scalafix rules are ran according to the configuration in <project-root>/.scalafix.conf.

It is possible to run external scalafix rules
with the (⚡️ experimental) scalafix.dep directive:

//> using scalafix.dep com.github.xuwei-k::scalafix-rules:0.6.0

Added by @Vigorge and @dos65 in #2968

Support for running snapshot versions of the build server (Bloop)

It is now possible to pass a snapshot version to the --bloop-version command line option.

scala-cli compile . --bloop-version 2.0.7-8-fe3f53d9-SNAPSHOT
# Starting compilation server
# Compiling project (Scala 3.6.3, JVM (23))
# Compiled project (Scala 3.6.3, JVM (23))
scala-cli --power bloop about
# bloop v2.0.7-8-fe3f53d9-SNAPSHOT
# 
# Using Scala v2.12.20 and Zinc v1.10.7
# Running on Java JDK v23.0.1 (~/Library/Caches/Coursier/arc/https/github.com/adoptium/temurin23-binaries/releases/download/jdk-23.0.1%252B11/OpenJDK23U-jdk_aarch64_mac_hotspot_23.0.1_11.tar.gz/jdk-23.0.1+11/Contents/Home)
#   -> Supports debugging user code, Java Debug Interface (JDI) is available.
# Maintained by the Scala Center and the community.

Added by @Gedochao in #3405

Support for suppressing deprecation warnings

It is now possible to suppress deprecation warnings with the --suppress-deprecated-warnings command line option.

scala-cli project-with-deprecated-stuff --suppress-deprecated-warnings

You can also suppress deprecation warnings globally by setting the suppress-warning.deprecated-features configuration key.

scala-cli config suppress-warning.deprecated-features true

Added by @Gedochao in #3406

Features

Fixes

  • Misc improvements in compiler options handling by @Gedochao in #3253
  • Allow shading of single-choice compiler options from the command line regardless of -/-- prefix by @Gedochao in #3279
  • Fix dependency main class detection throwing an NPE when JAR manifest doesn't list the main class correctly by @Gedochao in #3319
  • Fix commas being treated as using directives value separators & deprecate using them with whitespace by @Gedochao in #3333
  • Retain Bloop connection when restarting a build with --watch by @Gedochao in #3351
  • Improve deprecation warnings for commas with whitespace used as using directive value separators by @Gedochao in #3366
  • Recover from invalid paths returned from Bloop diagnostics by @Gedochao in #3372
  • Add missing support for excluding transient dependencies when publishing by @Gedochao in #3357
  • Fix using directives crashing on */ by removing /* (..) */ comments support in using_directives by @Gedochao in #3381
  • fix built-in rules: don't wrap directive values in double quotes if not necessary by @Gedochao in #3414
  • Don't migrate directives with fix for single-file projects by @Gedochao in #3422
  • Temporarily disable built-in rules of fix when --check is enabled, until fully supported by @Gedochao in #3427
  • Ensure test source directives with test scope equivalents are migrated by fix to project.scala by @Gedochao in #3425

Internal and build changes

  • Retry some of the occasionally flaky tests when failing on the CI by @Gedochao in #3320
  • Retry more occasionally flaky tests on the CI by @Gedochao in #3331
  • Tag scalajs-dom tests as flaky by @Gedochao in #3336
  • Tag native packager tests as flaky by @Gedochao in #3344
  • Make generate-junit-reports.sc script recover from test failures containing no trace data by @Gedochao in #3341
  • Support coursier-downloaded scala wrapper tests on Windows by @Gedochao in #3325
  • Get rid of duplicate names for uploaded/downloaded artifacts on the CI by @Gedochao in #3342
  • Retry generating the Windows launcher up to 5 times by @Gedochao in #3349
  • Retry generating Windows launchers in the generate-native-image.sh script directly, rather than the entire CI step by @Gedochao in #3350
  • Fix integration tests when run with a Scala 3 LTS RC version by @Gedochao in #3362
  • Retry some more flaky tests on the CI by @Gedochao in #3382
  • Run extra tests for main supported JVM versions by @Gedochao in #3375
  • tests: Add tests for issue with rereporting errors by @tgodzik in #3390
  • Add extra logs when retrying flaky tests by @Gedochao in #3433

Deprecations

  • Deprecate --src and --sources to disambiguate with --source compiler option by @Gedochao in #3412

Documentation changes

  • docs: document Scala Native flag options by @scarf005 in #3386
  • docs: document Scala Native flag options by @scarf005 in #3416
  • Back port of documentation changes to main by @github-actions in #3419
  • Merge scalafix doc into fix by @Gedochao in #3420

Updates

New Contributors

Full Changelog: v1.5.4...v1.6.0