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

BuildInfoOption.ConstantValue #164

Merged
merged 1 commit into from
Aug 9, 2020
Merged

BuildInfoOption.ConstantValue #164

merged 1 commit into from
Aug 9, 2020

Conversation

eed3si9n
Copy link
Member

@eed3si9n eed3si9n commented Aug 8, 2020

This is a rework of #140

Looking closely it doesn't look like ScalaFinalCaseObjectRenderer added in #140 is actually going to be useful since it just added final in front of all vals.

This provides fix for #127 by generating constant value definition for Int, Long, Double, Boolean, Symbol, and String.

This allows the values to be used in annotation as the scripted test show. Note due to constant folding using this is not recommended for libraries.

usage

buildInfoOptions ++= Seq(BuildInfoOption.ConstantValue, BuildInfoOption.PackagePrivate),

This should generate

final val name = "helloworld"

@eed3si9n eed3si9n added this to the 0.10.0 milestone Aug 8, 2020
This is a rework of #140

Looking closely it doesn't look like `ScalaFinalCaseObjectRenderer` added in #140 is actually going to be useful since it just added `final` in front of all vals.

This provides fix for #127 by generating [constant value definition](https://www.scala-lang.org/files/archive/spec/2.12/04-basic-declarations-and-definitions.html#value-declarations-and-definitions) for `Int`, `Long`, `Double`, `Boolean`, `Symbol`, and `String`.

This allows the values to be used in annotation as the scripted test show. Note due to constant folding using this is not recommended for libraries.
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.

1 participant