Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildInfoRenderer doesn't seem to be respected #95

Closed
alexeyr opened this issue Jun 9, 2016 · 2 comments
Closed

buildInfoRenderer doesn't seem to be respected #95

alexeyr opened this issue Jun 9, 2016 · 2 comments

Comments

@alexeyr
Copy link
Contributor

alexeyr commented Jun 9, 2016

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.

@damdev
Copy link

damdev commented Feb 2, 2017

Hi, it seems to be an sbt scopes issue, if you configure the key buildInfoRenderer in the Compile scope it works,

See: https://github.com/damdev/kamon-agent/blob/master/build.sbt#L29

@eed3si9n
Copy link
Member

Closing this per #95 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants