Releases: VirtusLab/scala-cli
v1.3.0
Support for Scala Native 0.5.1
This Scala CLI version adds support for Scala Native 0.5.1. All native platform builds will now use 0.5.1 as the default version.
scala-cli -e 'println("Hello, Scala Native!")' --native
# Compiling project (Scala 3.4.1, Scala Native 0.5.1)
# Compiled project (Scala 3.4.1, Scala Native 0.5.1)
# [info] Linking (multithreadingEnabled=true, disable if not used) (1059 ms)
# [info] Discovered 882 classes and 5388 methods after classloading
# [info] Checking intermediate code (quick) (39 ms)
# [info] Multithreading was not explicitly enabled - initial class loading has not detected any usage of system threads. Multithreading support will be disabled to improve performance.
# [info] Linking (multithreadingEnabled=false) (291 ms)
# [info] Discovered 499 classes and 2501 methods after classloading
# [info] Checking intermediate code (quick) (6 ms)
# [info] Discovered 478 classes and 1916 methods after optimization
# [info] Optimizing (debug mode) (432 ms)
# [info] Produced 9 LLVM IR files
# [info] Generating intermediate code (293 ms)
# [info] Compiling to native code (1504 ms)
# [info] Linking with [pthread, dl]
# [info] Linking native code (immix gc, none lto) (351 ms)
# [info] Postprocessing (0 ms)
# [info] Total (4012 ms)
# Hello, Scala Native!
Note that not all the tools Scala CLI integrates with support Scala Native 0.5.x just yet.
When such an integration is being used, the default Scala Native version will get downgraded to 0.4.17.
scala-cli -e 'println("Hello, Scala Native!")' --native --toolkit default
# [warn] Scala Toolkit does not support Scala Native 0.5.1, 0.4.17 should be used instead.
# [warn] Scala Native default version 0.5.1 is not supported in this build. Using 0.4.17 instead.
# Compiling project (Scala 3.4.1, Scala Native 0.4.17)
# Compiled project (Scala 3.4.1, Scala Native 0.4.17)
# [info] Linking (1017 ms)
# [info] Checking intermediate code (quick) (53 ms)
# [info] Discovered 743 classes and 4242 methods
# [info] Optimizing (debug mode) (654 ms)
# [info] Generating intermediate code (898 ms)
# [info] Produced 10 files
# [info] Compiling to native code (2039 ms)
# [info] Linking with [pthread, dl]
# [info] Total (4812 ms)
# Hello, Scala Native!
Efforts for supporting Scala Native 0.5.x are ongoing, we expect the downgrade to 0.4.17 in such cases to be a temporary solution.
If you know for a fact that 0.5.x support has been delivered for a tool, you can always pass the --native-version
option explicitly, which will prevent the downgrade.
Fixes
- Add missing Scala 2 compiler print options by @Gedochao in #2848
- Don't recommend
latest
for toolkit version by @keynmol in #2852 - Explicitly pass
scala3-sbt-bridge
to Bloop by @Gedochao in #2873
Internal changes
Updates and maintenance
- Update scala-cli.sh launcher for 1.2.2 by @github-actions in #2847
- Update os-lib to 0.10.0 by @scala-steward in #2854
- Update scala-collection-compat to 2.12.0 by @scala-steward in #2856
- Update slf4j-nop to 2.0.13 by @scala-steward in #2857
- Update pprint to 0.9.0 by @scala-steward in #2855
- Update fansi to 0.5.0 by @scala-steward in #2853
- Update using_directives to 1.1.1 by @scala-steward in #2863
- Update Scala Native to 0.5.1 by @scala-steward and @Gedochao in #2862
- Update
bloop-core
to 1.5.17-sc-1 by @scala-steward in #2873 - Update
bloop-config
to 2.0.0 by @scala-steward in #2873
Full Changelog: v1.2.2...v1.3.0
v1.2.2
Fixed the Fatal invariant violated
false-positive error coming from Bloop
This small update fixes the Fatal invariant violated
error (#2829) that was being thrown by Bloop when running Scala CLI repeatedly with the same sources.
Fixed by @Gedochao & @tgodzik in #2837
Enhancements
Updates and maintenance
- Update scala-cli.sh launcher for 1.2.1 by @github-actions in #2828
- Update
org.scalameta:trees_2.13
to 4.9.3 by @scala-steward in #2831 - Update ammonite to 3.0.0-M1-10-105f9e32 by @scala-steward in #2844
- Bump
bloop-core
to 1.5.16-sc-2 by @Gedochao in #2837
What's Changed
Full Changelog: v1.2.1...v1.2.2
v1.2.1
Support for Scala 3.4.1
This Scala CLI version adds support for Scala 3.4.1.
scala-cli version
# Scala CLI version: 1.2.1
# Scala version (default): 3.4.1
Additionally, from this version on Scala CLi is being tested against the latest Scala 3 Next RC.
And so, feel free to try out Scala 3.4.2-RC1!
scala-cli run -S 3.4.2-RC1 --with-compiler -e 'println(dotty.tools.dotc.config.Properties.simpleVersionString)'
# Compiling project (Scala 3.4.2-RC1, JVM (17))
# Compiled project (Scala 3.4.2-RC1, JVM (17))
# 3.4.2-RC1
Added by @Gedochao in #2824 & #2822
Support for Scala.js 1.16.0
This version adds Scala CLI support for Scala.js 1.16.0.
Added by @scala-steward in #2807 & @Gedochao in VirtusLab/scala-js-cli#55.
Fixes
- Fix handling for
-Xlint:help
by @Gedochao in #2781 - Fix
--semanticdb-targetroot
&--semanticdb-sourceroot
for scripts by @Gedochao in #2784 - Adjust actionable diagnostics for scripts by @rochala in #2815
- Fix publishing of runner & test-runner artifacts by @Gedochao in #2819
- bugfix: Fix Bloop import by @tgodzik in #2825
Enhancements
Internal changes
Documentation changes
- Add installation guide for FreeBSD by @spacebanana420 in #2793
- Back port of documentation changes to main by @github-actions in #2797
Updates and maintenance
- Update scala-cli.sh launcher for 1.2.0 by @github-actions in #2783
- Update core_2.13 to 3.9.4 by @scala-steward in #2787
- Update ammonite to 3.0.0-M1-8-35694880 by @scala-steward in #2786
- Update trees_2.13 to 4.9.2 by @scala-steward in #2795
- Update guava to 33.1.0-jre by @scala-steward in #2801
- Bump follow-redirects from 1.15.4 to 1.15.6 in /website by @dependabot in #2803
- Add -unchecked to the list of options that don't require -O by @joan38 in #2800
- Update bloop-rifle_2.13 to 1.5.12-sc-1 by @scala-steward in #2806
- Update sttp.client core to 3.9.5 by @scala-steward in #2810
- Update asm to 9.7 by @scala-steward in #2813
- Update Scala.js to 1.16.0 by @scala-steward in #2807
- Bump express from 4.18.2 to 4.19.2 in /website by @dependabot in #2816
- Update Bloop to 1.5.16-sc-1 by @Gedochao in #2818
- Bump Scala Next to 3.4.1 by @Gedochao in #2822
- Bump Typelevel Toolkit to 0.1.23 by @Gedochao in #2823
New Contributors
Full Changelog: v1.2.0...v1.2.1
v1.2.0
Scala 3.3.3, 3.4.0, 2.13.13 & 2.12.19 support
This version of Scala CLI adds support for a whooping 4 new Scala versions, it's been busy these past few days!
The default version used when using the CLI will from now on be the Scala 3 Next version (3.4.0 as of this release).
Using the lts
tag will now point to Scala 3.3.3.
The LTS is also the version used for building the internals of Scala CLI (although we now also cross-compile with 3.4.0).
scala-cli version
# Scala CLI version: 1.2.0
# Scala version (default): 3.4.0
Added by @Gedochao in #2772, #2736, #2755, #2753 and #2752
Remapping EsModule imports at link time with Scala.js
Given the following importMap.json
file:
{
"imports": {
"@stdlib/linspace": "https://cdn.skypack.dev/@stdlib/linspace"
}
}
It is now possible to remap the imports at link time with the jsEsModuleImportMap
directive.
//> using jsEsModuleImportMap importMap.json
//> using jsModuleKind es
//> using jsMode fastLinkJS
//> using platform js
import scala.scalajs.js
import scala.scalajs.js.annotation.JSImport
import scala.scalajs.js.typedarray.Float64Array
object Foo {
def main(args: Array[String]): Unit = {
println(Array(-10.0, 10.0, 10).mkString(", "))
println(linspace(0, 10, 10).mkString(", "))
}
}
@js.native
@JSImport("@stdlib/linspace", JSImport.Default)
object linspace extends js.Object {
def apply(start: Double, stop: Double, num: Int): Float64Array = js.native
}
The same can be achieved with the --js-es-module-import-map
command line option.
scala-cli --power package RemappingEsModuleImports.scala --js --js-module-kind ESModule -o main.js --js-es-module-import-map importMap.json
Added by @Quafadas in #2737 and VirtusLab/scala-js-cli#47
Fixes
- Updated method for choosing a free drive letter (fixes #2743) by @philwalk in #2749
- Make sure tasty-lib doesn't warn about Scala 3 Next by @Gedochao in #2775
Enhancements
Internal changes
- Fix overeager Scala version docs tests by @Gedochao in #2750
- Lock script wrapper tests on the internally used Scala 2.13 version by @Gedochao in #2754
- Use Scala LTS as the default version while cross compiling all Scala 3 modules on both LTS & Next by @Gedochao in #2752
- Explicitly set sonatype publishing to use the default cross Scala version by @Gedochao in #2757
- Fix publishing of artifacts to include non-cross-compiled modules by @Gedochao in #2759
- Run integration tests with both Scala 3 LTS & Next versions by @Gedochao in #2760
Documentation changes
- Fix typo by @imRentable in #2739
- Add directive examples in Scala Native docs by @spamegg1 in #2774
- toolkit latest is deprecated, mention default instead by @spamegg1 in #2776
Updates and maintenance
- Update scala-cli.sh launcher for 1.1.3 by @github-actions in #2734
- Bump webfactory/ssh-agent from 0.8.0 to 0.9.0 by @dependabot in #2731
- Update
coursier
to 2.1.9 by @Gedochao in #2735 - Bump
scala-js-cli
to 1.15.0.1 by @Gedochao in #2738 - Update Scala to 3.4.0 by @Gedochao in #2736
- Update slf4j-nop to 2.0.12 by @scala-steward in #2748
- Update trees_2.13 to 4.9.0 by @scala-steward in #2747
- Update mill-main to 0.11.7 by @scala-steward in #2744
- Update sttp client core_2.13 to 3.9.3 by @scala-steward in #2745
- Bump Scala 2.12 to 2.12.19 by @Gedochao in #2753
- Update sbt to 1.9.9 by @scala-steward in #2756
- Bump Scala 2.13 to 2.13.13 by @Gedochao in #2755
- Update scalameta to 4.9.1 by @scala-steward in #2770
- Bump Scala LTS to 3.3.3 by @Gedochao in #2772
- Update ammonite to 3.0.0-M0-71-1e75159e by @scala-steward in #2773
- Update ammonite to 3.0.0-M0-92-0b2ae1a1 by @scala-steward in #2782
New Contributors
- @imRentable made their first contribution in #2739
- @spamegg1 made their first contribution in #2774
Full Changelog: v1.1.3...v1.2.0
v1.1.3
Support for LTS Scala version aliases
It is now possible to use lts
and 3.lts
as Scala version aliases in Scala CLI.
They refer to the latest LTS version of Scala (the 3.3.x
line at the time of this release).
scala-cli run -S lts --with-compiler -e 'println(dotty.tools.dotc.config.Properties.simpleVersionString)'
# Compiling project (Scala 3.3.1, JVM (17))
# Compiled project (Scala 3.3.1, JVM (17))
# 3.3.1
Using the 2.lts
, 2.13.lts
& 2.12.lts
aliases returns a meaningful error, too.
scala-cli run -S 2.lts -e 'println(scala.util.Properties.versionString)'
# [error] Invalid Scala version: 2.lts. There is no official LTS version for Scala 2.
# You can only choose one of the 3.x, 2.13.x, and 2.12.x. versions.
# The latest supported stable versions are 2.12.18, 2.13.12, 3.3.1.
# In addition, you can request compilation with the last nightly versions of Scala,
# by passing the 2.nightly, 2.12.nightly, 2.13.nightly, or 3.nightly arguments.
# Specific Scala 2 or Scala 3 nightly versions are also accepted.
# You can also request the latest Scala 3 LTS by passing lts or 3.lts.
Added by @kasiaMarek in #2710
--semanticdb-targetroot
and --semanticdb-sourceroot
options
It is now possible to set the SemanticDB target root and source root directories with unified syntax, independent of the target Scala and/or Java versions.
scala-cli compile src/semanticdb-example.sc --semanticdb-targetroot ./targetRootDir --semanticdb-sourceroot .
Fixes
- remove
user.home
hack by @kasiaMarek in #2710 - Fix ultra-long invalid Scala version errors by @Gedochao in #2724
Documentation changes
- Add information about
--preamble
in assembly packaging documentation by @spacebanana420 in #2713 - Back port of documentation changes to main by @github-actions in #2717
- Documentation for creation of custom toolkit by @yadavan88 in #2715
- Back port of documentation changes to main by @github-actions in #2718
- Fix formatting in custom toolkit doc by @yadavan88 in #2719
- Back port of documentation changes to main by @github-actions in #2720
- Added info about repl with toolkit by @yadavan88 in #2721
- Back port of documentation changes to main by @github-actions in #2723
Updates and maintenance
- Update scala-cli.sh launcher for 1.1.2 by @github-actions in #2688
- Update bsp4j to 2.1.1 by @scala-steward in #2700
- Update Scala Native to 0.4.17 by @scala-steward in #2696
- Bump coursier/setup-action from 1.3.4 to 1.3.5 by @dependabot in #2716
New Contributors
- @kasiaMarek made their first contribution in #2710
- @spacebanana420 made their first contribution in #2713
- @yadavan88 made their first contribution in #2715
Full Changelog: v1.1.2...v1.1.3
v1.1.2
Support for Scala.js 1.15.0
This version adds Scala CLI support for Scala.js 1.15.0.
Added by @scala-steward in #2672 & @Gedochao in VirtusLab/scala-js-cli#43.
Fixes
- Fix repeatable compiler options handling from the command line by @Gedochao in #2666
- Fix script wrapper tests & script object wrapper
using
directive by @Gedochao in #2668 - Prevent consecutive
-language:*
options from being ignored by @Gedochao in #2667 - in FailedToStartServerException advice, include --power by @SethTisue in #2685
Documentation changes
- Fix test.md by @MaciejG604 in #2679
- Back port of documentation changes to main by @github-actions in #2681
Build and internal changes
- Update release procedure steps for
v1.1.x
by @Gedochao in #2665 - Tag
GitHubTests.create secret
as flaky on all Mac tests (including M1) by @Gedochao in #2677
Updates and maintenance
- Update scala-cli.sh launcher for 1.1.1 by @github-actions in #2662
- Bump libsodiumjni to 0.0.4 by @MaciejG604 in #2651
- Update guava to 33.0.0-jre by @scala-steward in #2670
- Update os-lib to 0.9.3 by @scala-steward in #2671
- Update sbt to 1.9.8 by @scala-steward in #2673
- Update trees_2.13 to 4.8.15 by @scala-steward in #2674
- Update slf4j-nop to 2.0.11 by @scala-steward in #2675
- Update Scala.js to 1.15.0 by @scala-steward in #2672
- Update core_2.13 to 3.9.2 by @scala-steward in #2687
Full Changelog: v1.1.1...v1.1.2
v1.1.1
Deprecate Scala Toolkit latest
version in favour of default
Using toolkits with the latest
version is now deprecated and will cause a warning.
It will likely be removed completely in a future release.
scala-cli --toolkit latest -e 'println(os.pwd)'
# Using 'latest' for toolkit is deprecated, use 'default' to get more stable behaviour:
# --toolkit default
# Compiling project (Scala 3.3.1, JVM (17))
# Compiled project (Scala 3.3.1, JVM (17))
# /home
It is now advised to either use an explicit toolkit version or rely on the new default
alias.
scala-cli --toolkit default -e 'println(os.pwd)'
# Compiling project (Scala 3.3.1, JVM (17))
# Compiled project (Scala 3.3.1, JVM (17))
# /home
The default
version for toolkits is tied to a particular Scala CLI version.
You can check which version is used by referring to Scala CLI help.
scala-cli version
# Scala CLI version: 1.1.1
# Scala version (default): 3.3.1
scala-cli run -h|grep toolkit
# --toolkit, --with-toolkit version|default Add toolkit to classPath (not supported in Scala 2.12), 'default' version for Scala toolkit: 0.2.1, 'default' version for typelevel toolkit: 0.1.20
Added by @MaciejG604 in #2622
Enhancements
- Remove semantics Compliant for asInstaceOf by @MaciejG604 in #2614
- Scala js mode validation by @MaciejG604 in #2630
- Add missing Scala.js mode aliases by @Gedochao in #2655
- Add deprecation reporting mechanism for using directives by @MaciejG604 in #2622
- Pass java opts to scalac by @MaciejG604 in #2601
Fixes
- Fallback to UTF-8 in setup-ide by @JD557 in #2599
- Separate Scala REPL classpath from user dependencies by @Gedochao in #2607
- Prevent resource directories from breaking sources hash by @Gedochao in #2654
- Fix special handling for the
-Xplugin-list
compiler option by @Gedochao in #2635 - Remove superfluous traits by @MaciejG604 in #2618
- Prevent the toolkit latest deprecation warning from being logged more than once by @Gedochao in #2657
Documentation changes
- Unify mentions of Java properties and link to the correct section of guides. by @MaciejG604 in #2603
- Document script wrappers by @MaciejG604 in #2596
- Shorten titles of cookbooks by @MaciejG604 in #2609
- Add docs for bloop interaction by @MaciejG604 in #2608
- Docs/java opts for compiler by @MaciejG604 in #2619
- Add a subcategories layer for guides & cookbooks by @Gedochao in #2612
- Merge documentations about proxy setup by @MaciejG604 in #2597
- Update test framework versions by @mbovel in #2625
- Back port of documentation changes to main by @github-actions in #2604
- Back port of documentation changes to main by @github-actions in #2611
- Back port of documentation changes to main by @github-actions in #2615
- Back port of documentation changes to main by @github-actions in #2617
- Back port of documentation changes to main by @github-actions in #2620
Build and internal changes
- Add debug mode by @MaciejG604 in #2643
- Downgrade Xcode on macos CI runners by @MaciejG604 in #2632
- Revert xcode version downgrade by @MaciejG604 in #2650
Updates and maintenance
- Update scala-cli.sh launcher for 1.1.0 by @github-actions in #2594
- Update org.eclipse.jgit to 6.8.0.202311291450-r by @scala-steward in #2613
- Bump docusaurus version by @MaciejG604 in #2610
- Bump actions/setup-python from 4 to 5 by @dependabot in #2624
New Contributors
Full Changelog: v1.1.0...v1.1.1
v1.1.0
Breaking update to Scala 2 scripts
Keep in mind that it ONLY applies to Scala 2! Scala 3 script wrappers are not affected!
Scala CLI now uses a different kind of script wrappers for Scala 2 by default, which support running background threads.
This has been introduces as an answer to the issue #2470, where a running a script in Scala 2 would end up in a deadlock due to background threads being run.
Also the change makes the Scala 2 scripts run significantly faster, as the code can be optimized due to not residing in the object's initialization clause.
However, the new solution brings some incompatibilities with the old behaviour:
- main classes are now named the same as the file they are defined in, they do not have the '_sc' suffix anymore, so any calls like:
scala-cli foo.sc bar.sc --main-class foo_sc
should be replaced with
scala-cli foo.sc bar.sc --main-class foo
- it is impossible to access the contents of a script named
main.sc
from another script, any references to the script objectmain
will result in a compilation error.
println(main.somethingDefinedInMainScript)
Will result in the following compilation error:
[error] ./foo.sc:2:11
[error] missing argument list for method main in trait App
[error] Unapplied methods are only converted to functions when a function type is expected.
[error] You can make this conversion explicit by writing `main _` or `main(_)` instead of `main`.
When main.sc
is passed as argument together with other scripts, a warning will be displayed:
[warn] Script file named 'main.sc' detected, keep in mind that accessing it from other scripts is impossible due to a clash of `main` symbols
Added by @MaciejG604 in #2556
"Drive relative" paths on Windows
Scala CLI now correctly recognizes "drive relative" paths on Windows, so paths like /foo/bar
will be treated as relative from the root of the current drive - e.g. C:\foo\bar
.
This allows for compatibility of programs referencing paths with e.g. //> using file /foo/bar
with Windows.
UX improvements
- React to some HTTP responses by @MaciejG604 in #2007
- Chore/group warnings about directives in multiple files by @MaciejG604 in #2550
- Migrate to Docusaurus v3, add local search plugin by @MaciejG604 in #2590
Enhancements
- Default to publish repository configured for local machine when infering publish.ci.repository by @MaciejG604 in #2571
- Skip validation for default Scala versions, add build test by @MaciejG604 in #2576
Fixes
- Take into consideration --project-version when creating BuildInfo by @MaciejG604 in #2548
- Workaround for home.dir property not being set by @MaciejG604 in #2573
- Pass scalac arguments as file by @MaciejG604 in #2584
Documentation changes
- Add a doc on Windows anti-malware submission procedure by @Gedochao in #2546
- Fix list of licenses URL by @JD557 in #2552
- Fix Windows secrets path in the documentation by @JD557 in #2561
- Update the pgp-pair section of publish setup docs by @MaciejG604 in #2565
- Back port of documentation changes to main by @github-actions in #2569
- Document --python flag by @MaciejG604 in #2574
- Document publishing process configuration by @MaciejG604 in #2580
Build and internal changes
- Exclude conflicting dependencies by @MaciejG604 in #2541
- Generate test reports on the CI by @Gedochao in #2543
- Use the latest
scala-cli
inmacos-m1-tests
by @Gedochao in #2554 - Install
scala-cli
withcs
on M1 by @Gedochao in #2555 - Fix generating test reports for failed suites by @Gedochao in #2564
- Pin
scala-cli-setup
version to be M1-compatible & use it innative-macos-m1-tests
by @Gedochao in #2568 - Add log separators for integration and build tests by @MaciejG604 in #2570
- Adjust test report generation to mill 0.11.6 bump changes by @Gedochao in #2577
- Bump MacOS CI to
macOS-13
by @Gedochao in #2579 - Back port of documentation changes to main by @github-actions in #2593
- Add env for configuring home directory overriding by @MaciejG604 in #2587
Updates and maintenance
- Update trees_2.13 to 4.8.13 by @scala-steward in #2532
- Update scala-cli.sh launcher for 1.0.6 by @github-actions in #2542
- chore: Update Bloop to v1.5.11-sc by @tgodzik in #2557
- Update trees_2.13 to 4.8.14 by @scala-steward in #2560
- Update scalafmt-cli_2.13, scalafmt-core to 3.7.17 by @scala-steward in #2559
- Bump VirtusLab/scala-cli-setup from 1.0.5 to 1.0.6 by @dependabot in #2567
- Update ammonite to 3.0.0-M0-59-cdeaa580 by @scala-steward in #2558
- Update mill-main to 0.11.6 by @scala-steward in #2572
- Update coursier-jvm_2.13, ... to 2.1.8 by @scala-steward in #2575
- Bump
coursier
tov2.1.8
where it wasn't consistent by @Gedochao in #2588 - Update ammonite to 3.0.0-M0-60-89836cd8 by @scala-steward in #2586
New Contributors
Full Changelog: v1.0.6...v1.1.0
v1.0.6
Scala CLI won't default to the system JVM if it's not supported anymore
If your JAVA_HOME
environment variable has been pointing to a JVM that is no longer supported by Scala CLI (so anything below 17, really), you may have run into an error like this one with Scala CLI v1.0.5:
scala-cli --power bloop exit
# Stopped Bloop server.
export JAVA_HOME=$(cs java-home --jvm zulu:8)
scala-cli -e 'println(System.getProperty("java.version"))'
# Starting compilation server
# Error: bloop.rifle.FailedToStartServerExitCodeException: Server failed with exit code 1
# For more details, please see '/var/folders/5n/_ggj7kk93czdt_n0jzrk8s780000gn/T/1343202731019130640/.scala-build/stacktraces/1699527280-9858975811713766588.log'
# Running
# scala-cli --power bloop output
# might give more details.
This is because we no longer support JVM <17 with Scala CLI v1.0.5, but we still have been defaulting to whatever JVM was defined in JAVA_HOME
. As a result, Bloop has been failing to start when running with, say, JAVA_HOME
pointing to Java 8.
This is no longer the case. Scala CLI will now automatically download Java 17 for Bloop in such a situation (and still use the JVM from JAVA_HOME
for running the code, while Bloop runs on 17).
scala-cli --power bloop exit
# Stopped Bloop server.
export JAVA_HOME=$(cs java-home --jvm zulu:8)
scala-cli -e 'println(System.getProperty("java.version"))'
# Starting compilation server
# Compiling project (Scala 3.3.1, JVM (8))
# Compiled project (Scala 3.3.1, JVM (8))
# 1.8.0_392
Other changes
Fixes
- Fix
--watch
failing on invalidPathWatchers.Event
& skip wonky tests on Mac CI by @Gedochao in #2515 - bugfix: Don't try to always get system jvm first by @tgodzik in #2508
Documentation changes
- Back port of documentation changes to main by @github-actions in #2522
- add cookbook about Emacs integration by @ag91 in #2506
Build and internal changes
- Bump actions/setup-node from 3 to 4 by @dependabot in #2493
- Update scala-cli.sh launcher for 1.0.5 by @github-actions in #2500
- Simplify build by @lolgab in #2512
- Fix wonky native MacOS CI on
stable
branch by @Gedochao in #2518 - Add regexes for release-notes github reference swapping by @MaciejG604 in #2519
Updates and maintenance
- Update scalafmt-cli_2.13, scalafmt-core to 3.7.15 by @scala-steward in #2498
- Switch
lightweight-spark-distrib
to the VL fork & bump to0.0.5
by @Gedochao in #2503 - Bump VirtusLab/scala-cli-setup from 1.0.4 to 1.0.5 by @dependabot in #2504
- Switch
java-class-name
to the VL fork & bump to0.1.3
by @Gedochao in #2502 - Update sbt to 1.9.7 by @scala-steward in #2505
- Update os-lib to 0.9.2 by @scala-steward in #2514
- Update case-app to 2.1.0-M26 by @scala-steward in #2513
- Update mill-main to 0.11.5 by @scala-steward & @MaciejG604 in #2446
- Update core_2.13 to 3.9.1 by @scala-steward in #2521
- Switch
nocrc32-zip-input-stream
to the VL fork & bump it to0.1.2
by @Gedochao in #2520
New Contributors
Full Changelog: v1.0.5...v1.0.6
v1.0.5
What's new
Accept --power
from anywhere
The --power
flag used to be a launcher option, which means it used to only be accepted when passed before the sub-command name. Now, it can be passed anywhere in the command line.
scala-cli --power package --help
scala-cli package --power --help
scala-cli package --help --power
Added by @MaciejG604 in #2399
Offline mode (experimental)
It is now possible to run Scala CLI in offline mode for the cases when you don't want the runner
to make any network requests for whatever reason.
This changes Coursier's cache policy to LocalOnly
, preventing it from downloading anything.
scala-cli . --offline
Of course, this means that you will have to have all the dependencies relevant to your build already downloaded and available in your local cache.
Reasonable fallbacks will be used where possible, e.g. the Scala compiler may be used instead of Bloop if Bloop isn't available.
Added by @MaciejG604 in #2404
Shorter install script link
Scala CLI's install script is now available behind a conveniently shorter web address:
https://scala-cli.virtuslab.org/get
The fix
sub-command (experimental)
The fix
sub-command is a new addition to Scala CLI. It allows to scan your project for using
directives and extract them into the project.scala
file placed in the project root directory.
This allows to easily fix warnings tied to having using
directives present in multiple files.
scala-cli fix . --power
Added by @MaciejG604 in #2309
Support for building static & shared libraries with Scala Native (experimental)
You can now use the --native-target
option to build Scala Native projects as static or shared libraries.
scala-cli package . --power --native-target static
scala-cli package . --power --native-target dynamic
Print platform version
Platform version is now always logged during compilation.
scala-cli compile .
# Compiling project (Scala 3.3.1, JVM (17))
# Compiled project (Scala 3.3.1, JVM (17))
scala-cli compile . --js
# Compiling project (Scala 3.3.1, Scala.js 1.13.2)
# Compiled project (Scala 3.3.1, Scala.js 1.13.2)
scala-cli compile . --native
# Compiling project (Scala 3.3.1, Scala Native 0.4.16)
# Compiled project (Scala 3.3.1, Scala Native 0.4.16)
Other changes
Enhancements
- Accumulate exp warnings with logger by @MaciejG604 in #2376
- Remove ComputeVersion.Command, make ComputeVersion classes positioned by @MaciejG604 in #2350
- Add more configuration for publish by @MaciejG604 in #2435
- Warn about transitive using file directive by @MaciejG604 in #2432
- Support Scala Native 0.5.x changes in publishing artifacts by @WojciechMazur in #2460
Fixes
- Fix - set es version into scala-js-cli by @lwronski in #2351
- Modify the format of StrictDirective.toString by @MaciejG604 in #2355
- Make explicitly passed scala version use the latest release, not the default one by @MaciejG604 in #2411
- Release flag by @lwronski in #2413
- Ensure build resolution is kept when packaging assemblies with provided dependencies by @Gedochao in #2457
- Fix
fmt
sub-command exit code to mirrorscalafmt
by @Gedochao in #2463 - Fix 'JVM too old' as bsp by @MaciejG604 in #2445
- Read java props from env vars by @MaciejG604 in #2356
- Make script wrapper satisfy compiler checks by @MaciejG604 in #2414
- Load local ivy path from ivy.home and user.home system properties by @JD557 in #2484
Documentation changes
- Fix typo in buildInfo directive docs by @izzyreal in #2357
- configuration.md examples "using dep" to current versions by @SunKing2 in #2398
- Documentation updates by @MaciejG604 in #2375
- Fix publish directives usage displayed in one line, unify directive docs by @MaciejG604 in #2381
- Backport of docs change (#2391) by @MaciejG604 in #2403
- Add internal docs for scalajs-cli by @lwronski in #2434
- Add docs for fix command by @MaciejG604 in #2437
- Add docs for offline mode by @MaciejG604 in #2475
- Update dependencies.md to mention jitpack by @doofin in #2458
- Update the list of external repositories Scala CLI depends on by @Gedochao in #2476
- Update the docs to no longer treat --power as a launcher-only option by @Gedochao in #2478
Build and internal changes
- Add test for actionable diagnostics from compiler by @MaciejG604 in #2327
- Pin the versions of Github CI runners by @MaciejG604 in #2370
- Remove bloop timeouts in tests by @MaciejG604 in #2407
- Add post-update hook for reference doc generation by @MaciejG604 in #2406
- Add tests which check availability of scalafmt native launcher for de… by @lwronski in #2418
- Default to a Scala version for REPL if there are no Scala artifacts. by @trilleplay in #2431
- Remove unused snippet checker by @lwronski in #2423
- Allow to override internal & user default Scala versions for
mill
builds by @Gedochao in #2461 - NIT: Refactor: Rely on global --power option where able in cli commands by @Gedochao in #2480
Updates and maintenance
- Update scala-cli.sh launcher for 1.0.4 by @github-actions in #2344
- Update bloop-rifle_2.13 to 1.5.9-sc-2 by @lwronski in #2345
- Update core_2.13 to 3.9.0 by @scala-steward in #2346
- Update sbt to 1.9.3 by @scala-steward in #2349
- Bump VirtusLab/scala-cli-setup from 1.0.2 to 1.0.4 by @dependabot in #2348
- Update coursier-jvm_2.13, ... to 2.1.6 by @scala-steward in #2360
- Update trees_2.13 to 4.8.9 by @scala-steward in #2369
- Update scalafmt-cli_2.13, scalafmt-core to 3.7.13 by @scala-steward in #2368
- Update bloop-rifle_2.13 to 1.5.11-sc-1 by @scala-steward in #2383
- Update org.eclipse.jgit to 6.6.1.202309021850-r by @scala-steward in #2384
- Update trees_2.13 to 4.8.10 by @scala-steward in #2387
- Update coursier-jvm_2.13, ... to 2.1.7 by @scala-steward in #2393
- Bump docker/login-action from 2 to 3 by @dependabot in #2400
- Update org.eclipse.jgit to 6.7.0.202309050840-r by @scala-steward in #2395
- Update scala3-library to 3.3.1 by @scala-steward in #2392
- Update slf4j-nop to 2.0.9 by @scala-steward in #2388
- Update file-tree-views to 2.1.11 by @scala-steward in #2410
- Update test-runner, tools to 0.4.15 by @scala-steward in #2385
- Update scala-library to 2.13.12 by @scala-steward in #2396
- Update scalafmt-cli_2.13, scalafmt-core to 3.7.14 by @scala-steward in #2386
- Update file-tree-views to 2.1.12 by @scala-steward in #2419
- Update bsp4j to 2.1.0-M6 by @scala-steward in #2401
- Update trees_2.13 to 4.8.11 by @scala-steward in #2429
- Update asm to 9.6 by @scala-steward in #2442
- Update bsp4j to 2.1.0-M7 by @scala-steward in #2438
- Update metaconfig-typesafe-config to 0.12.0 by @scala-steward in #2439
- Update ammonite to 3.0.0-M0-56-1bcbe7f6 by @scala-steward in #2440
- Bump Scala Native to 0.4.16 & log platform version by @Gedochao in ...