Releases: sbt/sbt
1.1.2
Fixes
- Fixes triggered execution's resource leak by caching the watch service. #3999 by @eatkins
- Fixes classloader inheriting the dependencies of Scala compiler during
runzinc#505 by @eed3si9n - Fixes forked test concurrency issue. #4030 by @eatkins
- Fixes
newcommand leaving behind target directory #4033 by @eed3si9n - Fixes handling on null Content-Type. lm214 by @staale
- Fixes null handling of
managedChecksumsinivySettingsfile. lm#218 by @IanGabes - Adds
sbt.boot.lockas a JVM property to opt-out of locking. #3927 by @dwijnand - Provides
SBT_GLOBAL_SERVER_DIRenv var as a workaround to long socket file path on UNIX. #3932 by @dwijnand - Fixes forked runs reporting noisy "Stream closed" exception. #3970 by @retronym
- Fixes test compilation not getting included in VS Code save trigger. #4022 by @tmiyamon
- Fixes sbt server responding with string id when number id passed. #4025 by @tiqwab
- Fixes
getDecoderin Analysis format zinc#502 by @jilen - Fixes equal / hashCode inconsistencies around Array. zinc#513 by @eed3si9n
- Whitelists
java9-rt-ext-outputin rt export process lp#211 by @eatkins - Fixes JDK version detection for Java 10 friendliness. lp#219 by @eed3si9n and @2m
- Fixes quoting in Windows bat file. lp#220 by @ForNeVeR
- Fixes
-errornot suppressing startup logs. #4036 by @eed3si9n
Improvements
- Performance optimization around logging. util#152 by @retronym
- Performance fix by caching the hashCode of
Configuration. lm#213 by @retronym - Returns error code
-33000Lon sbt server when a command fails. #3991 by @dwijnand - Allows wildcards in organization and artifact. #215 by @dhs3000
- Updates to latest Jsch to support stronger key exchange algorithms. lm#217 by @ryandbair
- Fixes preloading of compiler bridge. lp#222 by @analytically
Internal
- Updates contribution guide. #3960/#4019 by @eed3si9n and @itohiro73
- Deletes
buildinfo.BuildInfofrom sbt main that was intended for testing. 3967 by @dwijnand and @xuwei-k - Various improvements around Zinc benchmark by @retronym
Contributors
sbt 1.1.2 was brought to you by 23 contributors, according to git shortlog -sn --no-merges v1.1.1...v1.1.2 on sbt, zinc, librarymanagement, util, io, launcher-packege, and website: Dale Wijnand, Eugene Yokota, Jason Zaugg, Kenji Yoshida (xuwei-k), Ethan Atkins, Martijn Hoekstra, Martynas Mickevičius, Dennis Hörsch, Hosam Aly, Antonio Cunei, Friedrich von Never, Hiroshi Ito, Ian Gabes, Jilen Zhang, Mathias Bogaert, Naohisa Murakami (tiqwab), Philippus Baalman, Ryan Bair, Seth Tisue, Ståle Undheim, Takuya Miyamoto (tmiyamon), Yasuhiro Tatsuno. Thank you!
1.1.1
Fixes
- Fixes "Modified names for (class) is empty" error. zinc#292 / zinc#484 by @jvican
- Fixes tab completion in
consolewhile running in batch mode assbt console. #3841/#3876 by @eed3si9n - Fixes file timestamp retrieval of missing files on Windows. #3871 / io#120 by @cunei
- Aligns the errors thrown by file timestamp implementations. Fixes #3894 / io#121 by @j-keck
- Adds file timestamps native support for FreeBSD. #3894 / io#124 by @cunei
- Fixes JDK 10 version string parsing. sbt/sbt-launcher-package#209 by @2m
Improvements
- Deprecates
Extracted#appendin favour ofappendWithSessionorappendWithoutSession. #3865 by @dwijnand - Adds a new global
Booleansetting calledautoStartServer. See below. - Upgrades Scala versions used for sbt cross building
^^. #3923 by @dwijnand - Many documentation maintenance changes by @xuwei-k
autoStartServer setting
sbt 1.1.1 adds a new global Boolean setting called autoStartServer, which is set to true by default.
When set to true, sbt shell will automatically start sbt server. Otherwise, it will not start the server until startSever command is issued. This could be used to opt out of server for security reasons.
0.13.17
Improvements
Bug fixes
- Backports logging and
cleanconcurrency fix. #2156/#3834 by @dwijnand - Fixes over-compilation on Java 9
scala.ext.dir. #3142/#3701 by @retronym - Fixes
addSbtPluginto use the correct version of sbt. #3393/#3397 by @dwijnand - Changes the tuple enrichment deprecation warning messages. #3455 by @olafurpg
- Fixes
addCompilerPlugin(...)so it can consume compiler plugins published to Ivy repository using sbt 1.x. #3784/#3855 by @eed3si9n
Internal
1.1.0
Lightbend Tooling team is happy to announce sbt 1.1.0. This is the first feature release of sbt 1, a binary compatible release focusing on new features.
sbt 1 is released under Semantic Versioning, and the plugins are expected to work for sbt 1.x series.
The headline features of sbt 1.1 are unified slash syntax and sbt server. They are both features that I have been involved in for a while, but ultimately had to postpone for sbt 1.0. This makes it all the more exciting to see these finally come out.
Unified slash syntax of setting keys
As a user of sbt, I've long thought having different notations for setting/task keys, one for sbt shell and another for build.sbt made the tool harder to learn. After lots of discussions with the community, and a few prototypes, sbt 1.1.0 will support unified slash syntax (the sbt 0.13 notations will continue to work, so don't worry).
Both in build.sbt and in sbt shell, the settings can be written like this, scope axis delimited by slashes:
ref / Config / intask / key
In the above, ref typically is subproject name or ThisBuild, and Config is the Scala identifier for configurations such as Compile and Test. Each axis might be omitted and can also be substituted with a special Zero value, so it's actually:
((ref | "Zero") "/") ((Config | "Zero") "/") ((intask | "Zero") "/") key
For example, in sbt 0.13:
- to compile just the
Testconfiguration, in sbt 0.13 you'd write(compile in Test).valueinbuild.sbtandtest:compilein the sbt shell. cancelablesetting at theGloballevel is written as(cancelable in Global).valueinbuild.sbtand*/*:cancelablein the sbt shell.
In sbt 1.1.0:
compiletask scoped toTestis written as(Test / compile).valueinbuild.sbt, andTest / compilein the sbt shell.cancelablesetting scoped toGlobalis written as(Global / cancelable).valueinbuild.sbtandGlobal / cancelablein the sbt shell.
For more details, see Migrating to slash syntax and Scopes docs.
Note: One caveat to the plugin authors is that if you use the new syntax in your plugin it will push the minimum required sbt version to 1.1.0-RC for your users.
[#1812][1812]/[#3434][3434]/[#3617][3617]/[#3620][3620] by [@eed3si9n][@eed3si9n] and [@dwijnand][@dwijnand]
sbt server
When people hear the name "sbt server", they might imagine it to be something that runs on remote servers, and does great things. But, sbt server is not that for now. Instead, sbt server adds network access to the sbt shell. The primary use case we have in mind is local coordination between IDEs and sbt. sbt 1.1 reworked this feature to use Language Server Protocol 3.0 (LSP) as the wire protocol, a protocol created by Microsoft originally for Visual Studio Code.
Not just Visual Studio Code, but there are LSP clients available for most modern editors and IDEs such as IntelliJ, Eclipse, Sublime Text 3, NeoVim, Emacs, and Atom. On the provider side, there are language servers available for Go, Python, Haskell etc. Because sbt is able to compile, test, package, and deploy your code, these various tasks can potentially be integrated with the frontend.
To discover a running server, sbt 1.1 creates a port file at ./project/target/active.json relative to a build:
{"uri":"local:///Users/foo/.sbt/1.0/server/0845deda85cb41abcdef/sock"}
local: indicates a UNIX domain socket. Here's how we can say hello to the server using nc. (^M can be sent Ctrl-V then Return):
$ nc -U /Users/foo/.sbt/1.0/server/0845deda85cb41abcdef/sock
Content-Length: 99^M
^M
{ "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "initializationOptions": { } } }^M
Here's how we can call compile:
Content-Length: 93^M
^M
{ "jsonrpc": "2.0", "id": 2, "method": "sbt/exec", "params": { "commandLine": "compile" } }^M
The running sbt session should now queue compile, and return back with compiler warnings and errors, if any:
Content-Length: 296
Content-Type: application/vscode-jsonrpc; charset=utf-8
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:/Users/foo/work/hellotest/Hello.scala","diagnostics":[{"range":{"start":{"line":2,"character":26},"end":{"line":2,"character":27}},"severity":1,"source":"sbt","message":"object X is not a member of package foo"}]}}
This allows multiple clients to connect to a single session of sbt. For more details, see sbt server docs.
[#3524][3524]/[#3556][3556] by [@eed3si9n][@eed3si9n]
VS Code extension
As a proof of concept for editor integration, we created a Visual Studio Code extension called [Scala (sbt)][vscode-sbt-scala]. To try it out, install Visual Studio Code, search for "Scala (sbt)" in Extensions tab, run sbt 1.1.0 on some project, and open it using VS Code.
Currently this extension is able to:
- Run
compileat the root project when*.scalafiles are saved. [#3524][3524] by Eugene Yokota ([@eed3si9n][@eed3si9n]) - Display compiler errors.
- Display log messages. [#3740][3740] by Alexey Alekhin ([@laughedelic][@laughedelic])
- Jump to class definitions. [#3660][3660] by Wiesław Popielarski at VirtusLab ([@wpopielarski][@wpopielarski])
Sublime Text 3 integration
Using LSP plugin, Sublime Text 3 can also be setup with the same feature. See sbt server with Sublime Text 3:
Also Neovim too. I think you get the idea here.
Other bug fixes and improvements
- Fixes
ClasspathFilterthat was causingClass.forNameto not work inrun. zinc#473 / #3736 / #3733 / #3647 / #3608 by [@ravwojdyla][@ravwojdyla] - Fixes Java compilation causing
NullPointerExceptionby making PositionImpl thread-safe. zinc#465 by [@eed3si9n][@eed3si9n] - Fixes
PollingWatchServiceby preventing concurrent modification ofkeysWithEventsmap. io#90 by [@mechkg][@mechkg], which fixes~related issues #3687, #3695, and #3775. - Provides workaround for
File#lastModified()losing millisecond-precision by using native code when possible. io#92/io#106 by [@cunei][@cunei] - Fixes
IO.relativizenot working with relative path. io#108 by [@dwijnand][@dwijnand] - Fixes warning message when multiple instances are detected. #3828 by [@eed3si9n][@eed3si9n]
- Changes
versionsetting default to0.1.0-SNAPSHOTfor compatibility with Semantic Versioning. [#3577][3577] by [@laughedelic][@laughedelic] - Fixes over-compilation bug with Java 9. [zinc#450][zinc450] by [@retronym][@retronym]
- Fixes handling of deeply nested Java classes. [zinc#423][zinc423] by [@romanowski][@romanowski]
- Fixes JavaDoc not printing all errors. [zinc#415][zinc415] by [@raboof][@raboof]
- Preserves JAR order in
ScalaInstance.otherJars. [zinc#411][zinc411] by [@dwijnand][@dwijnand] - Fixes used name when it contains NL. [zinc#449][zinc449] by [@jilen][@jilen]
- Fixes handling of
ThisProject. [#3609][3609] by [@dwijnand][@dwijnand] - Escapes imports from sbt files, so if user creates a backquoted definition then task evalution will not fail. [#3635][3635] by [@PanAeon][@PanAeon]
- Removes reference to version 0.14.0 from a warning message. [#3693][3693] by [@saniyatech][@saniyatech]
- Fixes screpl throwing "Not a valid key: console-quick". [#3762][3762] by [@xuwei-k][@xuwei-k]
- Filters scripted tests based on optional
project/build.properties. [#3564][3564]/[#3566][3566] by [@jonas][@jonas] - Adds
Project#withIdto change a project's id. [#3601][3601] by [@dwijnand][@dwijnand] - Adds
reboot devcommand, which deletes the current artifact from the boot directory. This is useful when working with development versions of sbt. [#3659][3659] by [@eed3si9n][@eed3si9n] - Adds a check for a change in sbt version before
reload. [#1055][1055]/[#3673][3673] by [@RomanIakovlev][@RomanIakovlev] - Adds a new setting
insideCI, which indicates that sbt is likely running in an Continuous Integration environment. [#3672][3672] by [@RomanIakovlev][@RomanIakovlev] - Adds
nameOptiontoCommandtrait. [#3671][3671] by [@miklos-martin][@miklos-martin] - Adds POSIX persmission operations in IO, such as
IO.chmod(..). [io#76][io76] by [@eed3si9n][@eed3si9n] - Treat sbt 1 modules using Semantic Versioning in the eviction warning. [lm#188][lm188] by [@eed3si9n][@eed3si9n]
- Uses kind-projector in the code. [#3650][3650] by [@dwijnand][@dwijnand]
- Make
displayOnlyetc methods strict inCompletions. [#3763][3763] by [@xuwei-k][@xuwei-k] - Restores Scala 2.13.0-M1 support. sbt/zinc#461 by [@dwijnand][@dwijnand]
Participation
Thanks again to everyone who's helped improve sbt and Zinc 1 by using them, reporting bugs, improving our documentation, porting ...
0.13.17-RC1
Improvements
Bug fixes
- Backports logging and
cleanconcurrency fix. #2156/#3834 by @dwijnand - Fixes over-compilation on Java 9
scala.ext.dir. #3142/#3701 by @retronym - Fixes
addSbtPluginto use the correct version of sbt. #3393/#3397 by @dwijnand - Changes the tuple enrichment deprecation warning messages. #3455 by @olafurpg
Internal
1.1.0-RC4
Changes since RC-2
- Provides workaround for
File#lastModified()losing millisecond-precision by using native code when possible. io#92/io#106 by @cunei - Fixes
IO.relativizenot working with relative path. io#108 by @dwijnand - Fixes
ClasspathFilterthat was causingClass.forNameto not work inrun. zinc#473 / #3736 / #3733 / #3647 / #3608 by @ravwojdyla - Fixes JNA version mixup. #3837 by @eed3si9n
- Fixes warning message when multiple instances are detected. #3828 by @eed3si9n
Changes since RC-1
- Fixes Java compilation causing
NullPointerExceptionby making PositionImpl thread-safe. zinc#465 by @eed3si9n - Restores Scala 2.13.0-M1 support. #461 by @dwijnand
- Fixes
PollingWatchServiceby preventing concurrent modification ofkeysWithEventsmap. io#90 by @mechkg, which fixes~related issues #3687, #3695, and #3775. - Fixed server spewing out debug level logs. #3791 by @eed3si9n
- Fixes the encoding of Unix-like file path to use
file:///. #3805 by @eed3si9n - Fixes Log4J2 initialization error during startup. #3814 by @dwijnand
Features, fixes, changes with compatibility implications
- sbt server feature is reworked in sbt 1.1.0. See below.
- Changes
versionsetting default to0.1.0-SNAPSHOTfor compatibility with Semantic Versioning. #3577 by @laughedelic
Features
- Unifies sbt shell and build.sbt syntax. See below.
Fixes
- Fixes over-compilation bug with Java 9. [zinc#450][zinc450] by @retronym
- Fixes handling of deeply nested Java classes. [zinc#423][zinc423] by @romanowski
- Fixes JavaDoc not printing all errors. [zinc#415][zinc415] by @raboof
- Preserves JAR order in
ScalaInstance.otherJars. [zinc#411][zinc411] by @dwijnand - Fixes used name when it contains NL. [zinc#449][zinc449] by @jilen
- Fixes handling of
ThisProject. #3609 by @dwijnand - Escapes imports from sbt files, so if user creates a backquoted definition then task evalution will not fail. #3635 by @panaeon
- Removes reference to version 0.14.0 from a warning message. [#3693][3693] by @saniyatech
- Fixes screpl throwing "Not a valid key: console-quick". [#3762][3762] by @xuwei-k
Improvements
- Filters scripted tests based on optional
project/build.properties. See below. - Adds
Project#withIdto change a project's id. #3601 by @dwijnand - Adds
reboot devcommand, which deletes the current artifact from the boot directory. This is useful when working with development versions of sbt. #3659 by @eed3si9n - Adds a check for a change in sbt version before
reload. [#1055][1055]/#3673 by @RomanIakovlev - Adds a new setting
insideCI, which indicates that sbt is likely running in an Continuous Integration environment. [#3672][3672] by @RomanIakovlev - Adds
nameOptiontoCommandtrait. [#3671][3671] by @miklos-martin - Adds POSIX persmission operations in IO, such as
IO.chmod(..). [io#76][io76] by @eed3si9n - Treat sbt 1 modules using Semantic Versioning in the eviction warning. [lm#188][lm188] by @eed3si9n
- Uses kind-projector in the code. #3650 by @dwijnand
- Make
displayOnlyetc methods strict inCompletions. [#3763][3763] by @xuwei-k
Unified slash syntax for sbt shell and build.sbt
This adds unified slash syntax for both sbt shell and the build.sbt DSL.
Instead of the current <project-id>/config:intask::key, this adds
<project-id>/<config-ident>/intask/key where <config-ident> is the Scala identifier
notation for the configurations like Compile and Test. (The old shell syntax will continue to function)
These examples work both from the shell and in build.sbt.
Global / cancelable
ThisBuild / scalaVersion
Test / test
root / Compile / compile / scalacOptions
ProjectRef(uri("file:/xxx/helloworld/"),"root")/Compile/scalacOptions
Zero / Zero / name
The inspect command now outputs something that can be copy-pasted:
> inspect compile
[info] Task: sbt.inc.Analysis
[info] Description:
[info] Compiles sources.
[info] Provided by:
[info] ProjectRef(uri("file:/xxx/helloworld/"),"root")/Compile/compile
[info] Defined at:
[info] (sbt.Defaults) Defaults.scala:326
[info] Dependencies:
[info] Compile/manipulateBytecode
[info] Compile/incCompileSetup
....
#1812/#3434/#3617/#3620 by @eed3si9n and @dwijnand
sbt server
sbt server feature was reworked to use Language Server Protocol 3.0 (LSP) as the wire protocol, a protocol created by Microsoft for Visual Studio Code.
To discover a running server, sbt 1.1.0 creates a port file at ./project/target/active.json relative to a build:
{"uri":"local:///Users/foo/.sbt/1.0/server/0845deda85cb41abcdef/sock"}
local: indicates a UNIX domain socket. Here's how we can say hello to the server using nc. (^M can be sent Ctrl-V then Return):
$ nc -U /Users/foo/.sbt/1.0/server/0845deda85cb41abcdef/sock
Content-Length: 99^M
^M
{ "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "initializationOptions": { } } }^M
sbt server adds network access to sbt's shell command so, in addition to accepting input from the terminal, server also to accepts input from the network. Here's how we can call compile:
Content-Length: 93^M
^M
{ "jsonrpc": "2.0", "id": 2, "method": "sbt/exec", "params": { "commandLine": "compile" } }^M
The running sbt session should now queue compile, and return back with compiler warnings and errors, if any:
Content-Length: 296
Content-Type: application/vscode-jsonrpc; charset=utf-8
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:/Users/foo/work/hellotest/Hello.scala","diagnostics":[{"range":{"start":{"line":2,"character":26},"end":{"line":2,"character":27}},"severity":1,"source":"sbt","message":"object X is not a member of package foo"}]}}
VS Code extension
The primary use case we have in mind for the sbt server is tooling integration such as editors and IDEs. As a proof of concept, we created a Visual Studio Code extension called Scala (sbt).
Currently this extension is able to:
- Run
compileat the root project when*.scalafiles are saved. #3524 by @eed3si9n - Display compiler errors.
- Display log messages. [#3740][3740] by @laughedelic
- Jump to class definitions. [#3660][3660] by @wpopielarski
Filtering scripted tests using project/build.properties
For all scripted tests in which project/build.properties exist, the value of the sbt.version property is read. If its binary version is different from sbtBinaryVersion in pluginCrossBuild the test will be skipped and a message indicating this will be logged.
This allows you to define scripted tests that track the minimum supported sbt versions, e.g. 0.13.9 and 1.0.0-RC2. #3564/#3566 by @jonas
v1.1.0-RC3
1.1.0-RC3
1.1.0-RC2
Changes since RC-1
- Fixes Java compilation causing
NullPointerExceptionby making PositionImpl thread-safe. zinc#465 by @eed3si9n - Restores Scala 2.13.0-M1 support. #461 by @dwijnand
- Fixes
PollingWatchServiceby preventing concurrent modification ofkeysWithEventsmap. io#90 by @mechkg, which fixes~related issues #3687, #3695, and #3775. - Fixed server spewing out debug level logs. #3791 by @eed3si9n
- Fixes the encoding of Unix-like file path to use
file:///. #3805 by @eed3si9n - Fixes Log4J2 initialization error during startup. #3814 by @dwijnand
- Provides workaround for
File#lastModified()losing millisecond-precision by using native code when possible. io#92 by @cunei
Features, fixes, changes with compatibility implications
- sbt server feature is reworked in sbt 1.1.0. See below.
- Changes
versionsetting default to0.1.0-SNAPSHOTfor compatibility with Semantic Versioning. #3577 by @laughedelic
Features
- Unifies sbt shell and build.sbt syntax. See below.
Fixes
- Fixes over-compilation bug with Java 9. zinc#450 by @retronym
- Fixes handling of deeply nested Java classes. zinc#423 by @romanowski
- Fixes JavaDoc not printing all errors. zinc#415 by @raboof
- Preserves JAR order in
ScalaInstance.otherJars. zinc#411 by @dwijnand - Fixes used name when it contains NL. zinc#449 by @jilen
- Fixes handling of
ThisProject. #3609 by @dwijnand - Escapes imports from sbt files, so if user creates a backquoted definition then task evalution will not fail. #3635 by @panaeon
- Removes reference to version 0.14.0 from a warning message. #3693 by @saniyatech
- Fixes screpl throwing "Not a valid key: console-quick". #3762 by @xuwei-k
Improvements
- Filters scripted tests based on optional
project/build.properties. See below. - Adds
Project#withIdto change a project's id. #3601 by @dwijnand - Adds
reboot devcommand, which deletes the current artifact from the boot directory. This is useful when working with development versions of sbt. #3659 by @eed3si9n - Adds a check for a change in sbt version before
reload. #1055/#3673 by @RomanIakovlev - Adds a new setting
insideCI, which indicates that sbt is likely running in an Continuous Integration environment. #3672 by @RomanIakovlev - Adds
nameOptiontoCommandtrait. #3671 by @miklos-martin - Adds POSIX persmission operations in IO, such as
IO.chmod(..). io#76 by @eed3si9n - Treat sbt 1 modules using Semantic Versioning in the eviction warning. lm#188 by @eed3si9n
- Uses kind-projector in the code. #3650 by @dwijnand
- Make
displayOnlyetc methods strict inCompletions. #3763 by @xuwei-k
Unified slash syntax for sbt shell and build.sbt
This adds unified slash syntax for both sbt shell and the build.sbt DSL.
Instead of the current <project-id>/config:intask::key, this adds
<project-id>/<config-ident>/intask/key where <config-ident> is the Scala identifier
notation for the configurations like Compile and Test. (The old shell syntax will continue to function)
These examples work both from the shell and in build.sbt.
Global / cancelable
ThisBuild / scalaVersion
Test / test
root / Compile / compile / scalacOptions
ProjectRef(uri("file:/xxx/helloworld/"),"root")/Compile/scalacOptions
Zero / Zero / name
The inspect command now outputs something that can be copy-pasted:
> inspect compile
[info] Task: sbt.inc.Analysis
[info] Description:
[info] Compiles sources.
[info] Provided by:
[info] ProjectRef(uri("file:/xxx/helloworld/"),"root")/Compile/compile
[info] Defined at:
[info] (sbt.Defaults) Defaults.scala:326
[info] Dependencies:
[info] Compile/manipulateBytecode
[info] Compile/incCompileSetup
....
#1812/#3434/#3617/#3620 by @eed3si9n and @dwijnand
sbt server
sbt server feature was reworked to use Language Server Protocol 3.0 (LSP) as the wire protocol, a protocol created by Microsoft for Visual Studio Code.
To discover a running server, sbt 1.1.0 creates a port file at ./project/target/active.json relative to a build:
{"uri":"local:///Users/foo/.sbt/1.0/server/0845deda85cb41abcdef/sock"}
local: indicates a UNIX domain socket. Here's how we can say hello to the server using nc. (^M can be sent Ctrl-V then Return):
$ nc -U /Users/foo/.sbt/1.0/server/0845deda85cb41abcdef/sock
Content-Length: 99^M
^M
{ "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "initializationOptions": { } } }^M
sbt server adds network access to sbt's shell command so, in addition to accepting input from the terminal, server also to accepts input from the network. Here's how we can call compile:
Content-Length: 93^M
^M
{ "jsonrpc": "2.0", "id": 2, "method": "sbt/exec", "params": { "commandLine": "compile" } }^M
The running sbt session should now queue compile, and return back with compiler warnings and errors, if any:
Content-Length: 296
Content-Type: application/vscode-jsonrpc; charset=utf-8
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:/Users/foo/work/hellotest/Hello.scala","diagnostics":[{"range":{"start":{"line":2,"character":26},"end":{"line":2,"character":27}},"severity":1,"source":"sbt","message":"object X is not a member of package foo"}]}}
VS Code extension
The primary use case we have in mind for the sbt server is tooling integration such as editors and IDEs. As a proof of concept, we created a Visual Studio Code extension called Scala (sbt).
Currently this extension is able to:
- Run
compileat the root project when*.scalafiles are saved. #3524 by @eed3si9n - Display compiler errors.
- Display log messages. #3740 by @laughedelic
- Jump to class definitions. #3660 by @wpopielarski
Filtering scripted tests using project/build.properties
For all scripted tests in which project/build.properties exist, the value of the sbt.version property is read. If its binary version is different from sbtBinaryVersion in pluginCrossBuild the test will be skipped and a message indicating this will be logged.
This allows you to define scripted tests that track the minimum supported sbt versions, e.g. 0.13.9 and 1.0.0-RC2. #3564/#3566 by @jonas
1.1.0-RC1
Features, fixes, changes with compatibility implications
- sbt server feature is reworked in sbt 1.1.0. See below.
- Changes
versionsetting default to0.1.0-SNAPSHOTfor compatibility with Semantic Versioning. #3577 by @laughedelic
Features
- Unifies sbt shell and build.sbt syntax. See below.
Fixes
- Fixes over-compilation bug with Java 9. zinc#450 by @retronym
- Fixes handling of deeply nested Java classes. zinc#423 by @romanowski
- Fixes JavaDoc not printing all errors. zinc#415 by @raboof
- Preserves JAR order in
ScalaInstance.otherJars. zinc#411 by @dwijnand - Fixes used name when it contains NL. zinc#449 by @jilen
- Fixes handling of
ThisProject. #3609 by @dwijnand - Escapes imports from sbt files, so if user creates a backquoted definition then task evalution will not fail. #3635 by @panaeon
- Removes reference to version 0.14.0 from a warning message. #3693 by @saniyatech
- Fixes screpl throwing "Not a valid key: console-quick". #3762 by @xuwei-k
Improvements
- Filters scripted tests based on optional
project/build.properties. See below. - Adds
Project#withIdto change a project's id. #3601 by @dwijnand - Adds
reboot devcommand, which deletes the current artifact from the boot directory. This is useful when working with development versions of sbt. #3659 by @eed3si9n - Adds a check for a change in sbt version before
reload. #1055/#3673 by @RomanIakovlev - Adds a new setting
insideCI, which indicates that sbt is likely running in an Continuous Integration environment. #3672 by @RomanIakovlev - Adds
nameOptiontoCommandtrait. #3671 by @miklos-martin - Adds POSIX persmission operations in IO, such as
IO.chmod(..). io#76 by @eed3si9n - Treat sbt 1 modules using Semantic Versioning in the eviction warning. lm#188 by @eed3si9n
- Uses kind-projector in the code. #3650 by @dwijnand
- Make
displayOnlyetc methods strict inCompletions. #3763 by @xuwei-k
Unified slash syntax for sbt shell and build.sbt
This adds unified slash syntax for both sbt shell and the build.sbt DSL.
Instead of the current <project-id>/config:intask::key, this adds
<project-id>/<config-ident>/intask/key where <config-ident> is the Scala identifier
notation for the configurations like Compile and Test. (The old shell syntax will continue to function)
These examples work both from the shell and in build.sbt.
Global / cancelable
ThisBuild / scalaVersion
Test / test
root / Compile / compile / scalacOptions
ProjectRef(uri("file:/xxx/helloworld/"),"root")/Compile/scalacOptions
Zero / Zero / name
The inspect command now outputs something that can be copy-pasted:
> inspect compile
[info] Task: sbt.inc.Analysis
[info] Description:
[info] Compiles sources.
[info] Provided by:
[info] ProjectRef(uri("file:/xxx/helloworld/"),"root")/Compile/compile
[info] Defined at:
[info] (sbt.Defaults) Defaults.scala:326
[info] Dependencies:
[info] Compile/manipulateBytecode
[info] Compile/incCompileSetup
....
#1812/#3434/#3617/#3620 by @eed3si9n and @dwijnand
sbt server
sbt server feature was reworked to use Language Server Protocol 3.0 (LSP) as the wire protocol, a protocol created by Microsoft for Visual Studio Code.
To discover a running server, sbt 1.1.0 creates a port file at ./project/target/active.json relative to a build:
{"uri":"local:///Users/foo/.sbt/1.0/server/0845deda85cb41abcdef/sock"}
local: indicates a UNIX domain socket. Here's how we can say hello to the server using nc. (^M can be sent Ctrl-V then Return):
$ nc -U /Users/foo/.sbt/1.0/server/0845deda85cb41abcdef/sock
Content-Length: 99^M
^M
{ "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "initializationOptions": { } } }^M
sbt server adds network access to sbt's shell command so, in addition to accepting input from the terminal, server also to accepts input from the network. Here's how we can call compile:
Content-Length: 93^M
^M
{ "jsonrpc": "2.0", "id": 2, "method": "sbt/exec", "params": { "commandLine": "compile" } }^M
The running sbt session should now queue compile, and return back with compiler warnings and errors, if any:
Content-Length: 296
Content-Type: application/vscode-jsonrpc; charset=utf-8
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:/Users/foo/work/hellotest/Hello.scala","diagnostics":[{"range":{"start":{"line":2,"character":26},"end":{"line":2,"character":27}},"severity":1,"source":"sbt","message":"object X is not a member of package foo"}]}}
VS Code extension
The primary use case we have in mind for the sbt server is tooling integration such as editors and IDEs. As a proof of concept, we created a Visual Studio Code extension called Scala (sbt).
Currently this extension is able to:
- Run
compileat the root project when*.scalafiles are saved. #3524 by @eed3si9n - Display compiler errors.
- Display log messages. #3740 by @laughedelic
- Jump to class definitions. #3660 by @wpopielarski
Filtering scripted tests using project/build.properties
For all scripted tests in which project/build.properties exist, the value of the sbt.version property is read. If its binary version is different from sbtBinaryVersion in pluginCrossBuild the test will be skipped and a message indicating this will be logged.
This allows you to define scripted tests that track the minimum supported sbt versions, e.g. 0.13.9 and 1.0.0-RC2. #3564/#3566 by @jonas
1.0.4
This is a hotfix release for sbt 1.0.x series.
Bug fixes
- Fixes undercompilation of value classes when the underlying type changes. zinc#444 by @smarter
- Fixes
ArrayIndexOutOfBoundsExceptionon Ivy when running on Java 9. ivy#27 by @xuwei-k - Fixes Java 9 warning by upgrading to launcher 1.0.2. ivy#26/launcher#45 by @dwijnand
- Fixes
-jvm-debugon Java 9. launcher-package197 by @mkurz - Fixes
runoutputing debug level logs. #3655/#3717 by @cunei - Fixes performance regression caused by classpath hashing. zinc#452 by @jvican, @fommil provided reproduction, and @eed3si9n fixed sbt/zinc#457
- Fixes performance regression of
testQuick. #3680/#3720 by @OlegYch - Disables Ivy log4j caller location calculation for performance regression reported in #3711. util#132 by @leonardehrenfried
- Works around Scala compiler's
templateStats()not being thread-safe. #3743 by @cunei - Fixes "Attempting to overwrite" error message. lm#174 by @dwijnand
- Fixes incorrect eviction warning message. lm#179 by @xuwei-k
- Registers Ivy protocol only for
http:andhttps:to be more plugin friendly. lm183 by @tpunder - Fixes script issues related to
bcby usingexpr. launcher-package#199 by @thatfulvioguy
Enhancement
Internal
Contributors
A huge thank you to everyone who's helped improve sbt and Zinc 1 by using them, reporting bugs, improving our documentation, porting builds, porting plugins, and submitting and reviewing pull requests.
This release was brought to you by 17 contributors, according to git shortlog -sn --no-merges v1.0.3..v1.0.4 on sbt, zinc, librarymanagement, util, io, and website: Eugene Yokota, Kenji Yoshida (xuwei-k), Jorge Vicente Cantero (jvican), Dale Wijnand, Leonard Ehrenfried, Antonio Cunei, Brett Randall, Guillaume Martres, Arnout Engelen, Fulvio Valente, Jens Grassel, Matthias Kurz, OlegYch, Philippus Baalman, Sam Halliday, Tim Underwood, Tom Most. Thank you!