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

Fix SUPPORTED_SCALA_VERSIONS variable so it contains short versions, not full #513

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.alejandrohdezma.sbt.github.mdoc

import sbt.Keys._
import sbt._
import sbt.librarymanagement.CrossVersion

import com.alejandrohdezma.sbt.github.SbtGithubPlugin
import com.alejandrohdezma.sbt.github.SbtGithubPlugin.autoImport._
Expand Down Expand Up @@ -113,7 +114,11 @@ object SbtGithubMdocPlugin extends AutoPlugin {
)

private val supportedScalaVersionsForMDoc: Def.Initialize[String] = Def.setting {
crossScalaVersions.value.map(version => s"`$version`") match {
val versions = crossScalaVersions.value
.map(CrossVersion.binaryScalaVersion(_))
.map(version => s"`$version`")

versions match {
case list :+ last => s"${list.mkString(", ")} and $last"
case head :: Nil => head
case Nil => ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ https://github.com/user1

The First User <https://github.com/user1>

`2.12.18`, `2.13.12` and `3.3.0`
`2.12`, `2.13` and `3`
39 changes: 20 additions & 19 deletions website/docs/integrations/sbt-mdoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,23 @@ So we don't force a version of mdoc, it is requested as a ["Provided"](https://m

The plugin provides the following `mdocVariables`:

| Variable | Content |
|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **VERSION** | Set to the value of the `version` setting by removing the timestamp part (this behavior can be disabled using the `removeVersionTimestampInMdoc` setting) |
| **CONTRIBUTORS** | Set to the value of the `contributors` setting, containing the list of repository contributors in markdown format |
| **CONTRIBUTORS_TABLE** | Set to the value of the `contributors` setting, containing the list of repository contributors as a markdown table |
| **COLLABORATORS** | Set to the value of the `collaborators` setting, containing the list of repository collaborators in markdown format |
| **COLLABORATORS_TABLE** | Set to the value of the `collaborators` setting, containing the list of repository collaborators as a markdown table |
| **NAME** | Set to the value of `displayName`. Defaults to repository's name. |
| **ORGANIZATION** | Set to the value of `organization` |
| **DESCRIPTION** | Set to the value of `description` |
| **LICENSE** | Set to the license's name |
| **ORG_NAME** | Set to the value of `organizationName` setting (Github's organization name or owner's in case organization is empty and `populateOrganizationWithOwner` is `true`) |
| **ORG_EMAIL** | Set to the value of `organizationEmail` setting (Github's organization email, or owner's in case organization is empty and `populateOrganizationWithOwner` is `true`) |
| **ORG_URL** | Set to the value of `organizationHomepage` setting (Github's organization homepage or owner's in case organization is empty and `populateOrganizationWithOwner` is `true`) |
| **REPO** | Set to the repository's path: "owner/repo" |
| **DEFAULT_BRANCH** | Set to the repository's default branch |
| **START_YEAR** | Set to the value of the `startYear` setting |
| **YEAR_RANGE** | Set to the value of the `yearRange` setting |
| **COPYRIGHT_OWNER** | Set to the value of `ORG_NAME <ORG_URL>` if `ORG_URL` is present or just `ORG_NAME` in case `ORG_URL` is empty |
| Variable | Content |
|------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **VERSION** | Set to the value of the `version` setting by removing the timestamp part (this behavior can be disabled using the `removeVersionTimestampInMdoc` setting) |
| **CONTRIBUTORS** | Set to the value of the `contributors` setting, containing the list of repository contributors in markdown format |
| **CONTRIBUTORS_TABLE** | Set to the value of the `contributors` setting, containing the list of repository contributors as a markdown table |
| **COLLABORATORS** | Set to the value of the `collaborators` setting, containing the list of repository collaborators in markdown format |
| **COLLABORATORS_TABLE** | Set to the value of the `collaborators` setting, containing the list of repository collaborators as a markdown table |
| **NAME** | Set to the value of `displayName`. Defaults to repository's name. |
| **ORGANIZATION** | Set to the value of `organization` |
| **DESCRIPTION** | Set to the value of `description` |
| **LICENSE** | Set to the license's name |
| **ORG_NAME** | Set to the value of `organizationName` setting (Github's organization name or owner's in case organization is empty and `populateOrganizationWithOwner` is `true`) |
| **ORG_EMAIL** | Set to the value of `organizationEmail` setting (Github's organization email, or owner's in case organization is empty and `populateOrganizationWithOwner` is `true`) |
| **ORG_URL** | Set to the value of `organizationHomepage` setting (Github's organization homepage or owner's in case organization is empty and `populateOrganizationWithOwner` is `true`) |
| **REPO** | Set to the repository's path: "owner/repo" |
| **DEFAULT_BRANCH** | Set to the repository's default branch |
| **START_YEAR** | Set to the value of the `startYear` setting |
| **YEAR_RANGE** | Set to the value of the `yearRange` setting |
| **COPYRIGHT_OWNER** | Set to the value of `ORG_NAME <ORG_URL>` if `ORG_URL` is present or just `ORG_NAME` in case `ORG_URL` is empty |
| **SUPPORTED_SCALA_VERSIONS** | Set to the value of `crossScalaVersions`, containing the list of supported Scala versions in markdown format |