sbt new not echoing back the characters #5954 by @eatkins
dependencyBrowseTree etc #5967 by @naderghanbari
classes directory causing “classes does not exist” error zinc#934 by @eed3si9n
ClassfileManager output #5990 by @smarter
Ctrl-C and Ctrl-D handling #5947/#5975 by @eatkins
-Dsbt.color=true not working in some situation #5960 by @eatkins
FileAlreadyExistsException when project/target is a symbolic link #5972 by @eatkins
build.sbt and --batch #5945 by @eatkins
.inputrc file support #5973 by @xuwei-k
MatchError #5948 by @adpi2
shellPrompt and release* keys warning on build linting #5983/#5991 by @xirc and @eed3si9n
<task>.value macro causing spurious “a pure expression does nothing” warning #5981 by @eed3si9n
plugins command output by grouping by subproject #5932 by @aaabramov
The headline features of sbt 1.4.0 are:
ThisBuild / versionScheme to take the guessing out of eviction warning
sbt 1.4.0 adds build server protocol (BSP) support, contributed by Scala Center. Main implementation was done by Adrien Piquerez (@adpi2) based on @eed3si9n’s prototype.
When sbt 1.4.0 starts, it will create a file named .bsp/sbt.json containing a machine-readable instruction on how to run sbt -bsp, which is a command line program that uses standard input and output to communicate to sbt server using build server protocol.
.bsp, .metals, .bloop directories if any
sbt -Dsbt.semanticdb=true in the Terminal tab. Wait till it displays “sbt server started”
compile into the sbt session to generate SemanticDB files
sbt 1.4.0 adds an official native thin client called sbtn that supports all tasks. If you’re using the official sbt launcher 1.4.0 and not the knockoff kind you can use --client option to run the native thin client:
$ sbt --client compile
$ sbt --client shutdown
The native thin client will run sbt (server) as a daemon, which avoids the JVM spinup and loading time for the second call onwards. This could be an option if you would like to use sbt from the system shell such as Zsh and Fish.
Remember to call sbt --client shutdown when you’re done! If you want to enable this via an environment variable you can set SBT_NATIVE_CLIENT to true.
sbtn binary files are also available from https://github.com/sbt/sbtn-dist/releases/tag/v1.4.0
sbt 1.4.0 adds a new setting called ThisBuild / versionScheme to track version scheme of the build:
ThisBuild / versionScheme := Some("early-semver")
The supported values are "early-semver", "pvp", and "semver-spec". sbt will include this information into pom.xml and ivy.xml as a property. In addition, sbt 1.4.0 will use the information to take the guessing out of eviction warning when this information is available. #5724 by @eed3si9n
sbt 1.4.0 / Zinc 1.4.0 virtualizes the file paths tracked during incremental compilation. The benefit for this that the state of incremental compilation can shared across different machines, as long as ThisBuild / rootPaths are enumerated beforehand.
To demonstrate this, we’ve also added experimental cached compilation feature to sbt. All you need is the following setting:
ThisBuild / pushRemoteCacheTo := Some(MavenCache("local-cache", file("/tmp/remote-cache")))
Then from machine 1, call pushRemoteCache. This will publish the *.class and Zinc Analysis artifacts to the location. Next, from machine 2, call pullRemoteCache.
On start up, sbt 1.4.0 checks for unused settings/tasks. Because most settings are on the intermediary to other settings/tasks, they are included into the linting by default. The notable exceptions are settings used exclusively by a command. To opt-out, you can either append it to Global / excludeLintKeys or set the rank to invisible.
sbt 1.4.0 adds support for conditional task (or Selective task), which is a new kind of task automatically created when Def.task { ... } consists of an if-expression:
bar := {
if (number.value < 0) negAction.value
else if (number.value == 0) zeroAction.value
else posAction.value
}
Unlike the regular (Applicative) task composition, conditional tasks delays the evaluation of then-clause and else-clause as naturally expected of an if-expression. This is already possible with Def.taskDyn { ... }, but unlike dynamic tasks, conditional task works with inspect command. See Selective functor for sbt for more details. #5558 by @eed3si9n
sbt 1.4.0 adds experimental incremental build pipelining. To enable build pipelining for the build:
ThisBuild / usePipelining := true
To opt-out of creating an early output for some of the subprojects:
exportPipelining := false
sbt 1.4.0 brings in Johannes Rudolph’s sbt-dependency-graph plugin into the code base.
Since it injects many tasks per subprojects, the plugin is split into two parts:
- MiniDependencyTreePlugin that is enabled by default, bringing in dependencyTree task to Compile and Test configurations
- Full strength DependencyTreePlugin that is enabled by putting the following to project/plugins.sbt:
addDependencyTreePlugin
ThisBuild / useLog4J := true to use Log4j. #5731 by @eatkins
vals from top-to-bottom within a build file #2232/#5448 by @eed3si9n
.withAllowInsecureProtocol(true) #5593 by @eed3si9n
~ returns to the shell instead of shutting down sbt #5804 by @eatkins
/ without -Dsbt.rootdir=true #5112 by @eed3si9n
StateTransform to accept State => State #5260 by @eatkins
TERM is set to “dumb” #5278 by @hvesalai
sbt.ForkMain #5315 by @olafurpg
doc #5362 by @eatkins
toTaskable method injection to Initialize[A] for tuple syntax #5439 by @dwijnand
semanticdbVersion to 4.3.7 #5481 by @anilkumarmyla
Tracked.outputChangedW and Tracked.inputChangedW which requires typeclass evidence of JsonWriter[A] instead of JsonFormat[A] #5513 by @bjaglin
State to faciliate sbt server communication #5207 by @eed3si9n
testGrouping #5527 by @frosforever
null #5526 by @3rwww1
Def.promise for long-running tasks to communicate to another task #5552 by @eed3si9n
-Dsbt.repository.publish.attempts set to 3) lm#340 by @izharahmd
sbt 1.4.0 was brought to you by 34 contributors. Ethan Atkins, Eugene Yokota (eed3si9n), Johannes Rudolph, Dale Wijnand, Adrien Piquerez, Jason Zaugg, Arnout Engelen, Josh Soref, Guillaume Martres, Maksim Ochenashko, Anil Kumar Myla, Brice Jaglin, Claudio Bley, João Ferreira, Steve Waldman, frosforever, Alex Zolotko, Heikki Vesalainen, Ismael Juma, Stephane Landelle, Jannik Theiß, izharahmd, lloydmeta, Alexandre Archambault, Eric Peters, Erwan Queffelec, Kenji Yoshida (xuwei-k), Martin Duhem, Olafur Pall Geirsson, Renato Cavalcanti, Vincent PERICART, nigredo-tori. Thanks!