Releases: VirtusLab/scala-cli
v0.1.12
Add --spark
, --spark-standalone
and --hadoop
options for the run
sub-command (experimental)
The run
sub-command can now run Spark jobs when the --spark
option is passed.
$ scala-cli run --spark SparkJob.scala
Similarly, it's possible to run Hadoop jobs by passing the --hadoop
option.
scala-cli run --hadoop HadoopJob.java
It's also possible to run Spark jobs without a Spark distribution by passing the --spark-standalone
option.
$ scala-cli run --spark-standalone SparkJob.scala
Added in #1129 by alexarchambault
Add the default Scala version to the output of the version
sub-command
The version
sub-command now includes both the Scala CLI version and the default Scala version.
$ scala-cli --version
Scala CLI version 0.1.12
Default Scala version: 3.1.3
$ scala-cli -version
Scala CLI version 0.1.12
Default Scala version: 3.1.3
$ scala-cli version
Scala CLI version 0.1.12
Default Scala version: 3.1.3
You can also pass the --cli-version
option to only get the Scala CLI version or the --scala-version
option
to only get the default Scala version.
$ scala-cli version --cli-version
0.1.12
$ scala-cli version --scala-version
3.1.3
This is potentially a breaking change if your automation relies on the output of the version
sub-command.
Enable passing the scalafmt
configuration with --scalafmt-conf
and --scalafmt-conf-str
It is now possible to pass a custom location of the scalafmt
configuration with the --scalafmt-conf
option for the
fmt
sub-command.
$ scala-cli fmt --scalafmt-conf path/to/the/conf/.scalafmt.conf
You can also pass the configuration straight from the terminal with --scalafmt-conf-str
.
$ scala-cli fmt --scalafmt-conf-str "version=3.5.5
runner.dialect=scala213"
Enable turning the --interactive
mode on permanently
It is now possible to set the --interactive
mode on by default, so that passing it explicitly isn't necessary.
The next time when you run a command with the --interactive
option set to on, Scala CLI will suggest to turn it on
permanently.
This is recommended for environments where scala-cli
is used by a human user only (and not by any automation).
$ scala-cli . --interactive
You have run the current scala-cli command with the --interactive mode turned on.
Would you like to leave it on permanently?
[0] Yes
[1] No
0
--interactive is now set permanently. All future scala-cli commands will run with the flag set to true.
If you want to turn this setting off at any point, just run `scala-cli config interactive false`.
Found several main classes. Which would you like to run?
[0] ScalaMainClass2
[1] ScalaMainClass1
[2] scripts.ScalaScript_sc
You can also configure it manually with the config
sub-command, by setting the interactive
property to true
.
$ scala-cli config interactive true
Other changes
Work in progress
SIP-46-related
- Restrict directives based on the command used by romanowski in #1259
Documentation
- NIT Improve some website docs by BlackAnubis7 in #1243
Build and internal changes
- Add 0.1.11 release notes to release_notes.md by BlackAnubis7 in #1228
- Temporary disable test gif by lwronski in #1261
- aarch64 fixes by alexarchambault in #1180
Updates
- Update mill launcher by alexarchambault in #1269
- Update scala-cli.sh launcher for 0.1.11 by github-actions in #1230
- Update jsoniter-scala-core_2.13 to 2.13.39 by scala-steward in #1239
- Update trees_2.13 to 4.5.12 by scala-steward in #1242
- Update jsoniter-scala-core_2.13 to 2.14.2 by scala-steward in #1241
- Update org name to VirtusLab for downloading scalafmt-native-image by lwronski in #1253
- Update core_2.13 to 3.7.4 by scala-steward in #1247
- Update case-app_2.13 to 2.1.0-M15 by scala-steward in #1245
- Update jsoniter-scala-core_2.13 to 2.15.0 by scala-steward in #1246
- Update cli-options_2.13, cli_2.13, ... to 0.1.8 by scala-steward in #1248
- Update metaconfig-typesafe-config to 0.11.1 by scala-steward in #1254
- Update ammonite to 2.5.4-14-dc4c47bc by scala-steward in #1255
- Update coursier-jvm_2.13, ... to 2.1.0-M6-53-gb4f448130 by scala-steward in #1256
- Update scala-packager-cli_2.13, ... to 0.1.27 by scala-steward in #1258
- Update bloop-config_2.13 to 1.5.3-sc-1 by scala-steward in #1257
- Update ammonite to 2.5.4-15-f4a8969b by scala-steward in #1264
- Update trees_2.13 to 4.5.13 by scala-steward in #1265
- Update slf4j-nop to 2.0.0 by scala-steward in #1273
- Update cli-options_2.13, cli_2.13, ... to 0.1.9 by scala-steward in #1272
- Bump VirtusLab/scala-cli-setup from 0.1.5 to 0.1.11 by dependabot in #1274
New Contributors
- BlackAnubis7 made their first contribution in #1228
Full Changelog: v0.1.11...v0.1.12
v0.1.11
Make .scalafmt.conf
optional when running the fmt
command
Scala CLI can now run the fmt
command without a .scalafmt.conf
file present. Previously, if such a file was absent, a Scalafmt requires explicitly specified version.
error was raised while using the fmt
command.
The Scala CLI fmt
command now supports passing the scalafmt
version and dialect directly from the command line, using the --scalafmt-dialect
and --scalafmt-version
options respectively:
scala-cli fmt --scalafmt-dialect scala3 --scalafmt-version 3.5.8
Either of those (or both) can be skipped, which will make Scala CLI infer a default value.
The configuration used can be saved in the workspace by passing the --save-scalafmt-conf
option.
Define output
option for package
command with using directives
It is now possible to pass the output
option of the package
command with using directives instead of passing it directly from bash.
Add support for running multiple snippets of the same kind
Scala CLI now allows to pass multiple snippets of the same kind.
It was previously possible to mix different kinds (so to pass a Java snippet alongside a Scala one), but not for example 2 separate Scala snippets. That limitation no longer applies.
When passed this way, each snippet is then treated as a separate input by Scala CLI.
$ scala-cli --scala-snippet '@main def main() = println(Messages.hello)' --scala-snippet 'object Messages { def hello = "Hello" }'
Hello
Add bloop sub-command
Scala CLI now has a (hidden for now) bloop sub-command, that runs a command using the Scala CLI Bloop server (while the mainline Bloop bloop CLI uses its default Bloop server). This is handy when debugging things on Scala CLI for example, allowing one to manually run scala-cli bloop projects or scala-cli bloop compile.
Added in #1199 by alexarchambault
Make main class optional in preamble-less assemblies
It is now allowed to generate an assembly, even for code that has no main class, when --preamble=false
is passed. This can be useful for libraries, if users want to pass the assembly to tools such as proguard. This also accepts a (hidden) --main-class-in-manifest=false
option if users want not only no preamble, but also no mention of main class in the assembly manifest (META-INF/MANIFEST.MF
in the assembly JAR). The latter option is useful for tools, such as the hadoop jar command, that behave differently depending on the presence or not of a main class in the manifest.
Added in #1200 by alexarchambault
Important fixes & enhancements
Prevent erroneous using directives from blocking the initial run of BSP
Up till now, running the setup-ide
sub-command on sources containing using directives
with syntax errors or pointing to dependencies which could not be fetched would create a BSP
setup which could not be imported correctly by IDEs. This is no longer the case and such a BSP
connection should now import correctly, so that it's possible to fix the faulty code within the comfort of one's IDE of choice.
This fixes #1097
Work in progress
Allow to globally turn actionable diagnostics on or off
It is now possible to globally enable or disable actionable diagnostics using the config
sub-command.
The relevant configuration is under the actions
key.
$ scala-cli config actions true
Publishing-related features
- Add "publish setup" command by alexarchambault in #926
Other changes
Documentation
- Put the release notes doc on the website by Gedochao in #1196
- Fix typo in Spark docs by alexarchambault in #1183
- Tweak issue templates & the release procedure by Gedochao in #1188
- Add install and uninstall completions documentation by wleczny in #1201
Build and internal changes
- ignore *.semanticdb files by mtk in #1187
- Update scala-cli.sh launcher for 0.1.10 by github-actions in #1185
- Force push updating scala-cli in scala-cli-setup by lwronski in #1189
- Fix running scala check in scala native by lwronski in #1190
- Use manifest JARs in "run" command if needed by alexarchambault in #1198
- Use more lightweight Spark distribs in spark tests by alexarchambault in #1207
- Update GraalVM to 22.2.0 by alexarchambault in #1208
- Split integration tests by alexarchambault in #1202
- Debug macOS CI issue on CI by alexarchambault in #1215
- Update docusaurus to 2.0.0-rc.1 by lwronski in #1224
Updates
- Update core_2.13 to 3.7.0 by scala-steward in #1186
- Update core_2.13 to 3.7.1 by scala-steward in #1194
- Update jsoniter-scala-core_2.13 to 2.13.37 by scala-steward in #1197
- Update jsoniter-scala-core_2.13 to 2.13.38 by scala-steward in #1217
- Update ammonite to 2.5.4-13-1ebd00a6 by scala-steward in #1218
- Update core_2.13 to 3.7.2 by scala-steward in #1219
- Update scala-collection-compat to 2.8.1 by scala-steward in #1221
- Update trees_2.13 to 4.5.11 by scala-steward in #1222
- Update coursier-jvm_2.13, ... to 2.1.0-M6-49-gff26f8e39 by scala-steward in #1223
Full Changelog: v0.1.10...v0.1.11
v0.1.10
Initial support for importing other sources via using
directives
It is now possible to add sources to a Scala CLI project from a source file, with using file
directives:
//> using file "Other.scala"
//> using file "extra/"
Note that several sources can be specified in a single directive
//> using file "Other.scala" "extra/"
Add dependency update
sub-command
Scala CLI can now update dependencies in user projects, using the dependency-update
sub-command, like
scala-cli dependency-update --all .
When updates are available, this sub-command asks whether to update each of those, right where these dependencies are defined.
Running snippets passed as arguments
Scala CLI can now run Scala or Java code passed on the command-line, via -e
/ --script-snippet
/ --scala-snippet
/ --java-snippet
:
$ scala-cli -e 'println("Hello")'
Hello
$ scala-cli --script-snippet 'println("Hello")'
Hello
$ scala-cli --scala-snippet '@main def run() = println("Hello")'
Hello
$ scala-cli --java-snippet 'public class Main { public static void main(String[] args) { System.out.println("Hello"); } }'
Hello
These options are meant to be substitutes to the -e
option of the scala
script that ships in scalac archives.
Uninstall instructions and uninstall
sub-command
Uninstalling Scala CLI is now documented in the main installation page, right after the installation instructions. In particular, when installed via the installation script, Scala CLI can be uninstalled via a newly added uninstall
sub-command.
Added in #1122 and #1152 by @wleczny.
Important fixes & enhancements
ES modules
Scala CLI now supports the ES Scala.js module kind, that can be enabled via a //> using jsModuleKind "esmodule"
directive, allowing to import other ES modules in particular.
Added in #1142 by @hugo-vrijswijk.
Putting Java options in assemblies, launchers, and docker images, in package
sub-command
Passing --java-opt
and --java-prop
options to the package
sub-command is now allowed. The passed options are
hard-coded in the generated assemblies or launchers, and in docker images.
--command
and --scratch-dir
options in run
sub-command
The run
sub-command can now print the command it would have run, rather than running it. This can be useful for debugging purposes, or if users want to manually tweak commands right before they are run. Pass --command
to run to enable it. This prints one argument per line, for easier automated processing:
$ scala-cli run --command -e 'println("Hello")' --runner=false
~/Library/Caches/Coursier/arc/https/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.2%252B8/OpenJDK17U-jdk_x64_mac_hotspot_17.0.2_8.tar.gz/jdk-17.0.2+8/Contents/Home/bin/java
-cp
~/Library/Caches/ScalaCli/virtual-projects/ee/project-3c6fdea1/.scala-build/project_ed4bea6d06_ed4bea6d06/classes/main:~/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.1.3/scala3-library_3-3.1.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
snippet_sc
When run
relies on temporary files (when Scala.js is used for example), one can pass a temporary directory via --scratch-dir
, so that temporary files are kept even when scala-cli
doesn't run anymore:
$ scala-cli run --command -e 'println("Hello")' --js --runner=false --scratch-dir ./tmp
node
./tmp/main1690571004533525773.js
Added in #1163 by by @alexarchambault.
Don't put Scala CLI internal modules in packages
Scala CLI doesn't put anymore its stubs module and its "runner" module in generated packages, in the package
sub-command.
Fixed in #1161 by @alexarchambault.
Don't write preambles in generated assemblies in the package
sub-command
Passing --preamble=false
to scala-cli package --assembly
makes it generate assemblies without a shell preamble. As a consequence, these assemblies cannot be made executable, but these look more like "standard" JARs, which is required in some contexts.
Fixed in #1161 by @alexarchambault.
Don't put some dependencies in generated assemblies in the package
sub-command
Some dependencies, alongside all their transitive dependencies, can be excluded from the generated assemblies. Pass --provided org:name
to scala-cli package --assembly
to remove a dependency, like
$ scala-cli package SparkJob.scala --assembly --provided org.apache.spark::spark-sql
Note that unlike "provided" dependencies in sbt, and compile-time dependencies in Mill, all transitive dependencies are excluded from the assembly. In the Spark example above, for example, as spark-sql
depends on scala-library
(the Scala standard library), the latter gets excluded from the assembly too (which works fine in the context of Spark jobs).
Fixed in #1161 by @alexarchambault.
In progress
Experimental Spark capabilities
The package
sub-command now accepts a --spark
option, to generate assemblies for Spark jobs, ready to be passed to spark-submit
. This option is hidden (not printed in scala-cli package --help
, only in --help-full
), and should be considered experimental.
See this document for more details about these experimental Spark features.
Added in #1086 by @alexarchambault.
Other changes
Documentation
- Add cookbooks for working with Scala CLI in IDEA IntelliJ by @Gedochao in #1149
- Fix VL branding by @lwronski in #1151
- Back port of documentation changes to main by @github-actions in #1154
- Update using directive syntax in scenarios by @lwronski in #1159
- Back port of documentation changes to main by @github-actions in #1165
- Add docs depedency-update by @lwronski in #1178
- Add docs how to install scala-cli via choco by @lwronski in #1179
Build and internal changes
- Update scala-cli.sh launcher for 0.1.9 by @github-actions in #1144
- Update release procedure by @wleczny in #1156
- chore(ci): add in mill-github-dependency-graph by @ckipp01 in #1164
- chore(ci): bump version of mill-github-dependency-graph by @ckipp01 in #1171
- Use Scala CLI 0.1.9 in build by @alexarchambault in #1173
- Stop compiling most stuff with Scala 2 by @alexarchambault in #1113
- Turn the sip mode also for
scala-cli-sip
binary by @romanowski in #1168 - chore(ci): use mill-dependency-submission action by @ckipp01 in #1174
- Fix snippet tests for Windows by @Gedochao in #1172
Updates
- Update mill-main to 0.10.5 by @scala-steward in #1148
- Update snailgun-core, snailgun-core_2.13 to 0.4.1-sc2 by @scala-steward in #1155
- Update jsoniter-scala-core_2.13 to 2.13.35 by @scala-steward in #1169
- Update scala-collection-compat to 2.8.0 by @scala-steward in #1170
- Update jsoniter-scala-core_2.13 to 2.13.36 by @scala-steward in #1175
New Contributors
- @hugo-vrijswijk made their first contribution in #1142
Full Changelog: v0.1.9...v0.1.10
v0.1.9
--list-main-classes
for publish
& package
publish
and package
sub-commands now support the --list-main-classes
option, which allows to list all the available main classes. Previously it was only available in the run
command.
Important fixes & enhancements
fmt
options improvement
Added missing documentation on how to pass native scalafmt
options in the fmt
sub-command with the -F
option.
$ scala-cli fmt -F --version
scalafmt 3.5.2
Additionally, a couple of scalafmt
's native options received aliases in Scala CLI:
--respect-project-filters
is an alias for -F --respect-project-filters
. Because of the way sources are passed by Scala CLI to scalafmt
under the hood, we now turn it on by default to respect any project.excludePaths
settings in the user's .scalafmt.conf
.
It can be disabled by passing --respect-project-filters=false
to revert to previous behaviour.
This addresses #1121
--scalafmt-help
is an alias for -F --help
. It shows the --help
output from scalafmt
, which might prove as helpful reference when in need of using native scalafmt
options with -F
.
Include libsodium.dll
on Windows
Static linking of libsodium in Windows launcher has been fixed.
This addresses #1114
Added in #1115 by @alexarchambault
Force interactive mode for update
command
Interactive mode for update
sub-command is now enabled by default.
In progress
Publishing-related features
- Publish tweaks + documentation by @alexarchambault in #1107
Better BSP support for Scala scripts
- Add scala-sc language to BSP supported languages by @alexarchambault in #1140
Other changes
Documentation PRs
- Update scala 2.12 to 2.12.16 in docs by @lwronski in #1108
- Back port of documentation changes to main by @github-actions in #1111
- Tweak release procedure by @Gedochao in #1112
Build and internal changes
- Add choco configuration files by @lwronski in #998
- Tweaking by @alexarchambault in #1105
- Add scala-cli-setup deploy key to ssh-agent by @lwronski in #1117
Updates
- Update scala-cli.sh launcher for 0.1.8 by @github-actions in #1106
- Update case-app to 2.1.0-M14 by @alexarchambault in #1120
- Update Scala to 3.1.3 by @alexarchambault in #1124
- Update jsoniter-scala-core_2.13 to 2.13.32 by @scala-steward in #1125
- Update coursier-jvm_2.13, ... to 2.1.0-M6-28-gbad85693f by @scala-steward in #1126
- Update libsodiumjni to 0.0.3 by @scala-steward in #1127
- Update org.eclipse.jgit to 6.2.0.202206071550-r by @scala-steward in #1128
- Update Scala.js to 1.10.1 by @scala-steward in #1130
- Update Scala Native to 0.4.5 by @alexarchambault in #1133
- Update scala-js-cli to 1.1.1-sc5 by @alexarchambault in #1134
- Update jsoniter-scala-core_2.13 to 2.13.33 by @scala-steward in #1136
- Update
scalafmt
to 3.5.8 by @Gedochao in #1137 - Update cli-options_2.13, cli_2.13, ... to 0.1.7 by @scala-steward in #1138
Full Changelog: v0.1.8...v0.1.9
v0.1.8
--list-main-classes
option for the run
command
You can pass the option --list-main-classes
to the run
command to list all the available main classes, including
scripts.
$ scala-cli . --list-main-classes
Hello scripts.AnotherScript_sc scripts.Script_sc
Add config
command
The config
sub-command allows to get and set various configuration values, intended for use by
other Scala CLI sub-commands.
This feature has been added in preparation for the publish
command, stay tuned for future announcements.
Added in #1056 by @alexarchambault
Prioritise non-script main classes
When trying to run a directory containing scripts and just a single non-script main class, the non-script main class
will now be prioritised and run by default.
$ scala-cli .
Running Hello. Also detected script main classes: scripts.AnotherScript_sc, scripts.Script_sc
You can run any one of them by passing option --main-class, i.e. --main-class scripts.AnotherScript_sc
All available main classes can always be listed by passing option --list-main-classes
Hello world
Important bugfixes
Accept latest Scala versions despite stale Scala version listings in cache
Scala CLI uses version listings from Maven Central to check if a Scala version is valid. When new Scala versions are
released, users could sometimes have stale version listings in their Coursier cache for a short period of time (the
Coursier cache TTL, which is 24 hours by default). This prevented these users to use new Scala versions during that
time.
To work around that, Scala CLI now tries to re-download version listings when they don't have the requested Scala
version.
This addresses #1090
Bloop now uses JAVA_HOME
by default
Bloop should now pick up the JDK available in JAVA_HOME
. It was formerly necessary to pass --bloop-jvm system
explicitly. This addresses #1102
The -coverage-out
option now accepts relative paths
Scala CLI now correctly processes relative paths when passed to the -coverage-out
option. Formerly,
the scoverage.coverage
file would not be properly generated when a relative path was passed.
This addresses #1072
Other changes
Documentation PRs
- Improve scripts guide by @Gedochao in #1074
- Update installation instructions for Nix by @kubukoz in #1082
- Tweak docs by @alexarchambault in #1085
- Some typos & rewording on the single-module projects use case page by @Baccata
in #1089
Fixes
Build and internal changes
- Update scala-cli.sh launcher for 0.1.7 by @github-actions in #1076
- Tweaking by @alexarchambault in #1087
Full Changelog: v0.1.7...v0.1.8
v0.1.7
Support for printing help from scala compiler
Help from the scala compiler can now be printed without passing any sources:
$ scala-cli --scalac-help
Usage: scalac <options> <source files>
where possible standard options include:
-Dproperty=value Pass -Dproperty=value directly to the runtime system.
-J<flag> Pass <flag> directly to the runtime system.
...
Other scalac print help options (like -X
, -Xshow-phases
, -Vphases
, etc.) are supported as well.
$ scala-cli -Xshow-phases
...
Possible advanced options include:
-Xcheck-macros Check some invariants of macro generated code while
...
Scala CLI is built using mill-scala-cli Mill plugin
We now rely on mill-scala-cli
Mill plugin, which allows compiling Scala modules with Scala CLI rather than with Mill's ZincWorker.
To see more go to mill-scala-cli and try it in your project.
Added in #1042 by @alexarchambault
Add default-file
command
The default-file
sub-command provides sensible default content for files such as .gitignore
or for GitHub actions workflows, for Scala CLI projects.
$ scala-cli default-file --write .gitignore .github/workflows/ci.yml
Wrote .gitignore
Wrote .github/workflows/ci.yml
To see more go to default-file
section in documentation.
Added in #1027 by @alexarchambault
Enhancements
Setup-ide use symlink if target is the same as current launcher
The path to Scala CLI points to the symlink if the launcher path is the same as the canonical path which targets the symlink.
Better messages in doctor
The doctor command now has a better suggestion to update scala-cli
.
In progress
More publishing-related features
- Add pgp {push,pull,key-id} commands by @alexarchambault in #1020
Interactive mode
Other changes
Documentation PRs
- Add more docs for piping sources by @Gedochao in #1053
- Add cookbook - How to use scala-cli in GH actions by @lwronski in #1031
- Update/docusaurus by @lwronski in #1051
- Ensure the latest Scala / Scala.js versions are used in version listings in doc by @alexarchambault in #1034
- Add section about external projects in README by @alexarchambault #1075
Updates
- Update trees_2.13 to 4.5.8 by @scala-steward in #1046
- Update jsoniter-scala-core, ... to 2.13.26 by @scala-steward in #1045
- Use Scala CLI 0.1.6 from Mill to compile project by @alexarchambault in #1037
- Update scala-cli.sh launcher for 0.1.6 by @github-actions in #1035
Build and internal changes
- Use coursier support for ~/.m2/settings.xml for proxy auth by @alexarchambault in #1058
- Tweaking by @alexarchambault in #1057
- Tweak jsoniter-scala dependency by @alexarchambault in #1044
- Use closest previous version when looking for stable Scala versions by @alexarchambault in #1032
- Name target dir with a unique name by @lwronski in #1036
- Use external binary to extract class name from stdin Java sources by @alexarchambault #1068
Contributors
Thank you to all the contributors who made this release possible 🎉
According to git shortlog -sn --no-merges v0.1.6...v0.1.7
these are:
34 Alexandre Archambault
12 Piotr Chabelski
7 Łukasz Wroński
Full Changelog: v0.1.6...v0.1.7
v0.1.6
Add doc
command
Scala CLI now has a doc
sub-command, that generates javadoc / scaladoc. Use like
$ scala-cli doc . --output scala-doc
You can then open scala-doc/index.html
in your browser.
Accept Java code via standard input
Java code can now be piped to Scala CLI:
$ cat Foo.java
public class Foo {
public static void main(String[] args) {
System.out.println("Hello from Scala CLI");
}
}
$ cat Foo.java | scala-cli _.java
Hello from Scala CLI
Enhancements
Revolver mode alias
The --revolver
option of the run
sub-command now has a --restart
alias. This option interrupts any running application in watch mode upon source changes, rather than waiting for it to exit.
Better messages in export
The export
command now has more and better output.
Better pure Java projects support
When compiling / running pure Java projects, Scala CLI won't download any more Scala test bridges and Scala version listings.
Changed in #982 by @alexarchambault
Suggest users to run scala-cli bloop output
if starting the Bloop server fails
When Scala CLI can't start the Bloop server (that is, its compilation server), it now suggests to run scala-cli bloop output
, which should have more details about what failed.
Changed in #1002 by @alexarchambault
Allow users to pick a main class via an interactive prompt
When passed -i
or --interactive
, if several main classes are detected, Scala CLI now offers users to interactively pick a main class, via a prompt, rather than exiting.
Fixes
Fix possible cause of abrupt Bloop server disconnection upon startup
- Use snailgun fork, allowing to slightly rework nailgun input stream handling by @alexarchambault in #944
Fix handling of UTF-8 characters in file names on Linux
- Add UTF-8 chars in file name test by @alexarchambault in #966
Fix Scala.js and Scala Native help messages
Add workaround for zip CRC32 errors on Arch Linux
- Add workaround for ArchLinux + native-image CRC32 miscalculation issue by @alexarchambault in #865
- Suggest zip issue workaround when apparently running into it by @alexarchambault in #1007
Use 0 TTL when getting Scala nightly versions
In progress
More publishing-related features
- Add "gh secret {list,create}" commands by @alexarchambault in #994
- Allow to publish to Maven Central in publish command by @alexarchambault in #1003
- Add "publish local" command by @alexarchambault in #1008
- Publish fixes by @alexarchambault in #1026
Other changes
Documentation PRs
- Use absolute path for loading images/gifs by @lwronski in #874
- Update directective instruction for tests by @amaalali in #918
- Update using-directives.md by @romanowski in #925
- Back port of documentation changes to main by @github-actions in #969
- java deps directive by @swuecho in #974
- Back port of documentation changes to main by @github-actions in #977
- Back port of documentation changes to main by @github-actions in #987
- Update main-class name for scala-cli 0.1.5 by @lolgab in #990
- Fix typo in education page by @szymon-rd in #1013
Updates
- Update jsoniter-scala-core, ... to 2.13.20 by @scala-steward in #973
- Update trees_2.13 to 4.5.6 by @scala-steward in #983
- Update mill-main to 0.10.4 by @scala-steward in #988
- Update jsoniter-scala-core, ... to 2.13.21 by @scala-steward in #989
- Update bloop-core to 1.5.0-sc-1 by @alexarchambault in #992
- Update client3:core to 3.5.2 by @scala-steward in #1000
- Update client3:core to 3.6.1 by @scala-steward in #1001
- Update jsoniter-scala-core, ... to 2.13.22 by @scala-steward in #1010
- Update jsoniter-scala-core, ... to 2.13.23 by @scala-steward in #1021
- Update coursier-jvm_2.13, ... to 2.1.0-M6 by @scala-steward in #1018
- Update trees_2.13 to 4.5.7 by @scala-steward in #1022
- Update jsoniter-scala-core, ... to 2.13.24 by @scala-steward in #1025
- Update client3:core to 3.6.2 by @scala-steward in #1028
- Update jsoniter-scala-core, ... to 2.13.25 by @scala-steward in #1030
- Update ammonite to 2.5.4 by @scala-steward in #1029
Build and internal changes
- Bump VirtusLab/scala-cli-setup from 267af2f1ed4911180b4bb25619ca4a586753cbd1 to 0.1.4 by @dependabot in #961
- Stop using asciinema/asciinema image by @alexarchambault in #964
- Update scala-cli.sh launcher for 0.1.5 by @github-actions in #968
- Only compile integration tests once by @alexarchambault in #971
- Switch maven status to Scala 3 by @lwronski in #972
- Assembly package size test by @lwronski in #970
- Return exception via the left side of either by @lwronski in #979
- In Doctor, account for absolute and relative paths by @anatoliykmetyuk in #975
- Use deploy key in git checkout by @lwronski in #984
- Fix display Github Action snippet by @lwronski in #986
- Bump docker/login-action from 1 to 2 by @dependabot in #997
- Add ScalaCLI logo.ico for choco by @lwronski in #1004
- Allow forks to build their own launchers by @alexarchambault in #999
- Tweak build (cli2) and scala-cli.sh script by @alexarchambault in #1009
- Don't pass root dir to Mill PathRef by @alexarchambault in #1012
- Bump VirtusLab/scala-cli-setup from 0.1.4 to 0.1.5 by @dependabot in #1014
- Fix typo in Fmt error message by @lwronski in #1017
- Update scala-cli-setup after release by @lwronski in #1019
- Updates for Scala CLI 0.1.6 by @alexarchambault in #1033
New Contributors
- @amaalali made their first contribution in #918
- @swuecho made their first contribution in #974
- @anatoliykmetyuk made their first contribution in #975
- @szymon-rd made their first contribution in #1013
Full Changelog: v0.1.5...v0.1.6
v0.1.5
The package
command output name now follows the actual main class name
The default output name of the package
command will now follow the actual compiled main class name, while it formerly followed the inferred class name coming from the first source file passed as argument, where applicable.
In other words, for the following 2 sources:
case class SomeCaseClass(value: String)
object Main extends App {
val smth = SomeCaseClass(value = "Hello")
println(smth.value)
}
Running package
without explicit --output
:
scala-cli package SomeCaseClass.scala ActualMainClass.scala
For Scala CLI v0.1.4
and before would the output file name would default to SomeCaseClass
, while as of v0.1.5
it will now fallback to Main
.
If you rely on the package
command without explicitly passing the --output
parameter, the actual output file name may now be different, depending on the passed sources.
Please make sure this does not break any automation in your scripts when upgrading Scala CLI to this version.
This change was added by @Gedochao in #943.
Scala CLI is built using Scala 3
We now rely on Scala 3 (3.1.2
as of this release) as the default internal Scala version used to build the project. We still compile some modules (which were using macros heavily) with Scala 2.13. However, the fact that we can do so shows that migration from Scala 2 to Scala 3 can be done by isolating macros.
This change was added by @romanowski in #913.
Pure Java projects support
Projects consisting only of Java sources are now handled more consistently by Scala CLI. In particular, the Scala library JAR isn't added any more in the class path, and no Scala JARs are downloaded upfront.
This was changed in #940 by @alexarchambault.
Notable PRs
- Fix compute nightly version Scala 2 by @lwronski in #908
- Switch to Scala 3 by default by @romanowski in #913
- Ensure a main class element is findable in Scala code passed by
stdin
by @Gedochao in #933 - Refactor the usage of default main class override to only apply to on-disk Scripts by @Gedochao in #943
- Define valid package type for Scala.js and Scala Native by @lwronski in #941
- Add pure Java projects support by @alexarchambault in #940
Documentation PRs
Other merged PRs
- Update scala-cli.sh launcher for 0.1.4 by @github-actions in #910
- Back port of documentation changes to main by @github-actions in #911
- Update jsoniter-scala-core, ... to 2.13.16 by @scala-steward in #912
- Update cli_2.13, shared_2.13 to 0.1.3 by @scala-steward in #891
- Many minor tweaking / refactoring by @alexarchambault in #917
- Rename module build to build-module to allow run
./mill --repl
by @lwronski in #916 - Add integration tests for BSP workspace/reload by @Gedochao in #914
- Back port of documentation changes to main by @github-actions in #919
- Update jsoniter-scala-core, ... to 2.13.17 by @scala-steward in #927
- Back port of documentation changes to main by @github-actions in #928
- Tweaking by @alexarchambault in #935
- Update jsoniter-scala-core, ... to 2.13.18 by @scala-steward in #939
- Update scalafmt-core to 3.5.2 by @scala-steward in #930
- Update scalafmt-cli to 3.5.2 by @scala-steward in #903
- Update Scala to 3.1.2 by @alexarchambault in #952
- Update publish_2.13 to 0.1.2 by @scala-steward in #950
- Use Constants.defaultScalaVersion instead of properties scala version by @lwronski in #955
- Update GraalVM to 22.1.0 by @alexarchambault in #940
- Remove pretty stacktraces by @lwronski in #954
Contributors
Thank you to all the contributors who made this release possible 🎉
According to git shortlog -sn --no-merges v0.1.4...v0.1.5
these are:
37 Alexandre Archambault
16 Piotr Chabelski
8 Scala Steward
6 Łukasz Wroński
4 github-actions[bot]
1 Krzysztof Romanowski
Full Changelog: v0.1.4...v0.1.5
v0.1.4
New Contributors
- @brianloveswords made their first contribution in #854
- @crater2150 made their first contribution in #893
Thank you!
Improved support for IDEA IntelliJ
As of v0.1.4
using Scala CLI with IDEA IntelliJ is no longer discouraged and should be on par with metals
.
If IDEA IntelliJ is your IDE of choice, but you haven't been using it alongside Scala CLI due to its former instability, make sure to give it a try!
Also, if you nonetheless run into any issues when working with IntelliJ, be sure to report it to us.
Scala CLI now supports BSP workspace/reload
It is now possible to reload the workspace with BSP. This effectively means that if you are using an IDE with Scala CLI, any changes to your builds (including i.e. source directories, dependencies or passed options) introduced by subsequent runs of Scala CLI setup-ide
, run
and compile
commands should be picked up by your IDE automatically.
This should particularly improve the experience of using Scala CLI with IDEA IntelliJ.
This feature was added by @Gedochao in #858, #863 and #886.
Scala CLI now supports passing a JAR url as a fallback fetching method
You can now add a url=https://...
param to a dependency to use the url
as a fallback fetching method. The url will be used if the JAR can't be fetched from Maven Central.
Example usage:
scala-cli run --dependency "tabby:tabby:0.2.3,url=https://github.com/bjornregnell/tabby/releases/download/v0.2.3/tabby_3-0.2.3.jar" UsingRemoteJar.scala
or with a using directive
:
//> using lib "tabby:tabby:0.2.3,url=https://github.com/bjornregnell/tabby/releases/download/v0.2.3/tabby_3-0.2.3.jar"
import tabby.Grid
object UsingRemoteJar extends App {
println(Grid("a", "b", "c")(1, 2, 3))
}
This feature was added by @Gedochao in #875.
Scala CLI now supports smallmodulesfor
module split style for Scala.js
Scala.js option --js-module-split-style
now supports a new module split style with smallmodulesfor
(in addition to previously supported fewestmodules
and smallestmodules
). To define packages use --js-small-module-for-package
.
Example usage with directives:
//> using jsModuleSplitStyleStr "smallmodulesfor"
//> using jsSmallModuleForPackage "com.example.test", "com.example.example""
or straight from the CLI:
scala-cli package --js-module-split-style smallestmodulesfor --js-small-module-for-package "com.example.test" --js-small-module-for-package "com.example.example"
This feature was added by @lwronski in #894.
It is now possible to skip the --cli-scala-version
parameter when running an old Scala CLI version
When running an old (pre-migration to Scala 2.13) Scala CLI version (i.e. v0.1.1) it was formerly necessary to specify the Scala version --cli-scala-version
explicitly (to make it build correctly with Scala 2.12).
Thus, it is now possible to just run:
scala-cli --cli-version 0.1.1 about
This feature was added by @lwronski in #872.
Scala CLI Bloop server now ignores SIGINT
From now on when the mill or scala-cli invocation that starts the Bloop server gets interrupted by Ctrl-C (to stop a watch mode, for example), the Bloop server running in the background will ignore the interruption and just keep on running.
This feature was added in #851.
Bloop server output is kept in a file
From now on Scala CLI keeps its Bloop server output in a file.
The output can be obtained through the bloop output
command:
scala-cli bloop output
This might be useful when debugging problems with Bloop (for example, if the server fails to start or times out).
This feature was added in #853.
Notable PRs
- Send the Bloop server output to a file when possible by @alexarchambault in #853
- using directives correctly parsing Numeric and Boolean values by @zmerr in #684
- Graal scala3 by @romanowski in #830
- Add --compute-version option in publish command by @alexarchambault in #866
- Start repl with scalac options by @romanowski in #868
- Allow users to override scalac options set internally by @alexarchambault in #877
- Make sure that Either CPS on Scala 3 handle Lefts correctly by @romanowski in #888
Documentation PRs
- docs: fix examples in scala-js.md and native-images.md by @brianloveswords in #854
- Fix typos in docs by @alexarchambault in #873
- Add discord link to README.md by @lwronski in #883
- Fix quotes in shebang help by @crater2150 in #893
Other merged PRs
- Update scalafmt-core to 3.5.0 by @scala-steward in #836
- Update scala-cli.sh launcher for 0.1.3 by @github-actions in #841
- Fix regex in docs by @lwronski in #842
- Fix sorting SNAPSHOT version by @lwronski in #840
- Update bloop-config_2.13 to 1.4.19-2 by @scala-steward in #844
- Update asm to 9.3 by @scala-steward in #847
- Fix unexpected progress bars for coursier logging on CI by @alexarchambault in #839
- Update jsoniter-scala-core, ... to 2.13.12 by @scala-steward in #843
- Update scalajs-sbt-test-adapter_2.13 to 1.10.0 by @scala-steward in #845
- Fix release CI by @lwronski in #849
- Resolve latest version for --cli-version by @lwronski in #827
- Make Bloop server ignore SIGINT by @alexarchambault in #851
- Get rid of explicit /dev/null uses by @alexarchambault in #850
- Update bloop-config_2.13 to 1.4.20 by @scala-steward in #855
- Update trees_2.13 to 4.5.3 by @scala-steward in #862
- Update scalafmt-core to 3.5.1 by @scala-steward in #861
- Add support for BSP workspace/reload (reworked version of #852) by @alexarchambault and @Gedochao in #858
- Fix BSP
workspace/reload
on IntelliJ by @Gedochao in #863 - Back port of documentation changes to main by @github-actions in #876
- Update mill-main to 0.10.3 by @scala-steward in #879
- Bump actions/download-artifact from 2 to 3 by @dependabot in #880
- Update scalafmt-cli to 3.5.1 by @scala-steward in #860
- Allow for dependencies to fallback to a JAR url provided in a
url
user param by @Gedochao in #875 - Remove now unnecessary resource in native launcher by @alexarchambault in #878
- Update org.eclipse.jgit to 6.1.0.202203080745-r by @scala-steward in #882
- Update jsoniter-scala-core, ... to 2.13.13 by @scala-steward in #885
- Fix release mode and jsHeader by @lwronski in #881
- Fix Scala 3.1.nightly tests by @romanowski in #892
- Reload options on a BSP workspace/reload by @Gedochao in #886
- Launch older scala-cli version without --cli-scala-version by @lwronski in #884
- Update reflect-config.json by @alexarchambault in #895
- Add support for SmallModulesFor style by @lwronski in #894
- Update ammonite to 2.5.3 by @scala-steward in #897
- Update jsoniter-scala-core, ... to 2.13.15 by @scala-steward in #901
- Update trees_2.13 to 4.5.4 by @scala-steward in #898
Contributors
Thank you to all the contributors who made this release possible 🎉
According to git shortlog -sn --no-merges v0.1.3...v0.1.4
these are:
25 Alexandre Archambault
15 Scala Steward
12 Piotr Chabelski
9 Łukasz Wroński
4 Krzysztof Romanowski
3 Brian J Brennan
2 github-actions[bot]
1 dependabot[bot]
1 zmerr
1 Alexander Gehrke
Full Changelog: v0.1.3...v0.1.4
v0.1.3
New Contributors
- @mtk made their first contribution in #690
- @armanbilge made their first contribution in #732
- @Gedochao made their first contribution in #780
- @wiacekm made their first contribution in #742
Thank you!
Scala CLI can run nightly versions of Scala 2.12
, 2.13
and 3.x
Since 0.1.3
it is possible to use the latest nightly version of Scala compiler with the syntax 2.12.nightly
, 2.13.nightly
and 3.x.nightly
.
For compiling with the latest Scala 2.12 nightly build:
scala-cli Hello.scala -S 2.12.nightly
For compiling with the latest specific binary version of Scala 3 nightly build:
scala-cli Hello.scala -S 3.1.nightly
scala-cli Hello.scala -S 3.0.nightly
This feature was added by @zmerr in #736 and #788
Revolver mode
--revolver
mode runs your application in the background and automatically restarts it upon any change:
scala-cli run Hello.scala --revolver
# Hello
# Watching sources, press Ctrl+C to exit.
# Compiling project (Scala 3.1.1, JVM)
# Compiled project (Scala 3.1.1, JVM)
# Hello World
# Watching sources, press Ctrl+C to exit.
This feature was added by @lwronski in #747
Support Scala.js linking on Windows
Scala CLI now supports Scala.js linking on Windows, so it allows to build and run Node.js applications on this OS (changed in #676).
Native image packaging
Passing --native-image
to the package
sub-command generates native executables applications using GraalVM native images. This feature may not work with Scala 3 but Scala CLI team is working to fix it soon (changed in #773).
scala-cli package Hello.scala -o hello --native-image
Build Scala CLI with Scala 2.13
From now on Scala CLI is built with Scala 2.13. It is a first step in order to migrate to Scala 3, stay tuned (changed in #649).
Scaladoc packaging
Passing --doc
to the package
sub-command generates a scaladoc JARs. These follow the same format as the scaladoc JARs of libraries published to Maven Central. This is another step for adding support for a publish
command, which should be announced in the next release (this feature was added in #774).
scala-cli package Hello.scala -o hello --doc
Experimental
New publish command
publish
command was added to Scala CLI, but it is still until development and requires some additional testing. Publishing your library will be easier than before, so stay tuned to official announcement this feature (this feature was added in #707).
Proxy auth mechanism
Authenticated proxies can now be configured in Scala CLI. Note that this feature should also work in the Scala CLI native launchers, which is an improvement over how it works in the coursier CLI (there, it works for coursier run from the JVM, not with the coursier native launchers).
To setup authenticated proxy credentials, we recommend setting 8 Java properties, like
$ scala-cli \
-Dhttp.proxyHost=my-proxy.com -Dhttp..proxyPort=8888 -Dhttp.proxyUser=johndoe -Dhttp.proxyPassword=1234 \
-Dhttps.proxyHost=my-proxy.com -Dhttps..proxyPort=8888 -Dhttps.proxyUser=johndoe -Dhttps.proxyPassword=1234
(You should change the property values to the ones of your proxy.)
The way these proxies are configured is a bit cumbersome, and is likely to change in the near future.
(changed in #768)
Notable changes
- Allow users to specify an explicit workspace directory by @alexarchambault in #679
- Package - overwrite a file generated by scala-cli with --watch flag by @lwronski in #714
- Allow use of main.sc scripts with scala-cli by @ghostbuster91 and @mtk in #740
- Pass programArgs to scala repl by @lwronski in #760
- Add server less mode (enable with --server=false) by @alexarchambault in #771
- doctor version diagnosis by @asjad02 in #741
- Emit source maps for package command by @lwronski in #784
- add output option to compile command by @wiacekm in #742
- JsDom - run tests with JSDOM JSEnv by @lwronski in #796
- Package command - add support for multi modules by @lwronski in #816
- Add support for signing in publish command by @alexarchambault in #748
Merged PR
- Prepare to build CLI with Scala 2.13 by @alexarchambault in #689
- Don't let dependencies bump Scala artifacts by @alexarchambault in #693
- Update Mill to 0.10.0 and mill-native-image to 0.1.19 by @alexarchambault in #694
- Fix temporary mill launcher by @alexarchambault in #699
- Tweak Bloop launch-related messages by @alexarchambault in #700
- Fix publish by @alexarchambault in #703
- Setup-ide fails if is call by non-owner by @lwronski in #688
- Use scala-cli-setup in CI by @lwronski in #704
- Update coursier to 2.1.0-M5 by @alexarchambault in #706
- Download scala-cli in build by @alexarchambault in #697
- Open PR with update standalone launcher after release by @lwronski in #705
- Disable using scala-cli to build scala-cli on unsupported architecture by @lwronski in #712
- Use logger in console build bloop client by @lwronski in #713
- Fix scalafix by @alexarchambault in #745
- Tweaking by @alexarchambault in #744
- Add missing Scala Native using directives by @jchyb in #749
- Update Mill to 0.10.1 by @lolgab in #763
- Fix scala-cli-src script by @romanowski in #769
- show update info in About command on linux by @zmerr in #663
- No strict bloop check in build by @alexarchambault in #772
- Add option to debug BSP connection. by @romanowski in #770
- Use jsoniter-scala rather than upickle by @alexarchambault in #777
- Adjust BSP project base directory to scala-cli content root to fix IntelliJ import by @Gedochao in #780
- Use jvm system version if Java Home is higher or equal 17 by @lwronski in #781
- Don't depend on a JDK in the brew formula by @alexarchambault in #787
- Remove now unnecessary Scala-specific GraalVM stuff by @alexarchambault in #785
- Add missing native-image reflection config for BSP wrapped sources by @alexarchambault in #791
- Make BSP build configurations for IDEs be consistent with command line Scala CLI builds by @Gedochao in #794
- Split build into some modules by @romanowski in #795
- Cross-compile with Scala 3 by @alexarchambault in #807
- Move all cli *Options classes to dedicated module by @alexarchambault in #811
- Using directives tests by @romanowski in #822
- Issue 698 doctor command impl by @romanowski in #818
- Show log - Downloading JVM index - only if verbosity is higher than 1 by @lwronski in #824
- Cross compile cli by @romanowski in #826
Documentation changes
- Fix sclicheck by @romanowski in #819
- Update Scala.js guide - package command by @lwronski in #823
- Correction in Scala.js docs by @armanbilge in #821
- Describe how to pass base image by @lwronski inhttps://github.com//pull/765
- Add a cookbook with Scala Native scripting by @jchyb in #750
- Fix deploy decumentation after backport by @lwronski in #766
- Document how to install in GitHub Actions by @armanbilge in #732
- Update scripts.md by @mtk in #690
- Update scala-versi...