-
Notifications
You must be signed in to change notification settings - Fork 91
Feature/build info values #83
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
Conversation
@eed3si9n Do you intend to merge this, or is there something missing? Need to decide whether to deal with my own fork :) |
@@ -2,14 +2,77 @@ package sbtbuildinfo | |||
|
|||
import sbt._, Keys._ | |||
|
|||
case class BuildInfoResult(identifier: String, value: Any, typeExpr: TypeExpression) | |||
case class BuildInfoResult(identifier: String, value: Any, typeExpr: TypeExpression) { | |||
def toStringTuple: (String, String) = (identifier, value.toString) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if value.toString
belongs to this class. sbt-buildinfo has a concept called BuildInfoRenderer
that takes Seq[BuildInfoResult]
and render them, so I feel like putting toStringTuple
here feels wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, it doesn't seem to fit that well here, but def renderKeys(infoKeysNameAndValues: Seq[BuildInfoResult]): Seq[String]
in BuildInfoRenderer
. Perhaps just an auxiliary function in the object will do?
…the plugin, the `buildInfoStringValues` task already provides tuples without it, and can be easily implemented by the user if necessary.
@eed3si9n I removed the method since it isn't really necessary anyway. Is there anything else you think that should be changed? |
val buildInfoValues: TaskKey[Seq[BuildInfoResult]] = | ||
taskKey("BuildInfo keys/values for use in the sbt build") | ||
val buildInfoStringValues: TaskKey[Seq[(String,String)]] = | ||
taskKey("BuildInfo keys/values for use in the sbt build as plain Strings") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. This is relying on toString
of Any
? I think each build can get this via BuildInfoResult
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. I figured I'd add it as a convenience function, but I'm not married to it. Do you think it's better to expose a version of ScalaClassRenderer.quote or just leave it out completely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anything that's not essential to generating build info Scala file should be left out of this plugin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, I removed the task
…n and not essential to the funcitonality.
Assuming Travis passes the changes looks good to me. Could you squash all the commits, and write a one liner description of the change in notes/0.6.2.markdown please? |
Great! I opened a new PR #89 |
Adds tasks
buildInfoValues
andbuildInfoStringValues
which expose the List ofBuildInfoResult
and a key/value List of(String,String)
s respectively. The latter is useful to add the build info data directly to the jar manifest from sbt.