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

Support declaring backwards compatibility with older versions outside of version scheme #198

Open
lolgab opened this issue Mar 23, 2024 · 1 comment

Comments

@lolgab
Copy link

lolgab commented Mar 23, 2024

Sometimes a stable library in its 0.x version decides to release a stable 1.x version since it has a stable API and it wants to communicate with its users.
According to versioning scheme these two libraries are not binary compatible. However, sometimes the 1.x version is backward compatible with the previous 0.x release.
This feature request is about adding a new field in the library pom of the new version to state that is compatible with the older binary version.
In the example of cats-parse. It should contain a new field in properties, like <info.backwardsCompatibleWith>0.3</info.backwardsCompatibleWith>
When cats-parse 1.0.0 and 0.3.10 are resolved Sbt should not report any warning since they are binary compatible with each other.

This issue was first reported in Typelevel Discord by @s5bug

@lolgab lolgab changed the title Support binary compatible Supprot declaring backwards compatibility with older versions outside of version scheme Mar 23, 2024
@lolgab lolgab changed the title Supprot declaring backwards compatibility with older versions outside of version scheme Support declaring backwards compatibility with older versions outside of version scheme Mar 23, 2024
@julienrf
Copy link
Collaborator

julienrf commented Mar 23, 2024

Thank you @lolgab for the write up.

I agree this problem should be addressed. I remember scala-xml was in a similar situation when they decided to release a 1.0.0 version.

I think a sister issue should be created in the sbt repository to make sure sbt correctly interprets info.backwardsBinaryCompatibleWith. Maybe a similar issue should be created in the other Scala build tools?

Note that it is possible to do what you want today already:

  • set versionPolicyIntention := Compatibility.BinaryCompatible in your 0.x branch
  • make sure to run the task versionPolicyCheck in the CI
  • before you release version 1.0.0, add the following configuration to the published artifacts:
    projectID ~= { id =>
      val backwardsCompatibilityInfo = "info.backwardsBinaryCompatibleWith" -> "0.3"
      id.withExtraAttributes(id.extraAttributes + backwardsCompatibilityInfo)
    }

We could probably automate the part the configures the projectID key in sbt-version-policy, though, but that needs to be investigated further.

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

No branches or pull requests

2 participants