Skip to content

BuildInfoOption.ConstantValue #164

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

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.
@eed3si9n eed3si9n force-pushed the wip/constantvalue branch from b4d1990 to 0842feb Compare August 9, 2020 00:09
@eed3si9n eed3si9n merged commit 70b933c into master Aug 9, 2020
@eed3si9n eed3si9n deleted the wip/constantvalue branch August 9, 2020 00:57
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