On Fri, 4 Jan 2013 14:15:35 -0800
Grzegorz Kossakowski <
grzegorz.k...@gmail.com> wrote:
> Hi,
>
> I'd like to restart discussion about binary compatibility assumptions in
> sbt. This is continuation of the discussion in
>
https://github.com/harrah/xsbt/pull/600. I expect our discussion to
> continue for a while that's why I decided to start a new thread on mailing
> list.
>
> The latest proposal by Mark is here:
>
https://github.com/harrah/xsbt/pull/600#issuecomment-11885342
>
> Being Scala compiler hacker I mostly understand binary compatibility
> considerations related to Scala itself. I'd like other people (probably
> Mark) to comment on sbt plugins and binary compatibility.
The RCs for 0.12.0 were all binary compatible with each other and what became 0.12.0. It is not guaranteed, but it is true often enough that the sbt major.minor version is sufficient for versioning plugins.
[...]
> Based on all of that we can design a function isAPICompatible (mentioned
> here <
https://github.com/harrah/xsbt/pull/600#issuecomment-11593459>):
The brief context is that isAPICompatible is used to determine whether the cross-version suffix should be major.minor or the full version. Only if isAPICompatible is true for a version is major.minor used.
> 1. Parse version into {epoch: Int}.{major: Int}.{minor:
> Int}[-{qualifier: String}] format. If there's a parsing error, issue a
> warning and return false.
> 2. Once we have version parsed, we can express the logic using pattern
> matching:
> version match {
> case (_, major, _, _) if major < 9 => false // no compatibility
Although it seems very unlikely that any sbt version released now will work with Scala 3+, we should not guarantee it will fail. Someone would have to remember to update this method for 3.0 in any case.
> case (_, _, 0, None) => true // covers 2.10.0; major release has been
> increased and this is a base-point
> case (2, 9, 0, Some("1")) => true // special case for 2.9.0-1 hot fix
> release
> case (_, _, 0, Some(_)) => false // covers 2.10.0-M1, 2.10.0-RC1 and
> 2.10.0-SNAPSHOT
> case _ => true // minor > 0, covers 2.9.1-1, 2.10.1, 2.10.1-RC1,
> 2.10.1-SNAPSHOT
> }
isAPICompatible must be consistent across all sbt versions used for a version of Scala. This means that the cross-version suffixes for Scala versions 2.10 and earlier are fixed and cannot change. Consider an sbt 0.12 user publishing for 2.9.2 and 2.10.0. Their cross version suffixes will be _2.9.2 and _2.10. An sbt 0.13 user with the above function would have suffixes of _2.9 and _2.10. Thus, they would not agree on the 2.9 suffix.
If this change is made, it must be made well in advance of 2.11 so that all 2.11 prerelease users are on 0.13. It is only even reasonable to require an update to 0.13 because prerelease users are a smaller group and more likely to be able to update. Those that don't can use the previous technique.
The 2.10.0-* case doesn't matter anymore, since no one will be publishing for those versions. Any changes should only apply to 2.11 or later to ensure compatibility with the current behavior for released Scala versions.
-Mark