Skip to content

Releases: sbt/sbt-buildinfo

0.13.1

09 Nov 19:28
v0.13.1
07337b5
Compare
Choose a tag to compare

sbt-buildinfo 0.13.1 is cross published to:

sbt Version Published
1.x
2.0.0-M2

bug fixes

behind the scene

Full Changelog: v0.13.0...v0.13.1

0.13.0

03 Nov 06:17
v0.13.0
a57f12b
Compare
Choose a tag to compare

sbt-buildinfo 0.13.0 is cross published to:

sbt Version Published
1.x
2.0.0-M2

sbt 2.x migration

updates

  • refactor: Avoid deprecated java.net.URL constructor by @xuwei-k in #206

Full Changelog: v0.12.0...v0.13.0

0.12.0

20 Mar 04:25
v0.12.0
4a3b819
Compare
Choose a tag to compare

updates

behind the scene

new contributors

Full Changelog: v0.11.0...v0.12.0

0.11.0

17 Feb 05:57
v0.11.0
Compare
Choose a tag to compare

Changes with compatibility implications

sbt-buildinfo 0.11.0 removes import scala.Predef._ from the generated code to fix the compatibility with new Scala 3 syntax.
If import scala.Predef._ is needed, use BuildInfoOption.ImportScalaPredef:

buildInfoOptions += BuildInfoOption.ImportScalaPredef

This was contributed by @martingd in #180

Java renderers

sbt-buildinfo 0.11.0 introduces two flavors to Java renders.

buildInfoRenderFactory := JavaSingletonRenderer.apply

This generates Java source code using singleton pattern:

package hello;

/** This file was generated by sbt-buildinfo. */
public final class BuildInfo {
  private BuildInfo() {}

  public static final BuildInfo instance = new BuildInfo();
  /** The value is "helloworld". */
  public final String name = "helloworld";
}
buildInfoRenderFactory := JavaStaticFieldsRenderer.apply

This generates Java source code using static fields:

package hello;

/** This file was generated by sbt-buildinfo. */
public final class BuildInfo {
  private BuildInfo() {}

  /** The value is "helloworld". */
  public static final String name = "helloworld";
}

These were contributed by @arixmkii in #167

What's Changed

  • Adds Java time objects as valid BuildInfoKey values by @nMoncho in #178
  • Fixes typo (can can) by @gokyo in #174
  • Fixes generated target file by @gokyo in #175
  • Removes unnecessary variable name by @gokyo in #176
  • Adds documentation for options PackagePrivate and ConstantValue. by @martingd in #181

New Contributors

Full Changelog: v0.10.0...v0.11.0

0.10.0

09 Aug 03:24
v0.10.0
9874e1a
Compare
Choose a tag to compare

Breaking change: scala.collection.immutable.Seq

sbt-buildinfo 0.10.0 will generate scala.collection.immutable.Seq(...) instead of scala.collection.Seq(...).

This was contributed as #150 by @smarter.

Breaking change: output local time

sbt-buildinfo 0.10.0 will output build time in local time (using JSR-310 java.time.Instant) with timezone string.

buildInfoOptions += BuildInfoOption.BuildTime

This was contributed as #156/#157 by @xerial and @leviramsey

BuildInfoOption.PackagePrivate

buildInfoOptions += BuildInfoOption.PackagePrivate

sbt-buildinfo 0.10.0 adds a new option to make BuildInfo package private. This was contributed as #151 by @pcejrowski.

BuildInfoOption.ConstantValue

buildInfoOptions ++= Seq(BuildInfoOption.ConstantValue, BuildInfoOption.PackagePrivate)

sbt-buildinfo 0.10.0 adds a new option to make BuildInfo fields constant value definitions when possible.

package hello

import scala.Predef._

private[hello] case object BuildInfo {
  /** The value is "helloworld". */
  final val name = "helloworld"
  /** The value is "0.1". */
  final val version = "0.1"

  ....
}

We recommend making BuildInfo package private if you use this option. #164 by @eed3si9n

bug fixes and updates

0.9.0

16 Apr 12:18
v0.9.0
Compare
Choose a tag to compare

sbt-buildinfo 0.9.0 is published for sbt 1.

TaskKey to BuildInfoKey conversion potentially breaking semantic change

TL;DR No need for BuildInfoKey.of(...) or BuildInfoKey.ofN(...) any more. Use BuildInfoKey.outOfGraphUnsafe if your build definition is now circular.

sbt-buildinfo 0.8.0 deprecated the original TaskKey[A] to BuildInfoKey.Entry[A] implicit and explicit conversions (BuildInfoKey.task and BuildInfoKey.apply respectively), that executed the underlying sbt Task out of sbt's task graph execution, in favour of a newly introduced BuildInfoKey.of(...) and BuildInfoKey.ofN(...) API, which correctly wired up the task graph. See #114.

As it was implemented (and released) it interacted poorly with sbt-buildinfo's BuildInfoKey.map API (#117), due to a mistake in the implementation and test coverage.

In resolving the issue it became clear that instead of introducing a new API, that required sbt-buildinfo users to change their source code to use, the already used conversions could have been modified to use the new Task-based semantics.

However, this change breaks any build definition that declares as a build info key any TaskKey that depends on sourceGenerators or resourceGenerators, because the build definiton would now be circular and fail to load. To fix this breaking semantic change the user has to either drop the key used, choose another key, or fallback to the previous semantics by using the not-deprecated BuildInfoKey.outOfGraphUnsafe API, also introduced in sbt-buildinfo 0.8.0.

#117/#119 by @dwijnand

Add direct support for sbt's Attributed

A number of keys defined by sbt use sbt's Attributed type, specifically the keys that define classpaths. Prior to this change defining any of these keys as a build info key would generate Seq[String] as Attributed would be simply converted to string with toString. sbt-buildinfo 0.9.0 introduces direct support for these keys so they generate Seq[File] instead.

#112/#120 by @dwijnand

Make toJson more JSONish

sbt-buildinfo is able to generate toJson method using the following setting:

buildInfoOptions += BuildInfoOption.ToJson

sbt-buildinfo 0.9.0 makes the JSON encoding more natural:

"libraryDependencies" :
  [ "org.scala-lang:scala-library:2.12.4",
    "com.lihaoyi:acyclic:0.1.7:plugin->default(compile)",
    .....]

#123 by @tonicebrian

Do not generate multi-parameter infix calls

Multi-parameter infix calls may be removed in the future, so it's better not to generate this kind of code.

#124 by @Duhemm

0.8.0

22 Feb 04:11
v0.8.0
Compare
Choose a tag to compare

sbt-buildinfo 0.8.0 is published for sbt 1.

BuildInfoKey.of(...) and BuildInfoKey.ofN(...)

Prior to 0.8.0 when sbt-buildinfo generated the BuildInfo object using tasks, it was executing the tasks out-of-graph.
This would occasionally cause race conditions when used with side-effecty tasks.

To workaround this issue sbt-buildinfo introduces a new BuildInfokey.of(...) and BuildInfoKey.ofN(...) macro that will safely execute the tasks within the control of the task engine.

Before 0.8.0

lazy val root = (project in file("."))
  .enablePlugins(BuildInfoPlugin)
  .settings(
    buildInfoKeys := Seq[BuildInfoKey](name, version, someTask),
    buildInfoPackage := "hello"
  )

After 0.8.0

lazy val root = (project in file("."))
  .enablePlugins(BuildInfoPlugin)
  .settings(
    buildInfoKeys := BuildInfoKey.ofN(name, version, someTask),
    buildInfoPackage := "hello"
  )

This feature was contributed by @dwijnand as #114

0.7.0

20 Apr 08:12
v0.7.0
Compare
Choose a tag to compare

sbt-buildinfo 0.7.0 is cross published to sbt 0.13.x and sbt 1.0.0-M5.

fixes

  • If generating resources, put them into resourceManaged. #94 by @alexeyr

buildInfoRenderFactory

One can now use

buildInfoRenderFactory := ScalaCaseClassRenderer.apply

To switch to another Renderer. Also added a Case Class renderer, which will create a case class AND an object that inherits the class. This makes it easy to use a jsonFormatter with the output. #98 by @axos88

buildInfoValues

Adds buildInfoValues task, which exposes the set of BuildInfoResult objects used by sbt-buildinfo to generate BuildInfo files.
This can be used within the sbt build itself to add the build info to the jar Manifest. #89 by @jastice