sbt 1.10.0-RC2
Hi everyone. On behalf of the sbt project, I am happy to announce sbt 1.10.0-RC2. This is the tenth feature release of sbt 1.x, a binary compatible release focusing on new features. sbt 1.x is released under Semantic Versioning, and the plugins are expected to work throughout the 1.x series. Please try it out, and report any issues you might come across.
The headline features of sbt 1.10.0 are:
- SIP-51 Support for Scala 2.13 Evolution
- A wide range of Zinc fixes contributed by Jerry Tan and others
- CommandProgress API
- ConsistentAnalysisFormat: New Zinc Analysis serialization
How to upgrade
The sbt version used for your build is upgraded by putting the following in project/build.properties
:
sbt.version=1.10.0-RC2
This mechanism allows that sbt 1.10.0-RC2 is used only for the builds that you want.
Changes since sbt 1.10.0-RC1
- ConsistentAnalysisFormat is enabled by default.
- Updates to SIP-51 error message.
Changes with compatibility implications
- For SIP-51 support,
scalaVersion
can no longer be a lower 2.13.x version number than its transitive depdencies. See below for details. - Updates lm-coursier-shaded to 2.1.4, which brings in Coursier 2.1.9 #7513.
- Updates Jsch to mwiede/jsch fork by @azolotko in lm#436
- Updates the Scala version used by sbt 1.x to 2.12.19 by @SethTisue in #7516.
SIP-51 Support for Scala 2.13 Evolution
Modern Scala 2.x has kept both forward and backward binary compatibility so a library compiled using Scala 2.13.12 can be used by an application compiled with Scala 2.13.11 etc, and vice versa. The forward compatibility restricts Scala 2.x from evolving during the patch releases, so in SIP-51 Lukas Rytz at Lightbend Scala Team proposed:
I propose to drop the forwards binary compatibility requirement that build tools enforce on the Scala 2.13 standard library. This will allow implementing performance optimizations of collection operations that are currently not possible. It also unblocks adding new classes and new members to existing classes in the standard library.
Lukas has also contributed changes to sbt 1.10.0 to enforce stricter scalaVersion
. Starting sbt 1.10.0, when a Scala 2.13.x patch version newer than scalaVersion
is found, it will fail the build as follows:
sbt:foo> run
[error] stack trace is suppressed; run last scalaInstance for the full output
[error] (scalaInstance) expected `foo/scalaVersion` to be "2.13.10" or later,
[error] but found "2.13.5"; upgrade scalaVerion to fix the build.
[error]
[error] to support backwards-only binary compatibility (SIP-51),
[error] the Scala 2.13 compiler cannot be older than scala-library on the
[error] dependency classpath.
[error] see `foo/evicted` to know why scala-library 2.13.10 is getting pulled in.
When you see the error message like above, you can fix this by updating the Scala version to the suggested version (e.g. 2.13.10):
ThisBuild / scalaVersion := "2.13.10"
Side note: Old timers might know that sbt 0.13.0 also introduced the idea of scala-library as a normal dependency. This created various confusions as developers expected scalaVersion
, compiler version, and scala-library version as expected to align. With the hindsight, sbt 1.10.0 will continue to respect scalaVersion
to be the source-of-truth, but will reject bad ones at build time.
This was contributed by Lukas Rytz in #7480.
Zinc fixes
- Fixes macro undercompilation by invalidating macro call sites when a type parameter changes by @Friendseeker in zinc#1316
- Fixes macro undercompilation by invalidating macro source when its dependency changes by @dwijnand in zinc#1282
- Fixes SAM type undercompilation by @Friendseeker in zinc#1288
- Fixes infinite incremental loop when Scala and Java are involved by @Friendseeker in zinc#1312
- Fixes overcompilation on default parameter changes by @Friendseeker in zinc#1324
- Fixes
IncOptions.useOptimizedSealed
not working for Scala 2.13 by @Friendseeker in zinc#1278 - Includes extra invalidations in initial validation to fix initial compilation error by @Friendseeker in zinc#1284
- Refixes compact names without breaking local names by @dwijnand in zinc#1259
- Undoes Protobuf workaround for build to work on Apple Silicon by @Friendseeker in zinc#1277
- Uses
ClassTag
instead ofManifest
by @xuwei-k in zinc#1265 - Encodes parent trait private members in
extraHash
to propagateTraitPrivateMembersModified
across external dependency by @Friendseeker in zinc#1289 - Includes internal dependency in
extraHash
computation by @Friendseeker in zinc#1290 - Deletes products of previous analysis when dropping previous analysis by @Friendseeker in zinc#1293
- Uses the most up-to-date analysis for binary to source class name lookup by @Friendseeker in zinc#1287
- Fixes inconsistent Analysis by removing source stamp caching by @Friendseeker in zinc#1319
- Invalidate sources that depends on
@inline
methods in Scala 2.x by @Friendseeker in zinc#1310 - Fixes
-Xshow-phases
handling by @Friendseeker in zinc#1314
ConsistentAnalysisFormat: new Zinc Analysis serialization
sbt 1.10.0 adds a new Zinc serialization format that is faster and repeatable, unlike the current Protobuf-based serialization. Benchmark data based on scala-library + reflect + compiler:
Write time | Read time | File size | |
---|---|---|---|
sbt Text | 1002 ms | 791 ms | ~ 7102 kB |
sbt Binary | 654 ms | 277 ms | ~ 6182 kB |
ConsistentBinary | 157 ms | 100 ms | 3097 kB |
Since Zinc Analysis is internal to sbt, sbt 1.10.0 will enable this format by default. The following setting can be used to opt-out:
Global / enableConsistentCompileAnalysis := false
This was contributed by Stefan Zeiger at Databricks in zinc#1326.
New CommandProgress API
sbt 1.10.0 adds a new CommandProgress API.
This was contributed by Iulian Dragos at Gradle Inc in #7350.
Other updates
- JLine 3.24.1 and JAnsi 2.4.0 by @hvesalai in #7419
- Supports cross-build for external project ref by @RustedBones in #7389
- Avoids deprecated
java.net.URL
constructor by @xuwei-k in #7398 - Fixes bug of unmanagedResourceDirectories by @minkyu97 in #7178
- Fixes
updateSbtClassifiers
task by @azdrojowa123 in #7437 - Fixes
packageSrc
to includemanagedSources
by @Friendseeker in #7470 - Fixes publishing to use the publisher specified using the
publisher
setting by @Tammo0987 in #7475 - Fixes eviction warning message by avoid repeating versions by @rtyley in lm#433
- BSP: Implements
buildTarget/javacOptions
by @adpi2 in #7352 - BSP: Adds
noOp
field in the compile report by @adpi2 in #7496
Participation
sbt 1.10.0-RC2 was brought to you by 23 contributors and two good bots: Jerry Tan (friendseeker), Scala Steward, Eugene Yokota (eed3si9n), Kenji Yoshida (xuwei-k), Lukas Rytz, Adrien Piquerez, Iulian Dragos, Dale Wijnand, Domantas Petrauskas, dependabot[bot], Martin Duhem, Heikki Vesalainen, Aleksandra Zdrojowa, Matthias Kurz, Regis Kuckaertz, Seth Tisue, Stefan Zeiger, Alex Zolotko, Hagai Ovadia, Jakub Kozłowski, Michel Davit, Minkyu Lee, Philippus Baalman, Roberto Tyley, Tammo Steffens. Thanks!
Thanks to everyone who’s helped improve sbt and Zinc by using them, reporting bugs, improving our documentation, porting builds, porting plugins, and submitting and reviewing pull requests.
For anyone interested in helping sbt, there are many avenues for you to help, depending on your interest. If you’re interested, Contributing, “help wanted”, “good first issue”, and Discussions are good starting points.
Donate to Scala Center
Scala Center is a non-profit center at EPFL to support education and open source. Please consider donating to them, and publicly tweet/toot at @eed3si9n and @scala_lang when you do (I don’t work for them, but we maintain sbt together).