10 KiB
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 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 permission 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