BuildInfo

Generate scala code from your buildfile. This plugin generates a single object containing information from your build.

To declare a module that uses BuildInfo you must extend the mill.contrib.buildinfo.BuildInfo trait when defining your module.

Quickstart:

build.sc
import $ivy.`com.lihaoyi::mill-contrib-buildinfo:`
import mill.contrib.buildinfo.BuildInfo

object project extends BuildInfo {
  val name = "project-name"
  val buildInfoPackageName = "com.organization"
  def buildInfoMembers = Seq(
    BuildInfo.Value("name", name),
    BuildInfo.Value("scalaVersion", scalaVersion()),
  )
}
Main.scala
import com.organization.BuildInfo

@main
def main = {
  println(BuildInfo.name)
  println(BuildInfo.scalaVersion)
}

Configuration options

  • def buildInfoMembers: T[Seq[BuildInfo.Value]] The map containing all member names and values for the generated info object.

  • def buildInfoObjectName: String, default: BuildInfo The name of the object which contains all the members from buildInfoMembers.

  • def buildInfoPackageName: String The package name of the object.