Releases: VirtusLab/scala-cli
v1.0.0-RC1
Official scala
runner release candidate
v1.0.0-RC1
is the first release candidate version of Scala CLI.
Either this or a future release candidate is meant to become the new official scala
runner to accompany
the Scala compiler (scalac
) and other scripts, replacing the old scala
command.
To learn more about Scala CLI as the new scala
runner, check out our recent blogpost:
https://virtuslab.com/blog/scala-cli-the-new-scala-runner/
Scala CLI should now have better performance
With a number of newly added performance tweaks, you can expect Scala CLI to run considerably faster.
Added by @lwronski in #1939
Print appropriate warnings when experimental features are used
Using experimental features will now cause Scala CLI to print an appropriate warning.
scala-cli --power -e '//> using publish.name "my-library"'
# The '//> publish.name "my-library"' directive is an experimental feature.
# 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
The warning can be suppressed with the --suppress-experimental-warning
option, or alternatively with the
suppress-warning.experimental-features
global config key.
scala-cli config suppress-warning.experimental-features true
Experimental and restricted configuration keys will now require to be accessed in --power
mode
Some configuration keys available with the config
sub-command have been tagged as experimental or restricted and will only be available in --power
mode.
scala-cli config httpProxy.address
# The 'httpProxy.address' configuration key is restricted.
# You can run it with the '--power' flag or turn power mode on globally by running:
# scala-cli config power true.
Dropped deprecated using
directive syntax
The following syntax for using
directives have been dropped:
- skipping
//>
- multiline directives
- directives in
/*> ... */
comments - directives in plain
//
comments @using
Added support for packaging native images from Docker
It is now possible to package a GraalVM native image with Scala CLI from docker.
docker run -v $(pwd)/Hello.scala:/Hello.scala virtuslab/scala-cli package --native-image /Hello.scala
Added support for Scala Native's LTO
It is now possible to set the Link Time Optimization (LTO) when using Scala CLI with Scala Native.
The available options are "thin", "full" and "none".
You can do it with the --native-lto
option from the command line:
scala-cli -e 'println("Hello")' --native --native-lto thin
Or with a using
directive:
//> using platform "scala-native"
//> using nativeLto "thin"
@main def main(): Unit = println("Hello")
Other changes
Publishing changes
- Make credential entries respect the --password-value option by @MaciejG604 in #1949
- Write PGP keys to publish-conf when doing publish setup by @MaciejG604 in #1940
- Support ssh in GitHub repo org&name extraction by @KuceraMartin in #1938
- Comply with optional password in
scala-cli-signing
by @MaciejG604 in #1982
Fixes
- Print an informative error if the project workspace path contains
File.pathSeparator
by @Gedochao in #1985 - Enable to pass custom docker-cmd to execute application in docker by @lwronski in #1980
- Fix - uses show cli.nativeImage command to generate native image by @lwronski in #1975
- Vcs.parse fix by @KuceraMartin in #1963
- move args definition to the top of the script by @bishabosha in #1983
Documentation changes
- Back port of documentation changes to main by @github-actions in #1935
- Remove ChainedSnippets by @MaciejG604 in #1928
- Further document publish command by @MaciejG604 in #1914
- Add a verbosity guide by @Gedochao in #1936
- Docs - how to run unit tests in Scala CLI by @lwronski in #1977
Build and internal changes
- Use locally build jvm launcher of scala-cli in gifs generator by @lwronski in #1921
- Clean up after ammonite imports removal by @MaciejG604 in #1934
- Temporarily disable
PublishTests.secret keys in config
on Windows by @Gedochao in #1948 - Move toolkit to scalalang org by @szymon-rd
Updates and maintenance
- Update scala-cli.sh launcher for 0.2.1 by @github-actions in #1931
- Bump VirtusLab/scala-cli-setup from 0.2.0 to 0.2.1 by @dependabot in #1947
- Bump coursier/publish version to 0.1.4 by @MaciejG604 in #1950
- Bump to the latest weaver & remove expecty by @lenguyenthanh in #1955
- Bump webfactory/ssh-agent from 0.7.0 to 0.8.0 by @dependabot in #1967
- chore(dep): bump mill from 0.10.10 to 0.10.12 by @ckipp01 in #1970
- Bump Bleep to
1.5.6-sc-4
by @Gedochao in #1973
New Contributors
- @KuceraMartin made their first contribution in #1938
- @lenguyenthanh made their first contribution in #1955
Full Changelog: v0.2.1...v1.0.0-RC1
v0.2.1
Add a guide for migrating from the old scala
runner to Scala CLI
As of SIP-46, Scala CLI has been accepted as the new scala
command. To make the transition smooth we added a guide highlighting the differences between the two runners.
Improve the publish
and publish setup
sub-commands' user experience
We're currently focusing on improving the experimental publish
feature of Scala CLI and making publish setup
+ publish
more stable and user-friendly.
Using pgp keys created by config --create-pgp-key
subcommand is now supported as a default option, no additional user input is needed.
Addressed by @alexarchambault in #1432 and by @MaciejG604 in #1898
Remove unsupported kebab-case style in using directives
All using directives names are now using camelCase, kebab-case is no longer available.
Add a reference for available config keys in help & docs
You can now view the available config keys using config --help
:
scala-cli config -h
# Usage: scala-cli config [options]
# Configure global settings for Scala CLI.
#
# Available keys:
# actions Globally enables actionable diagnostics. Enabled by default.
# interactive Globally enables interactive mode (the '--interactive' flag).
# power Globally enables power mode (the '--power' launcher flag).
# suppress-warning.directives-in-multiple-files Globally suppresses warnings about directives declared in multiple source files.
# suppress-warning.outdated-dependencies-files Globally suppresses warnings about outdated dependencies.
#
# You are currently viewing the basic help for the config sub-command. You can view the full help by running:
# scala-cli config --help-full
# For detailed documentation refer to our website: https://scala-cli.virtuslab.org/docs/commands/misc/config
#
# Config options:
# --unset, --remove Remove an entry from config
Also, config --full-help
will show the list of all keys.
Pass user arguments to JS runner
It's now possible to pass user arguments to a JS application:
import scala.scalajs.js
import scala.scalajs.js.Dynamic.global
val process = global.require("process")
val argv = Option(process.argv)
.filterNot(js.isUndefined)
.map(_.asInstanceOf[js.Array[String]].drop(2).toSeq)
.getOrElse(Nil)
val console = global.console
console.log(argv.mkString(" "))
scala-cli ScalaJsArgs.sc --js -- Hello World
Hello World
Added by @alexarchambault in #1826
Other changes
- Tweak error messages for running scripts without file extensions by @Gedochao in #1886
- Exit with Bloop command return code if it's non-zero by @alexarchambault in #1837
- bloop-rifle: increase timeout values by @Flowdalic in #1865
- Suggest users to clean working directory when Nailgun server failed by @lwronski in #1916
- fix: encode videos in yuv420p to support Firefox by @danielleontiev in #1904
- Fix reading passwords from commands by @alexarchambault in #1775
- Add extra class path to generated bootstrap launcher by @lwronski in #1897
SIP-related changes
- Add 'dependency' and 'dependencies' alias for using directive by @MaciejG604 in #1903
Documentation updates
- Ensure no console-syntax in reference docs and no
md
fenced blocks in--help
by @Gedochao in #1874 - Document export subcommand by @MaciejG604 in #1875
- Tweak guides' and cookbooks' pages by @Gedochao in #1894
- Fix pgp creation option name by @MaciejG604 in #1909
- Fix using directive docs by @lwronski in #1901
- Add docs to classifiers and exclude dependency by @lwronski in #1892
Internal changes
- Fix handling for
experimental
features by @Gedochao in #1915 - Change default home directory for tests integration and docs-test modules to avoid overriding global user config by @lwronski in #1917
- NIT Use enums for help groups and help command groups by @Gedochao in #1880
Updates & maintenance
- Bump dns-packet from 5.3.1 to 5.4.0 in /website by @dependabot in #1906
- Bump VirtusLab/scala-cli-setup from 0.1.20 to 0.2.0 by @dependabot in #1890
- Dump docusaurus to 2.3.1 and other docs deps by @lwronski in #1907
- Update scala-cli.sh launcher for 0.2.0 by @github-actions in #1881
- Back port of documentation changes to main by @github-actions in #1911
New Contributors
- @danielleontiev made their first contribution in #1904
v0.2.0
Require the --power
option for restricted features by default
Until now, Scala CLI has been limiting some of its functionalities in its scala
distribution.
Starting with v0.2.0
, those limitation will be applied to all distributions, including scala-cli
.
This was done in order to make the behaviour consistent with Scala CLI acting as the Scala runner.
Restricted features can be accessed by using the --power
launcher flag. Do note that launcher flags have to be passed before the sub-command.
scala-cli --power package .
Alternatively, the power
mode can be turned on globally by running:
scala-cli config power true
Please note that this change may affect your existing scripts or workflows that rely on the limited commands from ScalaCLI (such as package
, publish
). You can still use those commands with power
mode enabled.
When you try to use a limited command in restricted mode, you will now see a warning message with suggestions on how to enable this command:
$ scala-cli package Hello.scala
# This command is restricted and requires setting the `--power` option to be used.
# You can pass it explicitly or set it globally by running:
# scala-cli config power true
$ scala-cli config power true
$ scala-cli package Hello.scala
# Wrote Hello, run it with
# ./Hello
Added by @lwronski in #1835 and #1849
Allow executable Scala scripts without a file extension
As of this release Scala scripts without the *.sc
file extension will be supported for execution when using the shebang
command.
#!/usr/bin/env -S scala-cli shebang -S 3
println(args.size)
println(args.headOption)
chmod +x hello
./hello Hello World
#2
#Some(Hello)
Note that files with no extension are always run as scripts even though they may contain e.g. a valid .scala
program.
Also, do note that this feature has only been added for shebang
- the run
sub-command (which is the default way of running inputs when a sub-command is not specified explicitly) will not support this.
Added by @MaciejG604 in #1802
Export Project configuration to Json
It is now possible to export configuration from Scala CLI project to Json format with the export
sub-command.
scala-cli --power export --json .
It is currently exporting basic information about the project and includes, for example, the following fields:
- ScalaVersion
- Platform
- Sources
- Dependencies
- Resolvers
Example of generated Json output:
{
"scalaVersion": "3.2.2",
"platform": "JVM",
"scopes": {
"main": {
"sources": [
"Hello.scala"
],
"dependencies": [
{
"groupId": "com.lihaoyi",
"artifactId": {
"name": "pprint",
"fullName": "pprint_3"
},
"version": "0.6.6"
}
],
...
}
}
}
Added by @MaciejG604 in #1840
Rename using lib
to using dep
To be more consistent with dependency command line options --dep
, the dependency using directive is now passed by using dep
.
Please note that we have kept the alias of the old directive (lib
, libs
) for backwards compatibility.
//> using dep "org.scalameta::munit:0.7.29"
Improved readability of help messages for commands
The help messages are now shorter and more concise, making it easier to quickly get an overview of the available options for a command.
To improve readability, some options and detailed messages are now only visible after showing the full help by passing --full-help
.
Other breaking changes
Remove ammonite imports support
The support for $ivy
and $dep
ammonite imports has been removed.
To easily convert existing $ivy
and $dep
imports into the using dep
directive in your sources, you can use the provided actionable diagnostic.
Removed by @MaciejG604 in #1787
Drop the metabrowse
sub-command
With this release, support for Metabrowse has been removed from Scala CLI. This change was made in order to limit the number of features that we need to support, especially since the Metabrowse
project is no longer being actively worked on.
Other changes
- Add cross-platform toolkit dependency by @bishabosha in #1810
- Show explain message when is enabled by @lwronski in #1830
- Read home directory from env variable instead of option from command line by @lwronski in #1842
- Add build/taskStart and taskFinish to the exception reporting BSP mechanism by @MaciejG604 in #1821
- blooprifle: report exit code in exception by @Flowdalic in #1844
- Suppress lib update warning by @MaciejG604 in #1848
- Invalid subcommand arg by @MaciejG604 in #1811
SIP-related changes
- Add a warning for the
-run
option of the legacyscala
runner, instead of failing by @Gedochao in #1801 - Add warnings for the deprecated
-Yscriptrunner
legacyscala
runner option instead of passing it toscalac
by @Gedochao in #1804 - Filter out
restricted
&experimental
options fromSIP
mode help by @Gedochao in #1812 - Warn in sip mode when using restricted command by @lwronski in #1862
- Add more detail for sub-commands' help messages by @Gedochao in #1852
- Fix printing not supported option in restricted mode by @lwronski in #1861
Fixes
- Fix warning about using directives in multiple files when two java files are present by @MaciejG604 in #1796
- Quit flag not suppresses compilation errors by @lwronski in #1792
- Dont warn about target directives by @MaciejG604 in #1803
- Fix - actionable actions not suggest update to previous version by @lwronski in #1813
- Fix actionable action when uses latest sytanx version in lib by @lwronski in #1817
- Prevent NPE from being thrown by the
export
sub-command iftestFramework
isn't defined by @Gedochao in #1814 - Fix message checking in test by @MaciejG604 in #1847
- blooprifle: add -XX:+IgnoreUnrecognizedVMOptions to hardCodedDefaultJavaOpts by @Flowdalic in #1845
- Trim passwords obtained as command result by @MaciejG604 in #1871
Build and internal changes
- Ignore Bloop server early exit if it signals an already running server by @alexarchambault in #1799
- Build aarch64 linux launcher using m1 by @lwronski in #1805
- Remove latest supported scala version mechanism by @lwronski in #1816
- Switch
scala-cli-signing
toorg.virtuslab
and bump to0.1.15
by @Gedochao in #1853 - Add clang to scala-cli docker image by @lwronski in #1846
- bloop-file: show timeout value in error message by @Flowdalic in [#1855](https://github.com/VirtusLab/scala-cli/pu...
v0.1.20
Add support for Scala Toolkit
Scala CLI now has support for Scala Toolkit.
Scala Toolkit is an ongoing effort by Scala Center and VirtusLab to compose a set of approachable libraries to solve everyday problems.
It is currently in its pre-release phase and includes the following libraries:
- MUnit for testing;
- Sttp for HTTP client;
- UPickle/UJson for reading, writing and operating on JSONs;
- OS-Lib for operating on files and the operating system.
You can add it to your build from the command line with the --with-toolkit
option.
scala-cli . --with-toolkit latest
There's also an appropriate using
directive.
//> using toolkit "0.1.4"
Scala CLI is built with Scala 3.2.2
We now rely on Scala 3.2.2
as the default internal Scala version used to build the project.
Added by @lwronski and @Gedochao in #1772
Removal of the about
and doctor
sub-commands
The about
command has been removed, its features merged back to the version
command.
As a result, the version
command will now check if your locally installed Scala CLI is up-to-date.
It is possible to skip the check with the --offline
option, or when printing raw CLI or default Scala
versions with --cli-version
and --scala-version
, respectively.
scala-cli version --offline
# Scala CLI version: 0.1.20
# Scala version (default): 3.2.2
Similarly, the doctor
sub-command has been removed, with its past and previously planned functionalities to be delivered
in a more interactive manner in the future.
The Scala CLI aarch64/arm64
binary is now available via sdkman
You can now get the platform-appropriate Scala CLI binary on aarch64/arm64
architecture via sdkman
.
aarch64/arm64
artifact with the launcher script
The scala-cli.sh
launcher script now correctly downloads the aarch64/arm64
artifact on the appropriate architecture.
Run a .jar
file as a regular input
JARs can now be run just like any other input, without the need of passing the -cp
option.
scala-cli Hello.jar
# Hello
Java properties without the need for --java-prop
The --java-prop
option can be skipped when passing Java properties to Scala CLI now.
scala-cli Hello.scala -Dfoo=bar
Docker packaging with using
directives
It is now possible to configure packaging into a docker image via using
directives.
//> using packaging.dockerFrom "openjdk:11"
//> using packaging.dockerImageTag "1.0.0"
//> using packaging.dockerImageRegistry "virtuslab"
//> using packaging.dockerImageRepository "scala-cli"
Pass GraalVM args via a using
directive
It is now possible to pass args to GraalVM via the following using
directive:
//> using packaging.graalvmArgs "--no-fallback", "--enable-url-protocols=http,https"
Other changes
SIP-related changes
- Remove irrelevant options from
version
help message by @lwronski in #1737 - Include launcher options in the help for the default and
help
sub-commands by @Gedochao in #1725 - Remove suffix
.aux
from progName when installed by cs by @lwronski in #1736 - Don't fail in case of connection errors in the version sub-command by @Gedochao in #1760
- Set workspace dir to
os.tmp.dir
for virtual sources by @lwronski in #1771 - Add support for deprecated Scala
2.13.x
-specificscala
runner options by @Gedochao in #1774 - Add support for the
-with-compiler
runner option by @Gedochao in #1780
Fixes
- Take into account interactively picked options when caching binaries by @alexarchambault in #1701
- Erase things in working dir in publish by @alexarchambault in #1715
- Improve formatting of generated Mill project by @lolgab in #1677
- Restart Bloop server if it exited by @alexarchambault in #1716
- Add CLI option for suppressing the warning about directives in multiple files by @MaciejG604 in #1754
- Add a global configuration for suppressing the warning about directives in multiple files by @MaciejG604 in #1779
- Set page size for aarch64 Linux binaries to 64k by @mkurz in #1726
Build and internal changes
- Tweaking by @alexarchambault in #1711
- Address some native-image warnings by @alexarchambault in #1719
- Do not generate Linux aarch64 binaries from PRs by @alexarchambault in #1720
- Derive using directives handlers from case classes by @alexarchambault in #1637
- Don't run commands upon HelpTests instantiation by @alexarchambault in #1762
Documentation updates
- Add test-only cookbook by @lwronski in #1718
- Fixing minor typos and some wordsmithing. by @medale in #1731
- Back port of documentation changes to main by @github-actions in #1735
- Explain the differences in using shebang vs scala-cli directly in script by @lwronski in #1740
- Add instruction for Intellij JVM version by @MaciejG604 in #1773
- Fix a broken link by @xerial and @lwronski in #1777
Updates & maintenance
- Update svm to 22.3.0 by @scala-steward in #1689
- Update scala-cli.sh launcher for 0.1.19 by @github-actions in #1707
- Bump VirtusLab/scala-cli-setup from 0.1.18 to 0.1.19 by @dependabot in #1709
- Update Bloop to 1.5.6-sc-1 by @lwronski in #1704
- Update trees_2.13 to 4.7.1 by @scala-steward in #1717
- Update coursier-jvm_2.13, ... to 2.1.0-RC4 by @scala-steward in #1723
- Bump uraimo/run-on-arch-action from 2.3.0 to 2.5.0 by @dependabot in #1734
- Update jsoniter-scala-core_2.13, ... to 2.20.0 by @scala-steward in #1732
- Update jsoniter-scala-core_2.13, ... to 2.20.1 by @scala-steward in #1741
- Update scalafmt-cli_2.13, scalafmt-core to 3.6.1 by @scala-steward in #1742
- Update core_2.13 to 3.8.6 by @scala-steward in #1746
- Update libdaemon to 0.0.11 by @scala-steward in #1759
- Update jsoniter-scala-core_2.13, ... to 2.20.2 by @scala-steward in #1757
- Update core_2.13 to 3.8.7 by @scala-steward in #1758
- Update bloop core to 1.5.6-sc-2 by @lwronski in #1761
- Update core_2.13 to 3.8.8 by @scala-steward in #1770
- Update ammonite to 2.5.6 by @scala-steward in #1769
- Update jsoniter-scala-core_2.13, ... to 2.20.3 by @scala-steward in #1776
- Update amm to 2.5.6-1-f8bff243 by @lwronski in #1778
New Contributors
- @mkurz made their first contribution in #1726
- @medale made their first contribution in #1731
- @MaciejG604 made their first contribution in #1773
- @xerial made their first contribution in #1777
Full Changelog: v0.1.19...v0.1.20
v0.1.19
What's Changed
The Linux aarch64
native launcher is here! (experimental)
We are happy to announce that there is a new dedicated launcher for the Linux Aarch64. You can find it here.
Fix workspace/reload
for Intellij IDEA
Dependencies (and other configurations) from using
directives should now always be picked up after a BSP project reload.
Screen.Recording.2022-12-13.at.13.34.17.mov
shebang
headers in Markdown
The shebang
headers in scala
code blocks inside a markdown input are always ignored.
# Scala with `shebang`
A sample code block with the `shebang` header.
```scala
#!/usr/bin/env -S scala-cli shebang
println("Hello world")
```
Export Scala compiler plugins to Mill projects
It is now possible to export scalac
compiler plugins from a Scala CLI project to Mill with the export
sub-command.
Added by @ carlosedp in #1626
Other changes
SIP Changes
- Fix the order of help command groups for the default help by @Gedochao in #1697
- Adjust SIP help output & ensure
ScalaSipTests
are run on Windows by @Gedochao in #1695 - Add warnings for
-save
&-nosave
legacyscala
runner options instead of failing by @Gedochao in #1679
Fixes
- Suggest to update only to stable version by @lwronski in #1634
- Fix - Skip checking file order by @lwronski in #1696
- fix if else in mill.bat by @MFujarewicz in #1661
- Add repositories from build options when validating scala versions by @lwronski in #1630
- Fix using directives not working with the shebang line in
.scala
files by @Gedochao in #1639 - Don't clear compilation output dir by @clutroth in #1660
Documentation updates
- Decompose the README & add a contributing guide by @Gedochao in #1650
- Improve IDE support docs by @Gedochao in #1684
Build and internal changes
- Use snapshot repo to download stubs by @lwronski in #1693
- Temporarily rollback CI to
ubuntu-20.04
by @Gedochao in #1640 - Fix - merge extra repos with resolve.repositories by @lwronski in #1643
- Use Mill directory convention in mill project by @lolgab in #1676
Updates & maintenance
- Update coursier-jvm_2.13, ... to 2.1.0-RC3 by @scala-steward in #1688
- Update coursier-jvm_2.13, ... to 2.1.0-RC3-1 by @scala-steward in #1702
- Update slf4j-nop to 2.0.6 by @scala-steward in #1691
- Ignore
jsoniter
updates for JDK 8 by @lwronski in #1694 - Update trees_2.13 to 4.7.0 by @scala-steward in #1690
- Update jsoniter-scala-core_2.13 to 2.19.1 by @scala-steward in #1674
- Update jsoniter-scala-core_2.13 to 2.19.0 by @scala-steward in #1672
- Update os-lib to 0.9.0 by @scala-steward in #1653
- Update scala-collection-compat to 2.9.0 by @scala-steward in #1657
- Update core_2.13 to 3.8.5 by @scala-steward in #1655
- Update pprint to 0.8.1 by @scala-steward in #1654
- Update mill-main to 0.10.10 by @scala-steward in #1652
- Update org.eclipse.jgit to 6.4.0.202211300538-r by @scala-steward in #1656
- Update jsoniter-scala-core_2.13 to 2.18.1 by @scala-steward in #1651
- Update slf4j-nop to 2.0.5 by @scala-steward in #1658
- Bump VirtusLab/scala-cli-setup from 0.1.17 to 0.1.18 by @dependabot in #1644
- Update scala-cli.sh launcher for 0.1.18 by @github-actions in #1624
- Update using_directives to 0.0.10 by @scala-steward in #1692
- Bumped up com.lihaoyi::os-lib version to 0.9.0 by @pingu1m in #1649
New Contributors
- @pingu1m made their first contribution in #1649
- @clutroth made their first contribution in #1660
- @MFujarewicz made their first contribution in #1661
Full Changelog: v0.1.18...v0.1.19
v0.1.18
Filter tests with --test-only
It is now possible to filter test suites with the --test-only
option.
//> using lib "org.scalameta::munit::1.0.0-M7"
package tests.only
class Tests extends munit.FunSuite {
test("bar") {
assert(2 + 2 == 5)
}
test("foo") {
assert(2 + 3 == 5)
}
test("foo-again") {
assert(2 + 3 == 5)
}
}
package tests
class HelloTests extends munit.FunSuite {
test("hello") {
assert(2 + 2 == 4)
}
}
scala-cli test BarTests.scala HelloTests.scala --test-only 'tests.only*'
# tests.only.Tests:
# ==> X tests.only.Tests.bar 0.037s munit.FailException: ~/project/BarTests.scala:5 assertion failed
# 4: test("bar") {
# 5: assert(2 + 2 == 5)
# 6: }
# at munit.FunSuite.assert(FunSuite.scala:11)
# at tests.only.Tests.$init$$$anonfun$1(BarTests.scala:5)
# at tests.only.Tests.$init$$$anonfun$adapted$1(BarTests.scala:6)
# + foo 0.004s
# + foo-again 0.001s
Filtering particular tests by name requires passing args to the test framework.
For example, with munit
:
scala-cli test BarTests.scala HelloTests.scala --test-only 'tests.only*' -- '*foo*'
# tests.only.Tests:
# + foo 0.032s
# + foo-again 0.001s
Accept authenticated proxy params via Scala CLI config
If you can only download artifacts through an authenticated proxy, it is now possible to configure it
with the config
subcommand.
scala-cli config httpProxy.address https://proxy.company.com
scala-cli config httpProxy.user _encoded_user_
scala-cli config httpProxy.password _encoded_password_
Replace _encoded_user_
and _encoded_password_
by your actual user and password, following
the password option format. They should typically look like env:ENV_VAR_NAME
, file:/path/to/file
, or command:command to run
.
Added by @alexarchambault in #1593
Support for running Markdown sources from zipped archives and gists
It is now possible to run .md
sources inside a .zip
archive.
Same as with directories, .md
sources inside zipped archives are ignored by default, unless
the --enable-markdown
option is passed.
scala-cli archive-with-markdown.zip --enable-markdown
This also enables running Markdown sources fom GitHub gists, as those are downloaded by Scala CLI as zipped archives.
scala-cli https://gist.github.com/Gedochao/6415211eeb8ca4d8d6db123f83f0f839 --enable-markdown
It is also possible to point Scala CLI to a .md
file with a direct URL.
scala-cli https://gist.githubusercontent.com/Gedochao/6415211eeb8ca4d8d6db123f83f0f839/raw/4c5ce7593e19f1390555221e0d076f4b02f4b4fd/example.md
Support for running piped Markdown sources
Instead of passing paths to your Markdown sources, you can also pipe your code via standard input:
echo '# Example Snippet
```scala
println("Hello")
```' | scala-cli _.md
Support for running Markdown snippets
It is now possible to pass Markdown code as a snippet directly from the command line.
scala-cli run --markdown-snippet '# Markdown snippet
with a code block
```scala
println("Hello")
```'
Customize exported Mill project name
It is now possible to pass the desired name of your Mill project to the export
sub-command
with the --project
option.
scala-cli export . --mill -o mill-proj --project project-name
Added by @carlosedp in #1563
Export Scala compiler options to Mill projects
It is now possible to export scalac
options from a Scala CLI project to Mill with the export
sub-command.
Other changes
Fixes
- Fix overriding settings from tests by @alexarchambault in #1566
- Print compilation failed in watch mode too in test command by @alexarchambault in #1548
- Fix error message when running JVM launcher from Java 8 by @alexarchambault in #1575
- Fix
using
directives for Markdown inputs by @Gedochao in #1598 - Fix - clean up only homebrew-scala-experimental directory by @lwronski in #1615
- Warn users when pushing to Sonatype with missing credentials or params by @alexarchambault in #1545
- Warning for multiple files with using directives by @wleczny in #1591
- Make package --python work by @alexarchambault in #1531
- Better revolver output by @alexarchambault in #1614
- Make
PackageTestsDefault.reuse run native binary
more robust by @lwronski in #1621
Documentation updates
- Add some explanations on implicit sub-commands in
-help
by @Gedochao in #1587 - Runner specification by @romanowski in #1445
- Install documentation update by @wleczny in #1595
- Document recent features & changes affecting working with Markdown inputs by @Gedochao in #1606
- Improve docs coverage with
sclicheck
by @Gedochao in #1612 - Reduce ignore tags in the docs snippets by @Gedochao in #1617
Build and internal changes
- Remove superfluous annotation by @alexarchambault in #1567
- Decompose & refactor
Inputs
by @Gedochao in #1565 - Disable create PGP key test on Windows CI by @alexarchambault in #1588
- Switch to Scala 3-based case-app by @alexarchambault in #1568
- Remove cli-options module by @alexarchambault in #1552
- Enable to force using jvm signing launcher for native launcher of scala-cli by @lwronski in #1597
- Run warm up test before running default tests by @lwronski in #1599
- Make DefaultTests more robust by @alexarchambault in #1613
Updates & maintenance
- Update scala-cli.sh launcher for 0.1.17 by @github-actions in #1564
- Update zip-input-stream to 0.1.1 by @scala-steward in #1573
- Update coursier-jvm_2.13, ... to 2.1.0-RC1 by @scala-steward in #1572
- Update mill-main to 0.10.9 by @scala-steward in #1571
- Update test-runner, tools to 0.4.8 by @scala-steward in #1574
- Update case-app_2.13 to 2.1.0-M21 by @scala-steward in #1570
- Bump VirtusLab/scala-cli-setup from 0.1.16 to 0.1.17 by @dependabot in #1579
- Bump Ammonite to 2.5.5-17-df243e14 & Scala to 3.2.1 by @Gedochao in #1586
- Update scala-cli-signing to 0.1.13 by @alexarchambault in #1569
- Update coursier-jvm_2.13, ... to 2.1.0-RC2 by @scala-steward in #1590
- Update scalajs-sbt-test-adapter_2.13 to 1.11.0 by @scala-steward in #1477
- Update slf4j-nop to 2.0.4 by @scala-steward in #1596
- Update jsoniter-scala-core_2.13 to 2.18.0 by @scala-steward in #1608
- Update test-runner, tools to 0.4.9 by @scala-steward in #1610
- Update Bloop to 1.5.4-sc-4 by @alexarchambault in #1622
- Update scalajs-sbt-test-adapter_2.13 to 1.12.0 by @scala-steward in #1609
New Contributors
- @carlosedp made their first contribution in #1563
Full Changelog: v0.1.17...v0.1.18
v0.1.17
Enhancements
Set the default name for the project's workspace root file as project.scala
.
There were multiple discussions about what the name should and it seems the winning vote was on project.scala
instead of project.settings.scala
.
To see how exactly is the root directory resolved, see this document.
SDKMAN and Homebrew support installation of Scala CLI for M1
To install Scala CLI via SDKMAN, run the following command from the command line:
sdk install scalacli
and to install Scala CLI via homebrew:
brew install Virtuslab/scala-cli/scala-cli
Added by @wleczny in #1505 and #1497
Specifying the --jvm
option via using directives
The --jvm
option can now be added via using directives, like
//> using jvm "adopt:11"
Accept more scalac
options without escaping
Scala CLI now accepts options such as -rewrite
, -new-syntax
, -old-syntax
, -source:<target>
, -indent
and -no-indent
, without requiring them to be escaped by -O
.
Enable python
support via using directives
The --python
option can now be enabled via a using directive, like
//> using python
Added by @alexarchambault in #1492
Other changes
Work in Progress
Publish
- Various config command tweaks / fixes by @alexarchambault in #1460
- Accept email via --email when creating a PGP key in config command by @alexarchambault in #1482
- Make publish --python work by @alexarchambault in #1494
- Add repositories.credentials config key by @alexarchambault in #1466
- Check for missing org and version at the same time in publish by @alexarchambault in #1534
- Rename some publish config keys by @alexarchambault in #1532
- Add publish.credentials config key, use it to publish by @alexarchambault in #1533
Spark
- Accept spark-submit arguments on the command-line by @alexarchambault in #1455
Markdown
Fixes
- Fix generating pkg package for M1 by @lwronski in #1461
- Return exit code 1 when build fails for test by @lwronski in #1518
- Fix the
nativeEmbedResources
using directive by @Gedochao in #1525 - Fix completions when install by cs - strip suffix .aux by @lwronski in #1561
Build and internal changes
- Automate deploy of scala-experimental brew formula by @wleczny in #1530
- Decompose RunTestDefinitions by @Gedochao in #1529
- Add some simple tests for running
.md
sources by @Gedochao in #1527 - Run doc tests from munit test suites by @alexarchambault in #1435
- Minor refacto around build options stuff by @alexarchambault in #1488
- No need to use os.ProcessOutput.ReadLines in test by @alexarchambault in #1491
- Enforce logging options for all scala commands by @Gedochao in #1499
- Tweak documentation verification tests by @Gedochao in #1504
- Support
jvmRunEnvironment
andjvmTestEnvironment
for BSP by @Gedochao in #1519 - Downgrade Scala version in 'scala-cli repl --amm' if needed by @alexarchambault in #1493
- Clean up references to scala-cli in SIP mode by @lwronski in #1547
- Move commands under distinct namespaces by @lwronski in #1558
Documentation / help updates
- Tweak / fix publish messages by @alexarchambault in #1535
- Merge documentation of installing scala-cli on MacOs and MacOs/M1 by @wleczny in #1507
- Improve the basics doc by @Gedochao in #1513
- Fix a typo in the
--server
option reference doc by @Gedochao in #1521 - Improve the docs on using Scala compiler options by @Gedochao in #1503
- Add help for repl, scalafmt and scaladoc by @wleczny in #1487
- remove paragraph about bug for coursier install by @bishabosha in #1485
- Tell about pressing Enter in watch message by @alexarchambault in #1465
- Update the recommened installation options for SiP Scala by @tgodzik in #1547
- Add default values to help messages by @wleczny in #1555
Updates / maintainance
- Update jsoniter-scala-core_2.13 to 2.17.9 by @scala-steward in #1544
- Bump docusaurus to 2.20 and other docs deps by @lwronski in #1540
- Update jsoniter-scala-core_2.13 to 2.17.8 by @scala-steward in #1537
- Update cli-options_2.13, cli_2.13, ... to 0.1.11 by @scala-steward in #1538
- Update case-app_2.13 to 2.1.0-M19 by @scala-steward in #1536
- Bump coursier/setup-action from 1.2.1 to 1.3.0 by @dependabot in #1496
- Update scala-cli.sh launcher for 0.1.16 by @github-actions in #1458
- Bump VirtusLab/scala-cli-setup from 0.1.15 to 0.1.16 by @dependabot in #1462
- Update expecty to 0.16.0 by @scala-steward in #1467
- Update jsoniter-scala-core_2.13 to 2.17.5 by @scala-steward in #1470
- Update mill-main to 0.10.8 by @scala-steward in #1472
- Update pprint to 0.8.0 by @scala-steward in #1473
- Update core_2.13 to 3.8.3 by @scala-steward in #1474
- Update publish_2.13 to 0.1.3 by @scala-steward in #1475
- Update trees_2.13 to 4.6.0 by @scala-steward in #1478
- Update slf4j-nop to 2.0.3 by @scala-steward in #1479
- Update asm to 9.4 by @scala-steward in #1476
- Update using_directives to 0.0.9 by @scala-steward in #1480
- Update fansi to 0.4.0 by @scala-steward in #1471
- Update case-app_2.13 to 2.1.0-M18 by @scala-steward in #1468
- Bump webfactory/ssh-agent from 0.5.4 to 0.7.0 by @dependabot in #1495
- Update jsoniter-scala-core_2.13 to 2.17.6 by @scala-steward in #1498
- Update coursier to 2.1.0-M7-39-gb8f3d7532 by @alexarchambault in #1520
New Contributors
- @bishabosha made their first contribution in #1485
Full Changelog: v0.1.16...v0.1.17
v0.1.16
This release consists mainly of updates, fixes, and various enhancements of existing features.
Enhancements
Specifying javac options via using directives
javac options can now be added via using directives, like
//> using javacOpt "source", "1.8", "target", "1.8"
Pressing enter in watch mode proceeds to run / compile / test / … again
In watch mode (using the -w
or --watch
option), pressing Enter when Scala CLI is watching for changes makes it run again what it's supposed to be doing (compiling, running, running tests, or packaging, etc.) This is inspired by Mill's behaviour in watch mode, which supports the same feature.
Added by @alexarchambault in #1451
Installation via Scoop on Windows
Scala CLI can now be installed via Scoop on Windows, with a command such as
scoop install scala-cli
Added by @nightscape in #1416, thanks to him!
Actionable diagnostics in Metals
Scala CLI should now send text edit suggestions with some of its diagnostics, via BSP, so that editors
can suggest those edits to users. This should work in upcoming versions of Metals in particular.
Other
- Add
--scalapy-version
option by @alexarchambault in #1397
Fixes
Fixes in Scala Native binaries caching
When running a sequence of commands such as
$ scala-cli run --native .
$ scala-cli package --native . -o my-app
Scala CLI should cache a Scala Native binary during the first command, so that the second command can just re-use it, rather than generating a binary again. This also fixes the re-use of compilation artifacts between both commands, so that the Scala CLI project isn't re-compiled during the second command either.
Fixed by @alexarchambault in #1406
Accept more scalac options without escaping
Scala CLI now accepts options such as -release
, -encoding
, -color
, -feature
, -deprecation
and -nowarn
, without requiring them to be escaped by -O
. It also accepts --scalac-verbose
, which is equivalent to -O -verbose
(increases scalac verbosity). Lastly, it warns when -release
and / or -target:<target>
are inconsistent with --jvm
.
Fix --java-option
and --javac-option
handling in package
sub-command
--java-option
and --javac-option
should now be accepted and handled properly in the package
sub-command.
Fix wrong file name when publising Scala.js artifacts locally
The publish local
sub-command used to publish Scala.js artifacts with a malformed suffix. This is now fixed.
Fix spurious stack traces in the publish
and publish local
sub-commands
The publish
and publish local
commands could print spurious stack traces when run with non-default locales, using native Scala CLI binaries. This is now fixed.
Fixed by @romanowski in #1423
Make run --python --native
work from Python virtualenv
Using both --native
and --python
in the run
sub-command should work fine from Python virtualenv.
Fixed by @kiendang in #1399, thanks to him!
Documentation / help updates
- Dump scala 2 version in docs by @lwronski in #1408
- Ensure the the
repl
& default sub-commands respect group help options by @Gedochao in #1417 - Remove stray
_
typo by @armanbilge in #1385 - Add docs on how to install scala-cli for M1 by @lwronski in #1431
- Debugging cookbook by @wleczny in #1441
Updates / maintainance
- Update scala-cli.sh launcher for 0.1.15 by @github-actions in #1401
- Revert scalafmt fix by @lwronski in #1402
- Bump respective Scala versions to
2.12.17
&2.13.9
and Ammonite to2.5.4-33-0af04a5b
by @Gedochao in #1405 - Turn off running tests in PR for M1 runner by @lwronski in #1403
- Bump VirtusLab/scala-cli-setup from 0.1.14.1 to 0.1.15 by @dependabot in #1414
- Bump coursier/setup-action from f883d08305acbc28e5e5363bf5ec086397627021 to 1.2.1 by @dependabot in #1415
- Tweak the release procedure by @Gedochao in #1426
- Update case-app_2.13 to 2.1.0-M17 & scala-cli-signing to v0.1.10 by @lwronski in #1427
- Automate choco package deploy by @wleczny in #1412
- Generate pkg package for m1 by @lwronski in #1410
- Re-enable gif tests by @alexarchambault in #1436
- Bump Scala 2.13.x to 2.13.10 & Ammonite to 2.5.5 by @Gedochao in #1437
- Remove mill-scala-cli stuff from build by @alexarchambault in #1433
- Add support for BSP's
buildTarget/outputPaths
and update bsp4j to 2… by @lwronski in #1439 - Update bsp4j to 2.1.0-M3 by @lwronski in #1444
- Update scala-packager to 0.1.29 and hardcode upgradeCodeGuid by @lwronski in #1446
- Refactor
ScalaCommand
to enforce respecting help options by @Gedochao in #1440 - Address compilation warnings by @alexarchambault in #1452
- Update coursier to 2.1.0-M7 by @alexarchambault in #1447
- Update bloop to 1.5.4-sc-3 by @alexarchambault in #1454
New Contributors
- @nightscape made their first contribution in #1416
- @kiendang made their first contribution in #1399
Full Changelog: v0.1.15...v0.1.16
v0.1.15
The M1 native launcher is here! (experimental)
We are happy to announce that there is a new dedicated launcher for M1 users. You can find it here.
Please note that the package
sub-command is unstable for this launcher.
--python
option for repl
sub-command (experimental)
Passing the --python
option allows using ScalaPy
with the repl
sub-command:
▶ scala-cli --python
Welcome to Scala 3.2.0 (17.0.2, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala> import me.shadaj.scalapy.py
scala> py.Dynamic.global.range(1, 4)
val res0: me.shadaj.scalapy.py.Dynamic = range(1, 4)
Added in #1336 by @alexarchambault
-d
, -classpath
and compile
sub-command's --output
options changes
To be backward compatible with the scala
command, some changes have been made to the following options:
- The
compile
sub-command's--output
option has been renamed to--compilation-output
. This option is now also available from therun
andpackage
sub-commands.
▶ scala-cli compile Hello.scala --compilation-output out
▶ scala-cli --main-class Hello -classpath out
Hello
- The
-d
option is no longer an alias for--dependency
, but for--compilation-output
.-O -d -O path/to/compilation/output
now defaults to-d path/to/compilation/output
.
▶ scala-cli compile Hello.scala -d out
▶ scala-cli --main-class Hello -classpath out
Hello
- The old
--classpath
option has been renamed to--print-classpath
.--classpath
,--class-path
and-classpath
options are now aliases for the--extra jars
option.-O -classpath -O path/to/classpath
now defaults to--extra-jars path/to/classpath
.
▶ scala-cli compile --print-classpath Hello.scala
# ~/Projects/debug-test/.scala-build/project_103be31561_103be31561-7a1ed8dde0/classes/main:~/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.2.0/scala3-library_3-3.2.0.jar:~/Library/Caches/ScalaCli/local-repo/v0.1.15/org.virtuslab.scala-cli/runner_3/0.1.15/jars/runner_3.jar:~/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.8/scala-library-2.13.8.jar
Make inputs optional when -classpath
and --main-class
are passed
The following changes have been made to improve backward compatibility with the scala
command:
- Passing the
--main-class
option along with-classpath
to the default command now defaults torun
instead ofrepl
:
▶ scala-cli --main-class Hello -classpath out
Hello
- If the
run
sub-command is passed explicitly, it's sufficient to have a main class on the classpath (inputs aren't necessary then):
▶ scala-cli compile Hello.scala -d out
▶ scala-cli run -classpath out
Hello
Debugging with the run
and test
sub-commands
It is now possible to debug code ran by run
and test
sub-commands:
▶ scala-cli Main.scala --debug
Listening for transport dt_socket at address: 5005
Hello
This addresses #1212
--platform
option
This option can be used to choose the platform, which should be used to compile and run the application.
▶ scala-cli Main.scala --platform js
Hello
Note that --platform js
is an alias for --js
and --platform native
is an alias for --native
.
This addresses #1214
Other changes
Fixes
- Ensure directories are created recursively when the
package
sub-command is called by @Gedochao in #1371 - Fix calculation of Scala version and turn off the
-release
flag for 2.12.x < 2.12.5 by @Gedochao in #1377 - Fix finding main classes in external jars by @Gedochao in #1380
- Fix Js split style SmallModulesFor in pure JVM by @lwronski in #1394
Build and internal changes
- Remove mill-scalafix customization by @alexarchambault in #1360
- Split config db stuff to a separate config module by @alexarchambault in #1367
- Detect sip when installed by coursier by @lwronski in #1368
- Create empty class to enforce resolving ivy deps by mill for dummy modules by @lwronski in #1374
- Use millw launcher instead of running mill by cs by @lwronski in #1375
- Add --debug option for integration tests by @wleczny in #1378
- NIT ScalaVersionUtil refactor by @Gedochao in #1384
- Make config module compatible with Java 8 by @alexarchambault in #1387
- Add HTTP proxy-related keys in config module by @alexarchambault in #1388
- Add repositories-related keys in config module by @alexarchambault in #1395
Updates
- Update scala-cli.sh launcher for 0.1.14 by @github-actions in #1362
- Update jsoniter-scala-core_2.13 to 2.17.3 by @scala-steward in #1364
- Update core_2.13 to 3.8.0 by @scala-steward in #1365
- Bump VirtusLab/scala-cli-setup from 0.1.13 to 0.1.14.1 by @dependabot in #1376
Full Changelog: v0.1.14...v0.1.15
v0.1.14
Hotfix printing stacktraces from Scala CLI runner for Scala 3.x < 3.2.0
We fixed a nasty bug breaking any Scala CLI run using any Scala 3 version earlier than 3.2.0 on printing stacktraces.
Only Scala CLI 0.1.13 was affected.
$ scala-cli about
Scala CLI version: 0.1.13
Scala version (default): 3.2.0
$ scala-cli -S 3.1.3 -e 'throw Exception("Broken")'
Compiling project (Scala 3.1.3, JVM)
Compiled project (Scala 3.1.3, JVM)
Exception in thread "main" java.lang.NoSuchMethodError: 'long scala.runtime.LazyVals$.getOffsetStatic(java.lang.reflect.Field)'
at scala.cli.runner.StackTracePrinter.<clinit>(StackTracePrinter.scala:101)
at scala.cli.runner.StackTracePrinter$.coloredStackTraces(StackTracePrinter.scala:104)
at scala.cli.runner.StackTracePrinter$.$lessinit$greater$default$4(StackTracePrinter.scala:11)
at scala.cli.runner.Runner$.main(Runner.scala:18)
at scala.cli.runner.Runner.main(Runner.scala)
Added in #1358 by @romanowski
Build and internal changes
- Disable mill-scala-cli for now by @alexarchambault in #1335
- Update scala-cli.sh launcher for 0.1.13 by @github-actions in #1351
- Remove backslash which skip execution of
mv
command by @lwronski in #1353 - Fix import ordering by @alexarchambault in #1359
Updates
- Update scalafix stuff… by @alexarchambault in #1333
- Bump VirtusLab/scala-cli-setup from 0.1.12 to 0.1.13 by @dependabot in #1354
Full Changelog: v0.1.13...v0.1.14