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

Fix dynverAssertTagVersion #255

Merged

Conversation

eed3si9n
Copy link
Member

Fixes #254
Ref #252 /cc @mkurz

Problem
dynverAssertTagVersion currently throws NPE.

[info] [info] Loading settings from plugins.sbt ...
[info] [info] Loading project definition from /.../assert-tag-version-ok/project
[info] [info] Loading settings from build.sbt ...
[info] [error] java.lang.NullPointerException
[info] [error] 	at sbt.internal.util.Init$$anon$11.apply(Settings.scala:690)
[info] [error] 	at sbt.internal.util.Init$$anon$11.apply(Settings.scala:690)
[info] [error] 	at sbt.internal.util.AList$$anon$6.transform(AList.scala:102)
[info] [error] 	at sbt.internal.util.AList$$anon$6.transform(AList.scala:100)
[info] [error] 	at sbt.internal.util.Init$Apply.mapInputs(Settings.scala:837)
[info] [error] 	at sbt.internal.util.Init$Apply.mapReferenced(Settings.scala:832)
[info] [error] 	at sbt.internal.util.Init$Setting.mapReferenced(Settings.scala:599)
[info] [error] 	at sbt.Project$.$anonfun$transform$1(Project.scala:530)

Solution
Make things lazy to fix the bug.

**Problem**
dynverAssertTagVersion currently throws NPE.
```
[info] [info] Loading settings from plugins.sbt ...
[info] [info] Loading project definition from /.../assert-tag-version-ok/project
[info] [info] Loading settings from build.sbt ...
[info] [error] java.lang.NullPointerException
[info] [error] 	at sbt.internal.util.Init$$anon$11.apply(Settings.scala:690)
[info] [error] 	at sbt.internal.util.Init$$anon$11.apply(Settings.scala:690)
[info] [error] 	at sbt.internal.util.AList$$anon$6.transform(AList.scala:102)
[info] [error] 	at sbt.internal.util.AList$$anon$6.transform(AList.scala:100)
[info] [error] 	at sbt.internal.util.Init$Apply.mapInputs(Settings.scala:837)
[info] [error] 	at sbt.internal.util.Init$Apply.mapReferenced(Settings.scala:832)
[info] [error] 	at sbt.internal.util.Init$Setting.mapReferenced(Settings.scala:599)
[info] [error] 	at sbt.Project$.$anonfun$transform$1(Project.scala:530)
```

**Solution**
Make things lazy to fix the bug.

Co-authored-by: Matthias Kurz <[email protected]>
Co-authored-by: eugene yokota <[email protected]>
Copy link
Member

@mkurz mkurz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tested this patch locally as well and can confirm now things work.

Looking forward to a patch release 😉
Thanks!

version := {
val orig = version.value
if (orig.endsWith("-SNAPSHOT")) "5.0.1-SNAPSHOT"
else orig
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: I see what you did here. Actually there is an closed issue you might be interested in: #227
In Play we came up with a more dynamic solution for now:

IMHO setting the version to the next major/minor/patch release (snapshot) version should be a feature of sbt-dynver. Haven't had time yet to come up with a pr however...

@eed3si9n eed3si9n merged commit a035967 into sbt:main May 1, 2023
@eed3si9n eed3si9n deleted the wip/reproduce_dynverAssertTagVersion_null branch May 1, 2023 20:37
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.

dynverAssertTagVersion throws NullPointerException
2 participants