Skip to content

buildInfoRenderer doesn't seem to be respected #95

@alexeyr

Description

@alexeyr

In build.sbt I have

lazy val extraClassPathTask = TaskKey[String]("extraClassPath")

// Requires luaBackendCore and lmsBackendLinAlg to be compiled but not on classpath,
// to demonstrate plugin system
lazy val examples = Project("scalan-examples", file("examples")).
  dependsOn(core % "compile->compile;test->test;it->test", linalg).configs(IntegrationTest).settings(itSettings).
  enablePlugins(BuildInfoPlugin).settings(
    buildInfoKeys := Seq(extraClassPathTask),
    buildInfoRenderer := ConfBuildInfoRenderer(buildInfoOptions.value)
  )

extraClassPathTask in examples := ...

ConfBuildInfoRenderer is

import sbtbuildinfo._

case class ConfBuildInfoRenderer(options: Seq[BuildInfoOption]) extends BuildInfoRenderer {
  def fileType = BuildInfoType.Resource
  def extension = "conf"
  def header = Nil
  def footer = Nil

  // TODO any other needed types
  def render(result: BuildInfoResult) = {
    val rhs = result.typeExpr match {
      case TypeExpression("String", Nil) =>
        "\"" + result.value.toString + "\""
      case _ =>
        result.value.toString
    }
    s"""${result.identifier}=$rhs"""
  }

  def renderKeys(infoKeysNameAndValues: Seq[BuildInfoResult]): Seq[String] = infoKeysNameAndValues.map(render)
}

and show scalan-examples/buildInfoRenderer shows [info] ConfBuildInfoRenderer(List()).

However, I still get src_managed/main/sbt-buildinfo/BuildInfo.scala instead of expected resource_managed/sbt-buildinfo/BuildInfo.conf.

You can see the full build.sbt at https://github.com/scalan/scalan/blob/fc8fdd33d8a086ee776fba0429416252aea6ae17/build.sbt. Am I missing something? Plugin version is 0.6.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions