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

Better support for sbt artifacts in the Scaladex badge #674

Merged
merged 3 commits into from
Jul 5, 2021

Conversation

rtyley
Copy link
Contributor

@rtyley rtyley commented Jul 4, 2021

Each release of sbt uses a specific version of Scala (1.0 uses Scala 2.12, 0.13 uses Scala 2.10), so the sbt version of a plugin fully determines the Scala language binary version it uses - this means, for a user, it's only really interesting to know the sbt version of the plugin, not the Scala language version.

At the moment, the Scaladex badge for, eg, the sbt-assembly plugin reads:

sbt-assembly Scala version support (1.0.0 (Scala 2.12, 2.10))

...for the user, it would be more helpful if it read:

sbt-assembly Scala version support (1.0.0 (sbt 1.0, 0.13))

...listing the versions of sbt you can actually use it with! Although the Scaladex badge did have some logic to display the platform versions supported by all listed Scala language versions, that doesn't help in this situation, as the Scala language version differs for each platform version of sbt. See also this comment from a prior PR.

This PR refactors the Scaladex badge logic to have two version-summary strategies:

  • SummariseLanguageVersion - which was the existing strategy, listing notable Scala version support, secondarily adding in a summary of platform editions (eg 'Scala 2.13 - Native 0.4+0.3')
  • SummarisePlatformEdition - the new strategy, which is used if all fetched ScalaTargets for an artifact have a targetType for which the platform version fully determines the Scala version (as is the case for sbt). It omits the Scala version from the summary, and just relates the platform versions (eg sbt 1.0, 0.13)

The refactor is quite a substantial rearrangement of the code in BadgesSupport.scala unfortunately, and so the diff is quite hard to read - might be better to just read the updated final version. Tests in BadgesSupportTest.scala have been added/updated to check for the new sbt case.

cc @adpi2

Each release of sbt uses a specific version of Scala (1.0 uses Scala 2.12,
0.13 uses Scala 2.10), so the sbt version of a plugin fully determines the
Scala language binary version it uses - this means, for a user, it's only
really interesting to know the sbt version of the plugin, not the Scala
language version.

At the moment, the Scaladex badge for, eg, the `sbt-assembly` plugin reads
`1.0.0 (Scala 2.12, 2.10)` - for the user, it would be more helpful if it
read `1.0.0 (sbt 1.0, 0.13)` - listing the versions of sbt you can actually
use it with! Although the Scaladex badge did have some logic to display the
platform versions supported by _all_ listed Scala language versions, that
doesn't help in this situation, as the Scala language version differs for
each platform version of sbt. See also this comment from a prior PR:

scalacenter#670 (comment)

This commit updates the Scaladex badge logic to have two version-summary
strategies:

* `SummariseLanguageVersion` - which was the existing strategy, listing
  notable Scala version support, secondarily adding in a summary of
  platform editions (eg 'Scala 2.13 - Native 0.4+0.3')
* `SummarisePlatformEdition` - the new strategy, which is used if *all*
  fetched `ScalaTarget`s for an artifact have a `targetType` for which
  the platform version fully determines the Scala version (as is the case
  for sbt). It omits the Scala version from the summary, and just relates
  the platform versions (eg `sbt 1.0, 0.13`)
Copy link
Member

@adpi2 adpi2 left a comment

Choose a reason for hiding this comment

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

Two minor comments, otherwise LGTM. Thanks for improving this!

@adpi2 adpi2 merged commit 9dc8ca0 into scalacenter:main Jul 5, 2021
@rtyley
Copy link
Contributor Author

rtyley commented Jul 5, 2021

Thanks! Looks good in prod on, eg, https://index-dev.scala-lang.org/sbt/sbt-assembly/sbt-assembly#badge-markdown :

image

rtyley added a commit to rtyley/sbt-assembly that referenced this pull request Jul 5, 2021
Unfortunately the Bintray badge just reads 'no longer available' these days, I guess due to https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/ . The new Scaladex badge can replace the old Bintray badge. It summarises which versions of sbt are supported by sbt-assembly (and what the latest sbt-assembly version is for each of those sbt versions):

[![sbt-assembly Scala version support](https://index.scala-lang.org/sbt/sbt-assembly/sbt-assembly/latest-by-scala-version.svg?targetType=Sbt)](https://index.scala-lang.org/sbt/sbt-assembly/sbt-assembly)

More details on the badge format here: https://github.com/scalacenter/scaladex/pull/#660 - with some extra changes to better support sbt in scalacenter/scaladex#674.
rtyley added a commit to rtyley/sbt-native-packager that referenced this pull request Jul 5, 2021
Unfortunately the Bintray badge on the readme is broken, I guess due to Bintray being [sunset](https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/)? However, this new Scaladex badge can replace the old Bintray badge - it summarises which versions of sbt are supported by sbt-native-packager (and what the latest sbt-native-packager version is for each of those sbt versions):

[![sbt-native-packager Scala version support](https://index.scala-lang.org/sbt/sbt-native-packager/sbt-native-packager/latest-by-scala-version.svg?targetType=Sbt)](https://index.scala-lang.org/sbt/sbt-native-packager/sbt-native-packager)

More details on the badge format here: scalacenter/scaladex#660 (with some extra changes to better support sbt in scalacenter/scaladex#674).
rtyley added a commit to rtyley/sbt-release that referenced this pull request Jul 5, 2021
The Scaladex badge is a bit more helpful than the Maven Central badge - it summarises which versions of sbt are supported by sbt-release (and what the latest sbt-release version is for each of those sbt versions):

[![sbt-release Scala version support](https://index.scala-lang.org/sbt/sbt-release/sbt-release/latest-by-scala-version.svg?targetType=Sbt)](https://index.scala-lang.org/sbt/sbt-release/sbt-release)

More details on the badge format here: scalacenter/scaladex#660 (with some extra changes to better support sbt in scalacenter/scaladex#674).
xuwei-k pushed a commit to sbt/sbt-release that referenced this pull request Jul 5, 2021
The Scaladex badge is a bit more helpful than the Maven Central badge - it summarises which versions of sbt are supported by sbt-release (and what the latest sbt-release version is for each of those sbt versions):

[![sbt-release Scala version support](https://index.scala-lang.org/sbt/sbt-release/sbt-release/latest-by-scala-version.svg?targetType=Sbt)](https://index.scala-lang.org/sbt/sbt-release/sbt-release)

More details on the badge format here: scalacenter/scaladex#660 (with some extra changes to better support sbt in scalacenter/scaladex#674).
muuki88 pushed a commit to sbt/sbt-native-packager that referenced this pull request Jul 8, 2021
Unfortunately the Bintray badge on the readme is broken, I guess due to Bintray being [sunset](https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/)? However, this new Scaladex badge can replace the old Bintray badge - it summarises which versions of sbt are supported by sbt-native-packager (and what the latest sbt-native-packager version is for each of those sbt versions):

[![sbt-native-packager Scala version support](https://index.scala-lang.org/sbt/sbt-native-packager/sbt-native-packager/latest-by-scala-version.svg?targetType=Sbt)](https://index.scala-lang.org/sbt/sbt-native-packager/sbt-native-packager)

More details on the badge format here: scalacenter/scaladex#660 (with some extra changes to better support sbt in scalacenter/scaladex#674).
rtyley added a commit to rtyley/sbt-buildinfo that referenced this pull request Nov 12, 2021
Unfortunately the Bintray badge on the readme just reads [_'no longer available'_](https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/) these days:

![Bintray version](https://img.shields.io/bintray/v/eed3si9n/sbt-plugins/sbt-buildinfo.svg)

However, this new Scaladex badge can replace the old Bintray badge - it summarises which versions of sbt are supported by sbt-buildinfo (and what the latest sbt-buildinfo version is for each of those sbt versions):

[![sbt-buildinfo Scala version support](https://index.scala-lang.org/sbt/sbt-buildinfo/sbt-buildinfo/latest-by-scala-version.svg?targetType=Sbt)](https://index.scala-lang.org/sbt/sbt-buildinfo/sbt-buildinfo)

More details on the badge format here: scalacenter/scaladex#660 (with sbt-focused support in scalacenter/scaladex#674).
rtyley added a commit to rtyley/sbt-updates that referenced this pull request Feb 11, 2022
The Scaladex badge is a bit more helpful than the Maven Central badge - it summarises which versions of sbt are supported by sbt-updates (and what the latest sbt-updates version is for each of those sbt versions:

[![sbt-updates Scala version support](https://index.scala-lang.org/rtimush/sbt-updates/sbt-updates/latest-by-scala-version.svg?targetType=Sbt)](https://index.scala-lang.org/rtimush/sbt-updates/sbt-updates)

Interestingly, at the moment, there is a new 0.6.2 release of `sbt-updates` for sbt 0.13, but not for 1.0, which wouldn't have been indicated by the old badge!

More details on the badge format here: scalacenter/scaladex#660 (with some extra changes to better support sbt in scalacenter/scaladex#674).
littleRoundaer added a commit to littleRoundaer/sbt-native-packager that referenced this pull request Jul 19, 2022
Unfortunately the Bintray badge on the readme is broken, I guess due to Bintray being [sunset](https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/)? However, this new Scaladex badge can replace the old Bintray badge - it summarises which versions of sbt are supported by sbt-native-packager (and what the latest sbt-native-packager version is for each of those sbt versions):

[![sbt-native-packager Scala version support](https://index.scala-lang.org/sbt/sbt-native-packager/sbt-native-packager/latest-by-scala-version.svg?targetType=Sbt)](https://index.scala-lang.org/sbt/sbt-native-packager/sbt-native-packager)

More details on the badge format here: scalacenter/scaladex#660 (with some extra changes to better support sbt in scalacenter/scaladex#674).
rtimush pushed a commit to rtyley/sbt-updates that referenced this pull request Nov 14, 2023
The Scaladex badge is a bit more helpful than the Maven Central badge - it summarises which versions of sbt are supported by sbt-updates (and what the latest sbt-updates version is for each of those sbt versions:

[![sbt-updates Scala version support](https://index.scala-lang.org/rtimush/sbt-updates/sbt-updates/latest-by-scala-version.svg?targetType=Sbt)](https://index.scala-lang.org/rtimush/sbt-updates/sbt-updates)

Interestingly, at the moment, there is a new 0.6.2 release of `sbt-updates` for sbt 0.13, but not for 1.0, which wouldn't have been indicated by the old badge!

More details on the badge format here: scalacenter/scaladex#660 (with some extra changes to better support sbt in scalacenter/scaladex#674).
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

Successfully merging this pull request may close these issues.

2 participants