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

Add support for versions with less segments (#212) #214

Merged
merged 6 commits into from
May 22, 2018

Conversation

2m
Copy link
Contributor

@2m 2m commented May 22, 2018

Fixes #212


log.info(s"$projectName: found ${backErrors.size+forwErrors.size} potential binary incompatibilities while checking against $module $filteredNote")
((backErrors map {p: core.Problem => prettyPrint(p, "current")}) ++
(forwErrors map {p: core.Problem => prettyPrint(p, "other")})) foreach { log.info }
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should preserve the logic that bumps this to up to warn/error level, not just info level.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay.

val (epoch, major, minor) = version match {
case ModuleVersion(e, m, mi) => (e, m, mi)
case ModuleVersion(e, m, null) => (e, m, "0")
case ModuleVersion(e, null, null) => (e, "0", "0")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think these aren't going to ever match. The first one will always match:

Welcome to Scala 2.12.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_144).
Type in expressions for evaluation. Or try :help.

scala> val ModuleVersion = """(\d+)\.?(\d+)?\.?(.*)?""".r
ModuleVersion: scala.util.matching.Regex = (\d+)\.?(\d+)?\.?(.*)?

scala> def check(version: String) = {
     |   val (epoch, major, minor) = version match {
     |   case ModuleVersion(e, m, mi) => (e, m, mi)
     |   case ModuleVersion(e, m, null) => (e, m, "0")
     |   case ModuleVersion(e, null, null) => (e, "0", "0")
     | }
     | (epoch, major, minor)
     | }
check: (version: String)(String, String, String)

scala> check("1.2.3")
res0: (String, String, String) = (1,2,3)

scala> check("1.2")
res1: (String, String, String) = (1,2,"")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, your totally right. I got that wrong.

Copy link
Collaborator

@dwijnand dwijnand left a comment

Choose a reason for hiding this comment

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

Thanks for looking at this @2m!

I have a couple of concerns. One about what looks to me like a regression in logging behaviour that seems accidental. The second is around the version matching code logic.

But other than that, this looks good to go to me!

@2m
Copy link
Contributor Author

2m commented May 22, 2018

Thanks for a quick review. Pushed more commits that address the feedback.

(forwErrors map {p: core.Problem => prettyPrint(p, "other")})) foreach { log.error }
(forwErrors map {p: core.Problem => prettyPrint(p, "other")})) foreach { p =>
if (failOnProblem) log.error(p)
else log.info(p)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's keep warning in this case, IMO.

@dwijnand dwijnand merged commit fcdf18a into lightbend-labs:master May 22, 2018
@dwijnand
Copy link
Collaborator

Thanks @2m!

@2m 2m deleted the wip-smaller-versions-2m branch May 22, 2018 11:21
@2m 2m added this to the 0.2.1 milestone May 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants