v0.1.0
This is the first release that contains breaking changes (within using directives) since the project became public. We want to thank our users for all the warm reception we see over various channels, all bug reports and suggestions. With such support, developing Scala CLI is a real pleasure.
New Contributors
- @jchyb become a member of the core team, with focus on Scala Native and scripting
- @mpkocher made their first contribution in #514
- @lolgab made their first contribution in #581
Thank you!
New syntax for using directives
This release brings a lot of changes within using directives.
Firstly, our internal parser for using directives was retired in favor of using_directives library. The using directives grammar has been cleaned up. From this release, using directives values need to be a valid Scala primitives namely numbers, booleans or strings. @pikinier20 has concluded that effort in #364
We have changed the syntax further, namely:
- using directives in plain comments (
// using foo bar
and/* using foo bar */
) is deprecated - annotation syntax for using directives is deprecated (
@using
) - we are introducing special comments for using directives using
>
://> using foo bar
and/*> using foo bar */
Old syntaxes will still work in 0.1.x
releases but will result in warnings like this one:
[warn] ./a.scala:2:1: This using directive is ignored. Using directive using plain comments are deprecated. Please use a special comment syntax: '//> ...' or '/*> ... */'
[warn] // using options "-Xasync"
[warn] ^^^
This change was introduced by @romanowski in #546.
Scala CLI now uses its own bloop instance
Using a global bloop server is not ideal, since it limits our control on used options or JVM. In the past, we've also had some conflicts with Metals managing that server. Bloop has potential security vulnerabilities when using Scala CLI within multi-user environments and for that we wanted to switch our communication with bloop so it use named pipes rather than sockets. That is why we decided that Scala CLI should use its own dedicated bloop sever that is fully controlled by us.
@alexarchambault made the required changes in bloop that lives in our fork until they are merged upstream (we do not plan to maintain that fork for long). Also, we decided to run our bloop on Java 17. That work resulted in following PRs: #469, #508, #507 and #529.
Having a dedicated bloop sever increased consumed resources, mainly the memory. To reduce that impact @tpasternak analyzed (#515) usage of different garbage collectors so our bloop server can release memory back to OS when unused. ZGC
offers the best performance so it was used by default in our bloop server in #553.
Redesign of Scala Native support
In order to decouple Scala CLI from specific versions of Scala Native, Scala Native CLI was created and used within Scala CLI to build Scala Native applications. Scala CLI can now easily support multiple versions of Scala Native, including future releases without a need to release Scala CLI. Scala CLI supports Scala Native 0.4.3
so it is possible to use Scala Native with Scala 3.
@jchyb co-created Scala Native CLI and introduced it into Scala CLI in: #527, #449 and #554
Scala CLI can be run with specific version or using latest snapshot
Since 0.1.0
it is possible to specify in command line a specific version of Scala CLI. It is also possible to use the latest snapshot. It will use the JVM-based launcher and this will come with overhead needed to start JVM for each scala-cli usage.
This feature is also compatible with SheBang header in Scala Script:
#!/usr/bin/env -S scala-cli --cli-version 0.0.9+131-gf0ab5c40-SNAPSHOT shebang
println(args(1))
This feature was added by @lwronski in #548 .
Improve handling of automatically-resolved versions
Until now, Scala CLI was using latest released Scala version that matches the input provided by users (e.g. 3
or 2.12
). As 2.13.7
showed us, small changes in the internals may break bloop or other parts of Scala CLI and with that break overnight applications or CIs. To avoid such a problem, @lwronski in #456 and #563 added support for predefined list of Scala versions per wildcard, defined in a file in a separate Scala CLI-controlled repository. We plan to update that list with all new Scala version that would work with Scala CLI given Scala CLI version.
This feature only applies to automatically-resolved versions so it is possible to provide any version of Scala even if it is not verified by the team.
Rename our build directory to .scala-build
We were using a directory called .scala
to store all build-related artifacts (.class files, bloop details etc.) and it was causing some confusion in Metals and messing up with searching for Scala sources in scripts. @alexarchambault changed that directory to .scala-build
in #573
We are also checking if the current user can access build directory and in case not we fall back to a global build directory within the user's home directory. This change allows Scala CLI to be run as a different user/root using sudo
and similar commands.
Scala CLI is used to verify code snippets in our repository
This is not related strictly to this release, but from some time (#562) we are using scala-cli to verify the snippets in reported issues using scala-cli based github action created by @lwronski
Improve handling of JVMs and Java sources
This release improves the way Scala CLI handles JVMs and Java sources so we decided to group all those issues together. Even though Scala CLI has Scala
in its name, it can be used to build Java-only projects.
The list is as follow:
- Generate semantic DBs for Java sources, pass wrapped sources details over BSP by @alexarchambault in #567
- Warn if jvm api cannot be used by @tpasternak in #447
- Workaround issue with empty JAVA_HOME by @alexarchambault in #475
- Native image: do not filter-out JVM options passed to scala-cli app by @tpasternak in #474
- Java properties set in using directives by @tpasternak in #493
- Bump default java to 11 by @tpasternak in #516
Other changes:
- In case of critical failures, safe stacktraces show error message and store full stacktrace in the file by @tpasternak in #461
- Add missing options and using directives related to Scala.js by @tpasternak and @lwronski in #492 and #539
- Accept zip as a input by @lwronski in #460
- Allow custom repositories for scala-library in repl by @tpasternak in #520
- Unify 'help' and 'version' commands by @tpasternak in #454
- Handling of failures and crashes within our BSP server was improved by @tpasternak and @romanowski in #471, #552 and #564
- Add help parameter to print specific options for ScalaNative and ScalaJS groups by @lwronski in #489
Bugfixes
- Fix #528: Non-default scalafmt version leading to errors by @jchyb in #545
- Ignore SIGPIPE on Linux by @alexarchambault in #503
- Default module kind to NoModule in ScalaJs by @ckipp01 in #342
- Ignore NoClassDefFoundError exception in test runner by @lwronski in #495
- Add log if someone try to run test without zio-test-sbt by @lwronski in #505
- Fix separator typo when installing shell completions by @mpkocher in #514
- Fix running on JS release mode by @romanowski in #522
- Fix - use resourcesDir in package command by @lwronski in #519
- Fix #525: Spuriously duplicate options by @jchyb in #536
- Include scope test in export to sbt by @lwronski in #523
- Report error if scala script not exists by @lwronski in #538
- Ignore main scope in test command by @lwronski in #556
- Ignore SIGPIPE on all Unixes by @alexarchambault in #569
- For -S 3.x input use latest release from 3.x versions by @lwronski in #563
- Handle errors from using directives by @tpasternak in #465
Internal improvements
- Simplify TASTy stuff by @alexarchambault in #500
- Address unused param warning by @alexarchambault in #484
- Better musl handling by @alexarchambault in #502
- Deploy documentation from master using merge commit to stable by @lwronski in #470
- Test workspace-dir for bsp by @lwronski in #473
- Hide commend for integration tests by @lwronski in #453
- Print tasty exception from Pretty stacktraces only if verbosity is higher than 1 by @lwronski in #506
- Update stable branch only after release by @lwronski in #455
- Use scala-cli for local compilation by @romanowski in #537
- Align coursier launcher used in mill with the one used in scala-cli by @tpasternak in #544
- Use JVM launcher in benchmark by @tpasternak in #551
- Clean-up by @alexarchambault in #572
- Test examples on CI by @romanowski in #576
- Don't write stacktraces to files on CIs by @alexarchambault in #496
- Generate slim docker image with mostly static binary by @alexarchambault in #487
- Use latest version of scala-snippet-checker by @lwronski in #565
- Replace .scala remining .scala directories by @romanowski in #582
- Use 'ng-stop' instead of 'exit' to quit bloop by @tpasternak in #518
- Remove former directives handle methods by @alexarchambault in #498
- Hide some commands when called as 'scala' by @alexarchambault in #580
Updates
- Back port of documentation changes to master by @github-actions in #462
- Update test-runner, tools to 0.4.2 by @scala-steward in #457
- Update trees to 4.4.31 by @scala-steward in #472
- Update upickle to 1.4.3 by @scala-steward in #480
- Update scalajs-linker, ... to 1.8.0 by @scala-steward in #479
- Update scalajs-sbt-test-adapter to 1.8.0 by @scala-steward in #478
- Update scalafmt to 3.2.1 by @alexarchambault in #476
- Update case-app to 2.1.0-M11 by @scala-steward in #477
- Update scalafmt-cli to 3.0.8 by @scala-steward in #482
- Update case-app to 2.1.0-M12 by @scala-steward in #491
- Bump actions/upload-artifact from 2.2.4 to 2.3.0 by @dependabot in #490
- Update scala-packager, scala-packager-cli to 0.1.25 by @scala-steward in #494
- Update ipcsocket to 1.4.1-aa-4 by @scala-steward in #497
- Update mill-main to 0.9.11 by @scala-steward in #510
- Bump coursier to 2.1.0-M2 by @ckipp01 in #511
- Bump actions/upload-artifact from 2.3.0 to 2.3.1 by @dependabot in #512
- Bump actions/setup-node from 2.5.0 to 2.5.1 by @dependabot in #524
- Update Scala to 2.13.8 and 3.1.1 by @alexarchambault in #570
- Migrate build to Mill 0.10 compatible API and libs by @lolgab in #581
- Update scala-cli/bloop-core to 1.4.19 by @alexarchambault in #566
- Update GraalVM to 22.0.0 by @alexarchambault in #584
Full Changelog: v0.0.9...v0.1.0