Skip to content

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

Closed
wants to merge 5 commits into from
Closed

Feature/build info values #83

wants to merge 5 commits into from

Conversation

jastice
Copy link
Contributor

@jastice jastice commented Apr 8, 2016

Adds tasks buildInfoValues and buildInfoStringValues which expose the List of BuildInfoResult 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.

@jastice
Copy link
Contributor Author

jastice commented Apr 18, 2016

@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)
Copy link
Member

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.

Copy link
Contributor Author

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.
@jastice
Copy link
Contributor Author

jastice commented May 2, 2016

@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")
Copy link
Member

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?

Copy link
Contributor Author

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?

Copy link
Member

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.

Copy link
Contributor Author

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

@eed3si9n
Copy link
Member

eed3si9n commented May 2, 2016

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?

@jastice
Copy link
Contributor Author

jastice commented May 2, 2016

Great! I opened a new PR #89

@jastice jastice closed this May 2, 2016
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

Successfully merging this pull request may close these issues.

2 participants