-
Notifications
You must be signed in to change notification settings - Fork 507
Description
At our company, we release two libraries together with the same version number:
com.example:foo-lastmile
and
com.example:foo-scorer
.
Scala Steward does not update one project that relies on both dependencies. Through debugging, I was able to figure out that the names of the dependencies plays a role. Scala Steward sorts updates by name; therefore, the Update.Group
will contain foo-lastmile
first and foo-scorer
second.
This update fails, as the following test proves:
test("fails") {
val original =
"""private val version = "1.0.0"
|
|lazy val foo = "com.example" % "foo-lastmile" % version
|lazy val foo = "com.example" % "foo-scorer" % version
|""".stripMargin
val expected =
"""private val version = "1.1.0"
|
|lazy val foo = "com.example" % "foo-lastmile" % version
|lazy val foo = "com.example" % "foo-scorer" % version
|""".stripMargin
val update = ("com.example".g % Nel.of(
"foo-lastmile".a,
"foo-scorer".a,
) % "1.0.0" %> "1.1.0").group
assertEquals(update.replaceVersionIn(original)._1, Some(expected))
}
However, if we change the name of foo-lastmile
to foo-zzz
so that it comes after foo-scorer
, the test suddenly passes:
test("passes") {
val original =
"""private val version = "1.0.0"
|
|lazy val foo = "com.example" % "foo-zzz" % version
|lazy val foo = "com.example" % "foo-scorer" % version
|""".stripMargin
val expected =
"""private val version = "1.1.0"
|
|lazy val foo = "com.example" % "foo-zzz" % version
|lazy val foo = "com.example" % "foo-scorer" % version
|""".stripMargin
val update = ("com.example".g % Nel.of(
"foo-scorer".a,
"foo-zzz".a,
) % "1.0.0" %> "1.1.0").group
assertEquals(update.replaceVersionIn(original)._1, Some(expected))
}
In other words, the alphabetical order of the dependencies' names being updated plays a role in whether Scala Steward can update them or not, and I think this should not be the case.
This was tested on version 0.15.0.
I'd be happy to assist in investigating the problem. I tried to understand the update heuristics' code, but found the logic quite hard to follow, so I would need to pair on that with someone.