Releases: VirtusLab/scala-cli
v1.0.1
What's new
This release only contains bug fixes and minor internal improvements.
Fixes
- Fix - add test to output from name of script example by @lwronski in #2153
- Fix publishing with implicit
publish.versioncoming from agittag by @Gedochao in #2154 - Fix conflicts when watch and interactive try to read StdIn by @MaciejG604 in #2168
- Bsp wrapper fixes by @MaciejG604 in #2171
- Add the .exe suffix to output provided by user for graalvm-native-image by @lwronski in #2182
Build and internal changes
- refactor: Remove JavaInterface, which causes compilation issues with Bloop by @tgodzik in #2174
- Enforce to use jvm 17 on linux aarch64 by @lwronski in #2180
Updates and maintenance
- Update scala-cli.sh launcher for 1.0.0 by @github-actions in #2149
- Back port of documentation changes to main by @github-actions in #2155
- Update jsoniter-scala-core, ... to 2.23.1 by @scala-steward in #2160
- Update guava to 32.0.0-jre by @scala-steward in #2161
- Update coursier-jvm_2.13, ... to 2.1.4 by @scala-steward in #2162
- Update sbt to 1.8.3 by @scala-steward in #2164
- Bump
millscripts by @Gedochao in #2167 - Bump VirtusLab/scala-cli-setup from 0.2.1 to 1.0.0 by @dependabot in #2169
- Bump
scala-cli-signingto0.2.2by @Gedochao in #2173 - Update scalafmt-cli_2.13, scalafmt-core to 3.7.4 by @scala-steward in #2175
- Update trees_2.13 to 4.7.8 by @scala-steward in #2176
Full Changelog: v1.0.0...v1.0.1
v1.0.0
The official scala runner release
Scala CLI has reached the highly anticipated 1.0.0 milestone!
Having addressed all the SIP-46 requirements,
this version is going to become the official scala runner, replacing the old scala command.
For a deeper understanding of Scala CLI as the new scala runner and to explore its benefits and features,
we encourage you to check out our blogpost.
Also be sure to get familiar with all the differences introduced by this change in our migration guide.
What's Changed
New default Scala version - 3.3.0
Scala 3.3.0 is now the default version for Scala CLI projects.
It's the first LTS (Long Term Support) release of Scala 3 to be used by Scala CLI.
Right on time for 1.0.0!
Toolkit-test
By incorporating the Scala Toolkit into your project, you gain the advantage of two additional
dependencies seamlessly integrated into your classpath:
org.scala-lang:toolkit:<version>is added to the main scope, allowing its utilization throughout your project.org.scala-lang:toolkit-test:<version>is included in the test scope, making it available exclusively for testing purposes.
Scala CLI now supports the following features for the toolkit:
- including e.g.
//> using toolkit latestin any main scope file will automatically add thetoolkitdependency to the main scope and thetoolkit-testdependency to the test scope - if you place e.g.
//> using toolkit latestwithin a test scope file, bothtoolkitandtoolkit-testwill be limited to the test scope only - inserting e.g.
//> using test.toolkit latestanywhere in the project will add bothtoolkitandtoolkit-testto the test scope only
This convention is encouraged for other toolkit-like libraries as well.
Added by @Gedochao #2127 and #2137
Forcing an object wrapper for scripts
Scala CLI now supports the //> using objectWrapper directive, along with the corresponding --object-wrapper option,
which allows to force wrapping script code in an object body instead of a class.
Using object wrappers should be avoided for scripts relying on multi-threading (as it may cause deadlocks), but may prove to be the only option in some cases.
Added by @MaciejG604 #2136
Other changes
- Add alias for snapshots repository in Maven by @lwronski #2125
- Bump typelevel-toolkit to 0.0.11, configure toolkit-test by @armanbilge #2135
- Fix updating toolkit dependencies by @Gedochao #2138
- Improve directive parsing errors & special-case
toolkitdirective version parsing by @Gedochao #2133 - Fix determining position for value in directive without quotes by @lwronski #2141
Fixes
- Fix line conversion logic by simplifying topWrapperLen to line count of top wrapper by @MaciejG604 #2101
- Fix test watch infinite loop by @MaciejG604 #2113
- Fix flaky completions for
zshby @Jasper-M #2118 - Fix - install certificates for java by @lwronski #2123
- Fix the
--source-jaroption & add correspondingusingdirectives by @Gedochao #2120
Documentation changes
- Add docs for bootstrapped standalone fat JAR by @lwronski #2122
- Add developer docs on modifying
reflect-config.jsonby @Gedochao #2114
Build and internal changes
- Update release procedure - update also v1 tag by @lwronski #2107
- NIT Refactor test scope directives by @Gedochao #2083
- Add main class to jar manifest in assembly by @romanowski #2124
Updates and maintenance
- Update scala-cli.sh launcher for 1.0.0-RC2 by @github-actions #2105
- Update org.eclipse.jgit to 6.5.0.202303070854-r by @scala-steward #2090
New Contributors
Full Changelog: v1.0.0-RC2...v1.0.0
v1.0.0-RC2
What's Changed
Exclude
To exclude specific source files or entire directories from a Scala CLI project, you can now use the //> using exclude directive in your project.scala file.
Alternatively, you can do the same from the command line with the --exclude option.
- absolute path:
/root/path/to/your/project/Main.scala - relative path:
src/main/scala/Main.scala - glob pattern:
*.sc
For example, to exclude all files in the example/scala directory, add the following directive to your project.scala file:
//> using exclude "example/scala"Directives with a Test Scope equivalent
Some directives now have a test scope equivalent, such as using dep and its test scope counterpart using test.dep. This allows you to declare dependencies that are only used in tests outside of test-specific sources.
For example, you can declare a dependency on munit in your project.scala file like this:
//> using test.dep "org.scalameta::munit::0.7.29"The dependency will only be available in test sources.
Here's a list of directives with a test scope equivalent with example values:
//> using test.dep "org.scalameta::munit::0.7.29"
//> using test.jar "path/to/jar"
//> using test.javaOpt "-Dfoo=bar"
//> using test.javacOpt "source", "1.8", "target", "1.8"
//> using test.javaProp "foo1=bar1"
//> using test.option "-Xfatal-warnings"
//> using test.resourceDir "testResources"
//> using test.toolkit "latest"Changes to using-directives syntax
We've made several updates to simplify the using directives syntax in this release:
- allowed omitting commas in lists of values.
- disallowed multiline comments.
- removed multiline strings.
- removed
requireand@requiresyntax support. - allowed values without quotes.
- removed
@using.
For example, the following using directives are now valid without the need for commas and quotes:
//> using scala 3.2.2
//> using javacOpt -source 1.8 -target 1.8Bootstrapped standalone fat JAR.
The Scala CLI launcher is available as a standalone fat JAR. You can download the stable version of the Scala CLI fat JAR from Maven and try it now:
cs launch org.virtuslab.scala-cli:cliBootstrapped:1.0.0-RC2 -M scala.cli.ScalaCliAdded by @romanowski in #2005.
Access the path of the script being run from its code
With the special scriptPath function, you can now easily access the path of the script being run from the script code itself.
Here's an example of how to use the scriptPath value:
#!/usr/bin/env -S scala-cli shebang
println(scriptPath)$ chmod +x scripts/hello.sc
$ ./scripts/hello.sc
# ./scripts/hello.scExplicit Handling of Paths in using-directives
The ${.} pattern in directive values can now be replaced by the parent directory of the file containing the directive. This makes it possible to generate coverage output files relative to the source file location, for example:
//> using options "-coverage-out:${.}"Fix deadlocks in Script Wrappers
We have resolved an issue that caused deadlocks when threads were run from the static initializer of the wrapper object
(#532 and #1933).
Based on the feedback from the community (Thanks @dacr), we found that encapsulating the script code
into a class wrapper fixes the issue. The wrapper is generated by the Scala CLI and is not visible to the user.
This change alters the behavior of scripts that use the @main annotation. The @main annotation is no longer supported in .sc files.
@main def main(args: String*): Unit = println("Hello")$ scala-cli script.sc
# [warn] Annotation @main in .sc scripts is not supported, use .scala format instead
# Compiling project (Scala 3.2.2, JVM)
# [error] ./script.sc:1:1
# [error] method main cannot be a main method since it cannot be accessed statically
# [error] @main def main(args: String*): Unit = println("Hello")
# [error] ^^^^^
# Error compiling project (Scala 3.2.2, JVM)
# Compilation failedFixed by @MaciejG604 in #2033
Other changes
- Add first-class support for Typelevel and other toolkits by @armanbilge in #2025
- Make shebang run not check dependency updates by @MaciejG604 in #2022
- Make 'export --json' print to stdout by default by @MaciejG604 in #2008
- Don't print the spread directives warning if there's only a single file per scope by @Gedochao in #1988
- Add --as-jar option by @alexarchambault in #2028
- add newline to topWrapper by @bishabosha in #1998
Publishing changes
- React to secret key decryption error by @MaciejG604 in #1993
- Use ASCII armored secret key by @MaciejG604 in #1991
- Properly handle pgp keychains generated by Scala CLI by @MaciejG604 in #1987
Fixes
- Fix
ExcludeTestsby @Gedochao in #2082 - bugfix: Properly show unsupported binary version by @tgodzik in #2081
- Allow BSP to start successfully even with unrecognised
usingdirectives by @Gedochao in #2072 - Fix invalid
scala-cli-signingartifact downloads by @Gedochao in #2054 - Fix - package js without main method by @lwronski in #2038
- Fix completions by @Gedochao in #2004
- Fix export failing on input duplicates @Gedochao in #2098
- Clean up parsing repositories for publishing @romanowski in #2084
Documentation changes
- Docs: Update build output folder in Internal docs by @amaalali in #2071
- Add docs for test scope directives by @Gedochao in #2058
- Improve error messages for malformed
configvalues by @Gedochao in #2014 - Update export documentation by @MaciejG604 in #2023
- Add weaver test framework instruction by @lenguyenthanh in #2021
Build and internal changes
- Download cs for aarch64 from coursier-m1 repo by @lwronski in #2085
- Pass
invokeDataall the way to pre-processing to give more meaningful error/warning messages by @Gedochao in #2073 - Refactor
usingdirectives processing by @Gedochao in #2066 - Remove the
examplesdirectory to fixscala-stewardruns by @Gedochao in #2067 - Remove some dead code in build by @alexarchambault in #2069
- NIT Remove dead
BuildDepsby @Gedochao in #2065 - Clean up build by @romanowski in #2017
- Developers reflect 5 active developers in the repo. by @romanowski in #2006
- Increase maximum memory allocation for JVM by @lwronski in #2012
- Use bloop-rifle module from scala-cli/bloop-core repo by @alexarchambault in #1989
- Add missing modules for which unit tests are now executed by @lwronski in #1992
- Remove dead code for ordering Preproc...
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-cliThe 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 trueExperimental 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.scalaAdded 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 thinOr 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-signingby @MaciejG604 in #1982
Fixes
- Print an informative error if the project workspace path contains
File.pathSeparatorby @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 configon 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-4by @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 configAlso, 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 WorldHello 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
mdfenced blocks in--helpby @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
experimentalfeatures 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
# ./HelloAdded 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
-runoption of the legacyscalarunner, instead of failing by @Gedochao in #1801 - Add warnings for the deprecated
-Yscriptrunnerlegacyscalarunner option instead of passing it toscalacby @Gedochao in #1804 - Filter out
restricted&experimentaloptions fromSIPmode 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
exportsub-command iftestFrameworkisn'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-signingtoorg.virtuslaband bump to0.1.15by @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 latestThere'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.2Similarly, 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
# HelloJava 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=barDocker 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
versionhelp message by @lwronski in #1737 - Include launcher options in the help for the default and
helpsub-commands by @Gedochao in #1725 - Remove suffix
.auxfrom 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.dirfor virtual sources by @lwronski in #1771 - Add support for deprecated Scala
2.13.x-specificscalarunner options by @Gedochao in #1774 - Add support for the
-with-compilerrunner 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
ScalaSipTestsare run on Windows by @Gedochao in #1695 - Add warnings for
-save&-nosavelegacyscalarunner 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
.scalafiles 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.04by @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
jsoniterupdates 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.001sFiltering 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.001sAccept 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-markdownThis 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-markdownIt 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.mdSupport 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 _.mdSupport 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-nameAdded 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
usingdirectives 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 binarymore robust by @lwronski in #1621
Documentation updates
- Add some explanations on implicit sub-commands in
-helpby @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
sclicheckby @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
Inputsby @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 pythonAdded 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
nativeEmbedResourcesusing 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
.mdsources 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
jvmRunEnvironmentandjvmTestEnvironmentfor 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
--serveroption 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
