scala-steward icon indicating copy to clipboard operation
scala-steward copied to clipboard

Pinning of different versions for the same artifact

Open RustedBones opened this issue 2 years ago • 1 comments

We have a use case where we want to pin different major versions of the same artifact in a multi module setup eg:

  • elasticsearch-7 module depending on "org.elasticsearch" % "elasticsearch" % elasticsearch7Version
  • elasticsearch-8 module depending on "org.elasticsearch" % "elasticsearch" % elasticsearch8Version

Having in the .scala-steward.conf

updates.pin = [
  { groupId = "org.elasticsearch", version = "7." },
  { groupId = "org.elasticsearch", version = "8." }
]

Will not prevent scala-steward to update elasticsearch7Version to 8.x.x because UpdatePattern only checks against the newer version and will find a matching rule.

There has been some mention of using a // scala-steward:only 7.x.x marker in https://github.com/scala-steward-org/scala-steward/pull/671 but has been discarded in favour of the sbt version range. However, this last solution doesn't give maintainers control on when to update.

Is there a solution or workaround for this use-case ?

RustedBones avatar Apr 29 '22 10:04 RustedBones

Throwing a random idea here (may be it deserves separate issue). Instead of pinning multiple versions together, which doesn't allow steward to distinguish between the two in sbt defined codes - introduce a profile pattern. That some of the settings could be applied running only with some profile enabled.

This would require

  • new command line flag to enable profiles
  • support for overriding settings in different profiles - profile named section in configs
  • support for specifying profile in steward off/on switches.

There will be overhead that you need to run steward multiple times to apply different profiles. Or one should allow the steward process to restart itself for every selected profile (which looks better to me).

arixmkii avatar Jun 21 '22 15:06 arixmkii