Releases: sbt/sbt
0.13.16-M1
Improvements
- Improves the new startup messages. See below.
- Ports sbt-cross-building's
^
and^^
commands for plugin cross building. See below.
Bug fixes
- Fixes the new startup messages. See below.
Improvements and bug fixes to the new startup messages
The two new startup messages introduced in sbt 0.13.15 are:
- when writing out
sbt.version
, for build reproducability, and - when informing the user about sbt's shell, for the performance improvement
When writing out sbt.version
the messaging now:
- correctly uses a logger rather than println
- honours the log level set, for instance by
--error
- never executes when sbt "new" is being run
When informing the user about sbt's shell the messaging now:
- is a 1 line message, rather than 3
- is at info level, rather than warn level
- can be suppressed with
suppressSbtShellNotification := true
- only triggers when
compile
is being run - never shows when sbt
new
is being run
#3091/#3097/#3147 by @dwijnand
sbt-cross-building
@jrudolph's sbt-cross-building is a plugin author's plugin.
It adds cross command ^
and sbtVersion switch command ^^
, similar to +
and ++
,
but for switching between multiple sbt versions across major versions.
sbt 0.13.16 merges these commands into sbt because the feature it provides is useful as we migrate plugins to sbt 1.0.
To switch the sbtVersion in pluginCrossBuild
from the shell use:
^^ 1.0.0-M5
Your plugin will now build with sbt 1.0.0-M5 (and its Scala version 2.12.2).
If you need to make changes specific to a sbt version, you can now include them into src/main/scala-sbt-0.13
,
and src/main/scala-sbt-1.0.0-M5
, where the binary sbt version number is used as postfix.
To run a command across multiple sbt versions, set:
crossSbtVersions := Vector("0.13.15", "1.0.0-M5")
Then, run:
^ compile
1.0.0-M5
Please see http://developer.lightbend.com/blog/2017-04-18-sbt-1-0-roadmap-and-beta1/#cross-building-sbt-1-0-plugin-from-sbt-0-13 for roadmap.
sbt 1.0.0-M5
This is the beta-1 release of sbt 1.0.
There's no binary compatibility with sbt 0.13 or other future 1.0.0-Mx versions.
Features, fixes, changes with compatibility implications
We are working with Scala Center to provide [an automatic migration tool][sbt-migration-rewrites].
- sbt 1.0 uses Scala 2.12 for build definitions and plugins. This also requires JDK 8.
- Non-auto
sbt.Plugin
trait is dropped. Please migrate to AutoPlugin. Auto plugins are easier to configure, and work better with each other. - sbt 0.12 style
Build
trait that was deprecated in sbt 0.13.12, is removed. Please migrate to build.sbt. Auto plugins andBuild
trait do not work well together, and its feature is now largely subsumed by multi-project build.sbt. - sbt 0.12 style
Project(...)
constructor is restricted down to two parameters. This is becausesettings
parameter does not work well with Auto Plugins. Useproject
instead. - sbt 0.12 style key dependency operators
<<=
,<+=
,<++=
are removed. Please migrate to :=, +=, and ++=. These operators have been sources of confusion for many users, and have long been removed from 0.13 docs, and have been formally deprecated since sbt 0.13.13. - Zinc 1 drops support for Scala 2.9 and earlier. Scala 2.10 must use 2.10.2 and above. Scala 2.11 must use 2.11.2 and above. (latest patch releases are recommended)
- Many of the case classes are replaced with pseudo case classes generated using Contraband. Migrate
.copy(foo = xxx)
towithFoo(xxx)
. - Changes
publishTo
andotherResolvers
from SettingKeys to TaskKeys. #2059/#2662 by @dwijnand - Drops sbt 0.12 style hyphen-separated key names (use
publishLocal
instead ofpublish-local
). - Renames early command feature from
--<command>
toearly(<command>)
. - Log options
-error
,-warn
,-info
,-debug
are added as shorthand for"early(error)"
etc. sbt.Process
andsbt.ProcessExtra
are dropped. Usescala.sys.process
instead.incOptions.value.withNameHashing(...)
option is removed because name hashing is always on.TestResult.Value
is now calledTestResult
.- The scripted plugin is cross-versioned now, so you must use
%%
when depending on it - Removes the
settingsSets
method fromProject
(along withadd/setSbtFiles
). - Drops deprecated
InputTask
apply
method andinputTask
DSL method. UseDef.inputTask
andDef.spaceDelimited().parsed
. - Drops deprecated
ProjectReference
implicit lifts. UseRootProject(<uri>)
,RootProject(<file>)
orLocalProject(<string>)
. - Drops deprecated
seq(..)
DSL method. UseSeq
or pass in the settings without wrapping. - Drops deprecated
File
/Seq[File]
setting enrichments. Use.value
andDef.setting
. - Drops deprecated
SubProcess
apply
overload. UseSubProcess(ForkOptions(runJVMOptions = ..))
.
Features
- New incremental compiler called Zinc 1. Details below.
- The interactive shell is adds network API. Details below.
Fixes
Improvements
- The startup log level is dropped to
-error
in script mode usingscalas
. #840 by @eed3si9n - Replace cross building support with sbt-doge. This allows builds with projects that have multiple different combinations of cross scala versions to be cross built correctly. The behaviour of ++ is changed so that it only updates the Scala version of projects that support that Scala version, but the Scala version can be post fixed with ! to force it to change for all projects. A -v argument has been added that prints verbose information about which projects are having their settings changed along with their cross scala versions. #2613 by @jroper
ivyLoggingLevel
is dropped toUpdateLogging.Quiet
when CI environment is detected. @eed3si9n- Add logging of the name of the different
build.sbt
(matching*.sbt
) files used. #1911 by @valydia - Add the ability to call
aggregate
for the current project inside a build sbt file. By [@xuwei-k][@xuwei-k] - Add new global setting
asciiGraphWidth
that controls the maximum width of the ASCII graphs printed by commands likeinspect tree
. Default value corresponds to the previously hardcoded value of 40 characters. By @RomanIakovlev.
Details of major changes
Zinc 1: Class-based name hashing
A major improvement brought into Zinc 1.0 by Grzegorz Kossakowski (commissioned by Lightbend) is class-based name hashing, which will speed up the incremental compilation of Scala in large projects.
Zinc 1.0's name hashing tracks your code dependendencies at the class level, instead of at the source file level. The GitHub issue sbt/sbt#1104 lists some comparisons of adding a method to an existing class in some projects:
ScalaTest AndHaveWord class: Before 49s, After 4s (12x)
Specs2 OptionResultMatcher class: Before 48s, After 1s (48x)
scala/scala Platform class: Before 59s, After 15s (3.9x)
scala/scala MatchCodeGen class: Before 48s, After 17s (2.8x)
This depends on some factors such as how your classes are organized, but you can see 3x ~ 40x improvements. The reason for the speedup is because it compiles fewer source files than before by untangling the classes from source files. In the example adding a method to scala/scala's Platform class, sbt 0.13's name hashing used to compile 72 sources, but the new Zinc compiles 6 sources.
sbt server: JSON API for tooling integration
sbt 1.0 includes server feature, which allows IDEs and other tools to query the build for settings, and invoke commands via a JSON API. Similar to the way that the interactive shell in sbt 0.13 is implemented with shell
command, "server" is also just shell
command that listens to both human input and network input. As a user, there should be minimal impact because of the server.
In March 2016, we rebooted the "server" feature to make it as small as possible. We worked in collaboration with JetBrains' @jastice who works on IntelliJ's sbt interface to narrow down the feature list. sbt 1.0 will not have all the things we originally wanted, but in the long term, we hope to see better integration between IDE and sbt ecosystem using this system. For example, IDEs will be able to issue the compile task and retrieve compiler warning as JSON events:
{"type":"xsbti.Problem","message":{"category":"","severity":"Warn","message":"a pure expression does nothing in statement position; you may be omitting necessary parentheses","position":{"line":2,"lineContent":" 1","offset":29,"pointer":2,"pointerSpace":" ","sourcePath":"/tmp/hello/Hello.scala","sourceFile":"file:/tmp/hello/Hello.scala"}},"level":"warn"}
Another related feature that was added is the bgRun
task which, for example, enables a server process to be run in the background while you run tests against it.
0.13.15
Fixes with compatibility implications
- sbt 0.13.15 removes the Maven version range when possible. See below.
Improvements
- Adds preliminary compatibility with JDK 9. Using this requires 0.13.15+ launcher. #2951/143 by @retronym
- Adds "local-preloaded" repository for offline installation. See below.
- Notifies and enables users to stay in sbt's shell on the warm JVM by hitting
[ENTER]
while sbt is running. #2987/#2996 by @dwijnand - Adds an
Append
instance to supportsourceGenerators += Def.task { ... }
, instead of needing.taskValue
. #2943 by @eed3si9n - Writes out the sbt.version in
project/build.properties
if it is missing. #754/#3025 by @dwijnand - XML generated by JUnitXmlTestsListener now correctly flags ignored, skipped and pending tests. #2198/#2854 by @ashleymercer
- When sbt detects that the project is compiled with dotty, it now automatically
setsscalaCompilerBridgeSource
correctly, this reduces the boilerplate needed
to make a dotty project. Note that dotty support in sbt is still considered
experimental and not officially supported, see dotty.epfl.ch for
more information. #2902 by @smarter - Updates sbt new's reference implementation to Giter8 0.7.2.
- ScriptedPlugin: Add the ability to paginate scripted tests.
It is now possible to run a subset of scripted tests in a directory at once,
for example:Will create three pages and run page 1. This is especially useful when runningscripted source-dependencies/*1of3
scripted tests on a CI, to benefit from the available parallelism. 3013 by @smarter
Bug fixes
- Fixes .triggeredBy/.storeAs/etc not working when using
:=
and.value
macros. #1444/#2908 by @dwijnand - Fixes Ctrl-C not working on Windows by bumping up JLine. #1855 by @eed3si9n
- Fixes regressions in sbt 0.13.11 - 0.13.13 that processed build-level keys incorrectly. #2851/#2460 by @eed3si9n
- Fixes a regression in sbt 0.13.12 that was misfiring Scala version enforcement when configuration does not extend
Compile
. #2827/#2786 by @eed3si9n - Fixes Scala binary version checking misfiring on configurations that do not extend
Compile
. #2828/#1466 by @eed3si9n - Fixes script mode ignoring quotation. #2551 by @ekrich
- Fixes IllegalStateException that Ivy gets into sometimes. #2827/#2015 by @eed3si9n
- Fixes null sourceFile causing NPE. #2766 by @avdv
- Fixes version parsing in validation. #3011 by @eed3si9n
- Fixes
Package.makeJar
deleting directory recursively. #3014 by @larsrh
Maven version range improvement
Previously, when the dependency resolver (Ivy) encountered a Maven version range such as [1.3.0,)
it would go out to the Internet to find the latest version.
This would result to a surprising behavior where the eventual version keeps changing over time
even when there's a version of the library that satisfies the range condition.
Starting sbt 0.13.15, some Maven version ranges would be replaced with its lower bound
so that when a satisfactory version is found in the dependency graph it will be used.
You can disable this behavior using the JVM flag -Dsbt.modversionrange=false
.
Offline installation
sbt 0.13.15 adds two new repositories called "local-preloaded-ivy"
and "local-preloaded" that point to ~/.sbt/preloaded/
.
The purpose for the repositories is to preload them with
sbt artifacts so the installation of sbt will not require access to the Internet.
This also improves the startup time of sbt when you first run it
since the resolution happens off of a local-preloaded repository.
Notes
No changes should be necessary to your project definition and all plugins published for sbt 0.13.{x|x<14} should still work.
See Migrating from sbt 0.12.x for details on the old operator deprecation.
Special thanks to the contributors for making this release a success. According to git shortlog -sn --no-merges v0.13.13..0.13.15
, compared to 0.13.13, there were 64 (non-merge) commits, by eleven contributors: Eugene Yokota, Dale Wijnand, Guillaume Martres, Jason Zaugg, Lars Hupel, Petro Verkhogliad, Eric Richardson, Claudio Bley, Haochi Chen, Paul Draper, Ashley Mercer. Thank you!
v0.13.14
0.13.13
Fixes with compatibility implications
- Deprecates the old sbt 0.12 DSL, to be removed in sbt 1.0. See below for more details.
- The
.value
method is deprecated for input tasks. Calling.value
on an input key returns anInputTask[A]
,
which is completely unintuitive and often results in a bug. In most cases.evaluated
should be called,
which returnsA
by evaluating the task.
Just in caseInputTask[A]
is needed,.inputTaskValue
method is now provided. #2709 by @eed3si9n - sbt 0.13.13 renames the early command
--<command>
that was added in 0.13.1 toearly(<command>)
. This fixes the regression #1041. For backward compatibility--error
,--warn
,--info
, and--debug
will continue to function during the 0.13 series, but it is strongly encouraged to migrate to the single hyphen options:-error
,-warn
,-info
, and-debug
. #2742 by @eed3si9n - Improve
show
when key returns aSeq
by showing the elements one per line. Disable with-Dsbt.disable.show.seq=true
. #2755 by @eed3si9n - Recycles classloaders to be anti-hostile to JIT. Disable with
-Dsbt.disable.interface.classloader.cache=true
. #2754 by @retronym
Improvements
- Adds
new
command andtemplateResolverInfos
. See below for more details. - Auto plugins can add synthetic subprojects. See below for more details.
- Supports wildcard exclusions in POMs #1431/sbt/ivy#22/#2731 by @jtgrabowski
- Adds the ability to call
aggregateProjects(..)
for the current project inside a build sbt file. #2682 by @xuwei-k - Adds
.jvmopts
support to the launcher script. sbt/sbt-launcher-package#111 by @fommil - Adds
.java-version
support to the Windows launcher script. sbt/sbt-launcher-package#111 by @fommil - The startup log level is dropped to
-error
in script mode usingscalas
. #840/#2746 by @eed3si9n - Adds
CrossVersion.patch
which sits in betweenCrossVersion.binary
andCrossVersion.full
in that it strips off any
trailing-bin-...
suffix which is used to distinguish variant but binary compatible Scala toolchain builds. Most things
which are currentlyCrossVersion.full
(eg. Scala compiler plugins, esp. macro-paradise) would be more appropriately
depended on asCrossVersion.patch
from this release on.
Bug fixes
- Fixes a regression in sbt 0.13.12 that wrongly reports build-level keys to be ambiguous. #2707/#2708 by @Duhemm
- Fixes a regression in sbt 0.13.12 that was misfiring Scala version enforcement when an alternative
scalaOrganization
is set. #2703 by @milessabin - Fixes
Tags.ForkedTestGroup
. #2677/#2681 by @pauldraper - Fixes forked tests being reported as successful when the test harness fails. #2442/#2722/#2730 by @eed3si9n/@dwijnand
- Fixes incorrect installation path on Windows. sbt/sbt-launcher-package#110 by @dwijnand
new command and templateResolverInfos
sbt 0.13.13 adds a new
command, which helps create new build definitions.
The new
command is extensible via a mechanism called the template resolver.
A template resolver pattern matches on the passed in arguments after new
,
and if it's a match it will apply the template.
As a reference implementation, template resolver for Giter8 is provided. For instance:
sbt new eed3si9n/hello.g8
will run eed3si9n/hello.g8 using Giter8.
Synthetic subprojects
sbt 0.13.13 adds support for AutoPlugin
s to define subprojects programmatically,
by overriding the extraProjects
method:
import sbt._, Keys._
object ExtraProjectsPlugin extends AutoPlugin {
override def extraProjects: Seq[Project] =
List("foo", "bar", "baz") map generateProject
def generateProject(id: String): Project =
Project(id, file(id)).
settings(
name := id
)
}
In addition, subprojects may be derived from an existing subproject
by overriding derivedProjects
:
import sbt._, Keys._
object DerivedProjectsPlugin extends AutoPlugin {
// Enable this plugin by default
override def requires: Plugins = sbt.plugins.CorePlugin
override def trigger = allRequirements
override def derivedProjects(proj: ProjectDefinition[_]): Seq[Project] =
// Make sure to exclude project extras to avoid recursive generation
if (proj.projectOrigin != ProjectOrigin.DerivedProject) {
val id = proj.id + "1"
Seq(
Project(id, file(id)).
enablePlugins(DatabasePlugin)
)
}
else Nil
}
#2532/#2717/#2738 by @eed3si9n
Deprecate old sbt 0.12 DSL
The no-longer-documented operators <<=
, <+=
, and <++=
and tuple enrichments are deprecated,
and will be removed in sbt 1.0.
Generally,
task3 <<= (task1, task2) map { (t1, t2) => println(t1 + t2); t1 + t2 }
should migrate to
task3 := {
println(task1.value + task2.value)
task1.value + task2.value
}
Except for source generators, which requires task values:
sourceGenerators in Compile <+= buildInfo
This becomes:
sourceGenerators in Compile += buildInfo.taskValue
Another exception is input task:
run <<= docsRunSetting
This becomes:
run := docsRunSetting.evaluated
See Migrating from sbt 0.12.x for more details.
#2716/#2763/#2764 by @eed3si9n and @dwijnand
Notes
No changes should be necessary to your project definition and all plugins published for sbt 0.13.{x|x<12} should still work.
Special thanks to the contributors for making this release a success. According to git shortlog -sn --no-merges v0.13.12..v0.13.13, compared to 0.13.12, there were 63 (non-merge) commits, by 9 contributors: Eugene Yokota, Dale Wijnand, Martin Duhem, Miles Sabin, Jaroslaw Grabowski, Kenji Yoshida, Jason Zaugg, Paul Draper, Björn Antonsson. Thank you!
0.13.12
Fixes with compatibility implications
- By default the Scala toolchain artifacts are now transitively resolved using the provided
scalaVersion
and
scalaOrganization
. Previously a user specifiedscalaOrganization
would not have affected transitive
dependencies on, eg.scala-reflect
. An Ivy-level mechanism is used for this purpose, and as a consequence
the overriding happens early in the resolution process which might improve resolution times, and as a side
benefit fixes #2286. The old behavior can be restored by adding
ivyScala := { ivyScala.value map {_.copy(overrideScalaVersion = sbtPlugin.value)} }
to your build. #2286/#2634 by @milessabin - The Build trait is deprecated in favor of the
.sbt
format #2530 by @dwijnand
Improvements
- When
RecompileOnMacroDef
is enabled, sbt will now print out a info level log indicating that some sources are being recompiled because it's used from a source that contains a macro definition. Can be disabled withincOptions := incOptions.value.withLogRecompileOnMacro(false)
#2637/#2659 by @eed3si9n/@dwijnand - Adds Windows script support and native file extensions on Unix platforms. #2603 by @ekrich
- Improves loading time of large builds. #2630 by @eed3si9n
- Adds the ability to call
dependsOn
for the current project inside a.sbt
file. #2653 by @anatolydwnld
Bug fixes
- Fixes a 0.13.11 regression: dependency resolution hitting Maven Central even with repository overrides. #2519/#2569 by @eed3si9n
- Fixes a 0.13.11 regression in incremental compiler:
IndexOutOfBoundsException
in ExtractAPI #2497/#2557 by @smarter - Fixes merged dependency descriptors dropping configuration specification. #2002/#1500 by @eed3si9n
- Fixes merged dependency descriptors creating non-existing artifacts. #2431/#2500 by @Duhemm
- Fixes incremental compilation misses when macro expansion references another source. #2560/#2563 by @eed3si9n
- Fixes incremental compilation of package objects transitively in name hashing. #2432/#2326 by @gkossakowski
- Fixes incremental compilation relying on filename of package objects. #2438 by @Duhemm
- Provides a workaround flag
incOptions := incOptions.value.withIncludeSynthToNameHashing(true)
for name hashing not including synthetic methods. This will not be enabled by default in sbt 0.13. It can also enabled by passingsbt.inc.include_synth=true
to JVM. #2537 by @eed3si9n - Fixes tab completion for tasks defined in AutoPlugin's buildSettings #2460/#2469 by @Duhemm
- Fixes configuration merging during cached resolution. #2435/#2513 by @Duhemm
Notes
No changes should be necessary to your project definition and all plugins published for sbt 0.13.{x|x<12} should still work. Please report any issues you encounter if this is not the case.
Special thanks to the contributors for making this release a success. According to git shortlog -sn --no-merges v0.13.11..0.13.12
, compared to 0.13.11, there were 83 (non-merge) commits, by 11 contributors: Eugene Yokota, Martin Duhem, Grzegorz Kossakowski, Dale Wijnand, Guillaume Martres, Jason Zaugg, Miles Sabin, Tim Harper, ddworak, ekrich, Anatoly Fayngelerin. Thank you!
0.13.11
Fixes with compatibility implications
- JCenter is now opt-in. A new setting
useJCenter
can be set totrue
to re-include it, as the first external resolver to find library dependencies. #2217/#2467 by @eed3si9n - Adds
withInterProjectFirst
to the update option, which is enabled by default. When set totrue
,inter-project
resolver will be prioritized above all resolvers and Ivy cache. #1827 by @eed3si9n - Fixes update option's
withLatestSnapshots
so it handles modules without an artifact. This flag will be enabled by default.
#1514/#1616/#2313 by @eed3si9n - No longer passes
-J<flag>
options to the local Java compiler. #1968/#2272 by @Duhemm - Fixes auto imports for auto plugins in global configuration files. Because this is not source compatible with 0.13.x, the fix is enabled only when
sbt.global.autoimport
flag istrue
. #2120/#2399 by @timcharper
Improvements
- Adds configurable compiler bridge. See below.
- Adds initial support for Dotty. See below
- Adds settings for granular inter-project dependency tracking. See below.
- Scala version used by the build is updated to 2.10.6. #2311 by @eed3si9n
- If
publishMavenStyle
istrue
,update
task warns when it sees intransitive dependencies, which do not translate to Maven. #2127 by @jsuereth - Adds
Def.settings
, which facilitates mixing settings with seq of settings. See below. - sbt Serialization is updated to 0.1.2. #2117 by @dwijnand
- Hides the stack trace on compilation error in build definition. #2071/#2091 by @Duhemm
- Makes the dummy
Logger.Null
public. #2094 by @pdalpra - Uses diagnostic classes to get lines contents in local Java compiler. #2108/#2201 by @fkorotkov
- Adds logging of javaOptions. #2087/#2103 by @pdalpra
- Warns when javaOptions are defined but fork is set to false. #2041/#2103 by @pdalpra
- Adds an
Append.Sequence
instance forList
to allow+=
/++=
ondevelopers
setting. #2107/#2114 by @pdalpra - Drops
sealed
from the typeclasses inAppend
. #2322 by @dwijnand - Fixes compilation warnings in sbt's codebase, and other clean ups. #2112/#2137/#2139/#2142 by @pdalpra
- Adds
localIfFile
toMavenRepository
, to force artifacts to be copied to the cache. #2172 by @dwijnand - Adds
Resolver.bintrayIvyRepo(owner, repo)
. #2285 by @dwijnand - Non-static annotation changes are no longer tracked by the incremental compiler. #2343 by @romanowski
- Reduces the memory usage of API info extraction in the incremental compiler. #2343 by @adriaanm
- Memory-related options can now be overridden individually via the
-J
options. sbt/sbt-launcher-package#105
Bug fixes
- Fixes the false positive of inconsistent duplicate warnings. #1933/#2258 by
@Duhemm - Fixes task scheduling performance on large builds by skipping checks in
sbt.Execute
. #2302/#2303 by @jrudolph - Fixes changes in value classes by registering signatures of method before and after erasure. #1171/#2261 by @Duhemm
- Updated Ivy to merge IVY-1526 fix. sbt/ivy#14/#2118 by @jsuereth
- Fixes
updateClassifiers
downloading updated snapshot sources and docs.
#1750/sbt/ivy#17/#2163/sbt/ivy#18/#2186 by @dwijnand - Fixes
updateClassifiers
on Ivy modules withoutdefault
configuration.
#2264 by @eed3si9n/@Duhemm - Updated JLine to version 2.13. #1681/#2173
- Changing the value of a constant (final-static-primitive) field will now
correctly trigger incremental compilation for downstream classes. This is to
account for the fact that Java compilers may inline constant fields in
downstream classes. #1967/#2085 by @stuhood - Fixes classfile location detection. #2214 by @stuhood
- Fixes a few typos in keys descriptions. #2092 by @pdalpra
- Avoids the use of
ListBuffer#readOnly
. #2095 by @adriaanm - Expands transitive dependency exclusions when using sbt-maven-resolver-plugin #2109 by @jsuereth
- Fixes incremental compilation of traits by including private members into the API hash. #2155/#2160 by
@Duhemm - Fixes name hashing by removing class private members from the hash. #2324/#2325 by @gkossakowski
- Fixes name hashing error messages. #2158 by @stuhood
- Adds more robustness to
tasks
andsettings
command. #2192 by @DavidPerezIngeniero - Fixes Java compilation inconsistencies between sbt and
javac
by always failing if the local Java compiler reported errors. #2228/#2271 by @Duhemm - Fixes
JavaErrorParser
to parse non-compile-errors #2256/#2272 by @Duhemm - Fixes launcher configuration to add
sbt-ivy-snapshots
repository to resolve nightly builds. @eed3si9n - Fixes performance issues during tree traversal in the incremental compiler. #2343 by @adriaanm
- Fixes the tracking of self types and F-bounded existential types in the incremental compiler. #2343 by @adriaanm
- Avoid CCE when scalac internally uses
compileLate
. #2453 by @retronym - Fixes the memory-related options overriding
SBT_OPTS
. sbt/sbt-launcher-package#101 by @eed3si9n
Configurable Scala compiler bridge
sbt 0.13.11 adds scalaCompilerBridgeSource
setting to specify the compiler brigde source. This allows different implementation of the bridge for Scala versions, and also allows future versions of Scala compiler implementation to diverge. The source module will be retrieved using library management configured by bootIvyConfiguration
task.
Dotty awareness
sbt 0.13.11 will assume that Dotty is used when scalaVersion
starts with 0.
.
The built-in compiler bridge in sbt does not support Dotty,
but a separate compiler bridge is being developed at [smarter/dotty-bridge](https://github.c...
0.13.9
Fixes with compatibility implications
- Starting 0.13.9,
crossScalaVersions
default value is fixed back to the older 0.12.x behavior. See below for details. - Starting 0.13.9, the generated POM files no longer include dependencies on source or javadoc jars obtained via
withSources()
orwithJavadoc()
. See below for details. - Scala version is bumped to 2.10.5. This brings in the fix for SI-9027: XML node sequence literal bug. #1666/#2068 by @eed3si9n
Improvements
- Adds
retrieveManaged
related improvements. See below for details. - Adds
-=
and--=
for settings and tasks, which are the opposites of+=
and++=
. #1922 by @dwijnand - Adds
inThisBuild
, similar toinConfig
, to allow specifying multiple settings inThisBuild
scope. #1847/#1989 by @dwijnand - Adds a nicer toString to SimpleCommand to make it more human-friendly. #1998/#2000 by @dwijnand
- Adds
forceUpdatePeriod
key, that takes values ofOption[FiniteDuration]
. If set, a fullupdate
will occur after that amount of time without needing to explicitly run theupdate
task. By @ajsquared - Updates
ForkError.getMessage()
to include exception's original name. #2028 by @kamilkloch - Adds help message for
inspect actual
. #1651/#1990 by @dwijnand - Supports excluding tests in
testOnly
/testQuick
with-
, for example-MySpec
.
#1970 by @matthewfarwell - Adds more diagnostic info for underfined settings.
#2008/#2009 by @DavidPerezIngeniero - Adds an
Extracted.runInputTask
helper to assist with imperatively executing input tasks. #2006 by @jroper - Renames
distinct
method onPathFinder
todistinctName
. #1973 by @eed3si9n - Adds
distinctPath
method onPathFinder
. #1973 by @eed3si9n
Bug fixes
- Fixes memory/performance/correctness issue with cached resolution. See below.
- Correct incremental compile debug message for invalidated products #1961 by @jroper
- Enables forced GC by default. See below.
- Fixes Maven compatibility to read
maven-metadata.xml
. See below. - Captures errors on
help
command. #1900/#1940 by @DavidPerezIngeniero - Prevents history command(s) from going into an infinite loop #1562 by @PanAeon
- Honors overwrite flag when publishing locally. #1960 by @asflierl
- Fixes a certain class of pom corruption that can occur in the presence of parent-poms. #1856 by @jsuereth
- Adds dependency-level exclusions in the POM for project-level exclusions. #1877/#2035 by @dwijnand
crossScalaVersions
default value
As of this fix crossScalaVersions
returns to the behaviour present in 0.12.4
whereby it defaults to what
scalaVersion
is set to, for example if scalaVersion
is set to "2.11.6"
, crossScalaVersions
now defaults
to Seq("2.11.6")
.
Therefore when upgrading from any version between 0.13.0
and 0.13.8
be aware of this new default if
your build setup depended on it.
POM files no longer include certain source and javadoc jars
When declaring library dependencies using the withSources() or withJavadoc() options, sbt was also including
in the pom file, as dependencies, the source or javadoc jars using the default Maven scope. Such dependencies
might be erroneously processed as they were regular jars by automated tools
retrieveManaged
related improvements
sbt 0.13.9 adds retrieveManagedSync
key that, when set to true
, enables synchronizing retrieved to the current build by removed unneeded files.
It also adds configurationsToRetrieve
key, that takes values of Option[Set[Configuration]]
. If set, when retrieveManaged
is true only artifacts in the specified configurations will be retrieved to the current build.
#1950/#1987 by @ajsquared
Cached resolution fixes
On a larger dependency graph, the JSON file growing to be 100MB+
with 97% of taken up by caller information.
To make the matter worse, these large JSON files were never cleaned up.
sbt 0.13.9 filters out artificial or duplicate callers,
which fixes OutOfMemoryException
seen on some builds.
This generally shrinks the size of JSON, so it should make the IO operations faster.
Dynamic graphs will be rotated with directories named after yyyy-mm-dd
,
and stale JSON files will be cleaned up after few days.
sbt 0.13.9 also fixes a correctness issue that was found in the earlier releases.
Under some circumstances, libraries that shouldn't have been evicted was being evicted.
This occured when library A1
depended on B2
, but a newer A2
dropped the dependency,
and A2
and B1
are also is in the graph. This is fixed by sorting the graph prior to eviction.
#2030/#1721/#2014/#2046/#2097/#2129 by @eed3si9n
Force GC
@cunei in #1223 discovered that sbt leaks PermGen
when it creates classloaders to call Scala Compilers.
sbt 0.13.9 will call GC on a set interval (default: 60s).
It will also call GC right before cross building.
This behavior can diabled using by setting false to forcegc
setting or sbt.task.forcegc
flag.
Maven compatibility fix
To resolve dynamic versions such as SNAPSHOT
and version ranges, the dependency resolution engine
queries for the list of available versions.
For Maven repositories, it was supposed read maven-metadata.xml
first, but
because sbt customizes the repository layout for cross building, it has been falling back
to screen scraping of the Apache directory listing.
This problem surfaced as:
- Version range not working for artifacts hosted on Bintray. #2005
- Potentially other
SNAPSHOT
related issues.
sbt 0.13.9 fixes this by relaxing the Maven compatiblity check, so it will read maven-metadata.xml
. #2075 by @eed3si9n
Contributors
Special thanks to the contributors for making this release a success. Compared to 0.13.8, there were 127 (non-merge) commits, by 14 contributors: Eugene Yokota, Dale Wijnand, Josh Suereth, Andrew Johnson, David Perez, Matthew Farwell, Antonio Cunei, Andrzej Jozwik, James Roper, Vitalii Voloshyn, Benjy, Kamil Kloch, Max Worgan, Andreas Flierl. Thank you!
0.13.8
Changes with compatibility implications
- Disable publishing on implicitly created root project by not enabling
IvyPlugin
by default (-Dsbt.root.ivyplugin=true
will revert this behavior). #1871/#1869 by @dwijnand - Rolls back XML parsing workaround. See below.
- Enables cross-version support for Scala sources. See below.
Improvements
- Adds Maven resolver plugin. See below.
- Adds project-level dependency exclusions. See below.
- Adds sequential tasks. See below.
- Discovered main classes will be sorted. #1180 by @kretes
- Implemented a new mechanism of forking javac, whereby errors are captured. Also more likely to run in-process. #1702 by @jsuereth
evicted
will display all evictions (including the ones not suspected of binary incompatibility). #1615 by @eed3si9n- Better abstration to track new kinds of dependencies for incremental compiler. #1340 by @Duhemm
- Source dependency uses
--depth 1
for git clone. #1787 by @xuwei-k - Facilitate nicer ways of declaring project settings. See below. #1902 by @dwijnand
Fixes
- Javac warnings are treated as warnings. #1702/#875 by @jsuereth
compilerReporter
is fed to javac during incremental compilation. #1542 by @jsuereth- Ignores hidden build files from the build. #1746 by @j-keck
- Fixes build.sbt parsing of multiple import. #1741 by @ajozwik
- Fixes ANSI escape code for overwriting lines on Windows. #1771 by @dwickern
- Adds null check in incremental compiler's type tree extraction. #1754/#1655 by @Duhemm
- sbt doesn't honor Maven's uniqueVersions (use sbt-maven-resolver to fix). #1322 by @jsuereth
- sbt doesn't see new SNAPSHOT dependency versions in local maven repos (use withLatestSnapshots + sbt-maven-resolver to fix) #321 by @jsuereth
- Property in pom's version field results to wrong dependency resolution (use sbt-maven-resolver to fix). #647 by @jsuereth
- Maven local resolver with parent POM (use sbt-maven-resolver). #1616 by @jsuereth
- Fixes eviction warning being too noisy. #1615 by @eed3si9n
- Issues warning if multiple dependencies to a same library is found with different version. #1634 by @eed3si9n
- Removes "No main class detected" warning. #1766 by @eed3si9n
- Fixes sporadic ConcurrentModificationException from JUnitXmlTestsListener. #1881 by @aerskine
- Fixes handling of ANSI CSI codes. #1885 by @jsuereth
- Exempt org.scala-lang:scala-actors-migration and org.scala-lang:scala-pickling from scala binary version checks. #1818/#1899 by @dwijnand
- Fixes cached resolution handling of internal depdendencies. #1711 by @eed3si9n
- Fixes cached resolution being too verbose. #1752 by @eed3si9n
- Fixes cached resolution not evicting modules transitively. #1760 by @eed3si9n
Rolling back XML parsing workaround
sbt 0.13.7 implemented natural whitespace handling by switching build.sbt
parsing to use Scala compiler, instead of blank line delimiting. We realized that some build definitions no longer parsed due to the difference in XML handling.
val a = <x/><y/>
val b = 0
At the time, we thought adding parentheses around XML nodes could work around this behavior. However, the workaround has caused more issues, and since then we have realized that this is a compiler issue SI-9027, so we have decided to roll back our workaround. In the meantime, if you have consecutive XML elements in your build.sbt, enclose them in <xml:group>
tag, or parentheses.
val a = <xml:group><x/><y/></xml:group>
val b = 0
Cross-version support for Scala sources
When crossPaths
setting is set to true
(it is true
by default), sbt 0.13.8 will include
src/main/scala-<scalaBinaryVersion>/
to the Compile
compilation in addition to
src/main/scala
. For example, it will include src/main/scala-2.11/
for Scala 2.11.5, and
src/main/scala-2.9.3
for Scala 2.9.3. #1799 by @indrajitr
Maven resolver plugin
sbt 0.13.8 adds an extension point in the dependency resolution to customize Maven resolvers.
This allows us to write sbt-maven-resolver auto plugin, which internally uses Eclipse Aether
to resolve Maven dependencies instead of Apache Ivy.
To enable this plugin, add the following to project/maven.sbt
(or project/plugin.sbt
the file name doesn't matter):
addMavenResolverPlugin
This will create a new ~/.ivy2/maven-cache
directory, which contains the Aether cache of files.
You may notice some file will be re-downloaded for the new cache layout.
Additionally, sbt will now be able to fully construct
maven-metadata.xml
files when publishing to remote repositories or when publishing to the local ~/.m2/repository
.
This should help erase many of the deficiencies encountered when using Maven and sbt together.
Notes and known limitations:
- sbt-maven-resolver requires sbt 0.13.8 and above.
- The current implementation does not support Ivy-style dynamic revisions, such as "2.10.+" or "latest.snapshot". This
is a fixable situation, but the version range query and Ivy -> Maven version range translation code has not been migrated. - The current implementation does not support Maven-style range revisions if found on transitive dependencies. #1921
Project-level dependency exclusions
sbt 0.13.8 adds experimental project-level dependency exclusions:
excludeDependencies += "org.apache.logging.log4j"
excludeDependencies += "com.example" %% "foo"
In the first example, all artifacts from the organization "org.apache.logging.log4j"
are excluded from the managed dependency.
In the second example, artifacts with the organization "com.example"
and the name "foo"
cross versioned to the current scalaVersion
are excluded.
Note: This feature currently does not translate to pom.xml
!
Sequential tasks
sbt 0.13.8 adds a new Def.sequential
function to run tasks under semi-sequential semantics.
Here's an example usage:
lazy val root = project.
settings(
testFile := target.value / "test.txt",
sideEffect0 := {
val t = testFile.value
IO.append(t, "0")
t
},
sideEffect1 := {
val t = testFile.value
IO.append(t, "1")
t
},
foo := Def.sequential(compile in Compile, sideEffect0, sideEffect1, test in Test).value
)
Normally sbt's task engine will reorder tasks based on the dependencies among the tasks,
and run as many tasks in parallel (See Custom settings and tasks for more details on this).
Def.sequential
instead tries to run the tasks in the specified order.
However, the task engine will still deduplicate tasks. For instance, when foo
is executed, it will only compile once,
even though test in Test
depends on compile. #1817/#1001 by @eed3si9n
Nicer ways of declaring project settings
Now a Seq[Setting[_]]
can be passed to Project.settings
without the needs for "varargs expansion", ie. : _*
Instead of:
lazy val foo = project settings (sharedSettings: _*)
It is now possible to do:
lazy val foo = project settings sharedSettings
Also, Seq[Setting[_]]
can be declared at the same level as individual settings in Project.settings
, for instance:
lazy val foo = project settings (
sharedSettings,
version := "1.0",
someMoreSettings
)
Bytecode Enhancers
sbt 0.1...
v0.13.7
Fixes with compatibility implications
- Maven artifact dependencies will limit their transitive dependencies to
Compile
rather than every configuration if nomaster
configuration is found. #1586 by @jsuereth - The new natural whitspace handling parser is unable to cope with certain classes of Scala syntax. In particular, top-level pattern matches, or multi-value defintions are no longer supported.
Here are examples:
val x, y = project // BAD
val x = project //
val y = project // GOOD
Improvements
- Natural whitespace handling. See below. #1606 by @rkrzewski, @ajozwik, and others at @WarsawScala
- Adds support for publishing to a custom Maven local repository. See below. #1589/#1600 by @topping
- Adds circular dependency check. See below. #1601 by @eed3si9n
- Adds cached resolution (minigraph caching). See below. #1631 by @eed3si9n
- Allows the "-bin" Scala version suffix to specify a bincompat version. #1573 by @cunei
- Adds support for publishing to file repositories specified in
~/.sbt/repositories
. #1579 by @copumpkin - Adds support for publishing to a Maven repository with
file
URLs. #1618 by @jsuereth - Don't hardcode existing relations in
TextAnalysisFormat
. #1572 by @Duhemm - Adds
developers
key. #1590 by @jedesah - Will warn when none or multiple main classes detected. #1648 by @kretes
Bug fixes
- Fixes issues with specifying
scalaHome
/scalaInstance
and running tests. #1584 by @jsuereth - Fixes StackOverflow error in dependencies extraction with macro and name hashing. #1563/#1642/#1237/#1544 by @Duhemm
- Fixes
set every
. #1591/#1430 by @cunei - Ivy no longer silently flops to
HttpClient
resolver when httpclient is on the classpath. #1602 by @jsuereth - Backports Ivy fix to not throw exceptions when modules are evicted. #1607/#1598 by @jsuereth
- When resolving from a Maven repository, and unable to read
maven-metadata.xml
file (common given the divergence in
Maven 3 and Ivy 2), we attempt to useLastModified
timestamp in lieu of "published" timestamp.
#1611/#1618 by @jsuereth - Fixes NullPointerException when using
ChainResolver
and Maven repositories. #1611/#1618 by @jsuereth - Fixes
Resolver
'surl
method droppingdescriptorOptional
andskipConsistencyCheck
. #1621 by @tmandke - Revert
useLatestSnapshot
onupdateOptions
to default tofalse
. Reverts chain resolver to previous behavior. #1683 by @jsuereth
Natural whitespace handling
Starting sbt 0.13.7, build.sbt will be parsed using a customized Scala parser. This eliminates the requirement to use blank line as the delimiter between each settings, and also allows blank lines to be inserted at arbitrary position within a block.
This feature can be disabled, if necessary, via the -Dsbt.parser.simple=true flag.
This feature was contributed by Andrzej Jozwik (@ajozwik), Rafał Krzewski (@rkrzewski) and others at @WarsawScala inspired by Typesafe's @gkossakowski organizing multiple meetups and hackathons on how to patch sbt with the focus on this blank line issue. Dziękujemy! #1606
Custom Maven local repository location
Maven local repository is now resolved from the first of:
<localRepository/>
element in~/.m2/settings.xml
<localRepository/>
element in$M2_HOME/conf/settings.xml
, or- the default of
~/.m2/repository
if neither of those configuration elements exist
If more Maven settings are required to be recovered, the proper thing to do is merge the two possible settings.xml
files, then query against the element path of the merge. This code avoids the merge by checking sequentially.
Circular dependency
By default circular dependencies are warned, but they do not halt the dependency resolution. Using the following setting, circular dependencies can be treated as an error.
updateOptions := updateOptions.value.withCircularDependencyLevel(CircularDependencyLevel.Error)
Cached resolution (minigraph caching)
sbt 0.13.7 adds a new experimental update option called cached resolution, which replaces consolidated resolution:
updateOptions := updateOptions.value.withCachedResolution(true)
Unlike consolidated resolution, which only consolidated subprojects with identical dependency graph, cached resolution create an artificial graph for each direct dependency (minigraph) for all subprojects, resolves them independently, saves them into json file, and stiches the minigraphs together.
Once the minigraphs are resolved and saved as files, dependency resolution turns into a matter of loading json file from the second run onwards, which should complete in a matter of seconds even for large projects. Also, because the files are saved under a global ~/.sbt/0.13/dependency
(or what's specified by sbt.dependency.base
flag), the resolution result is shared across all builds.
Breaking graphs into minigraphs allows partial resolution results to be shared, which scales better for subprojects with similar but slightly different dependencies, and also for making small changes to the dependencies graph over time. See documentation on cached resolution for more details.