From 3f16363cbfd6d2aafc8cd159fdfeb323607cebd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fede=20Fern=C3=A1ndez?= <720923+fedefernandez@users.noreply.github.com> Date: Thu, 17 Nov 2022 15:28:34 +0100 Subject: [PATCH 1/3] Bumps sbt header --- .../project/plugins.sbt | 2 +- .../sbt-github-header/fail-if-no-license/project/plugins.sbt | 2 +- .../sbt-github-header/fail-if-no-year-range/project/plugins.sbt | 2 +- .../fail-if-unable-to-infer-license/project/plugins.sbt | 2 +- .../project/plugins.sbt | 2 +- .../project/plugins.sbt | 2 +- project/plugins.sbt | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/sbt-github-header/src/sbt-test/sbt-github-header/create-apache-headers-with-downloaded-info/project/plugins.sbt b/modules/sbt-github-header/src/sbt-test/sbt-github-header/create-apache-headers-with-downloaded-info/project/plugins.sbt index 823e2da1..5e2c1357 100644 --- a/modules/sbt-github-header/src/sbt-test/sbt-github-header/create-apache-headers-with-downloaded-info/project/plugins.sbt +++ b/modules/sbt-github-header/src/sbt-test/sbt-github-header/create-apache-headers-with-downloaded-info/project/plugins.sbt @@ -1,2 +1,2 @@ -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % sys.props("plugin.version")) diff --git a/modules/sbt-github-header/src/sbt-test/sbt-github-header/fail-if-no-license/project/plugins.sbt b/modules/sbt-github-header/src/sbt-test/sbt-github-header/fail-if-no-license/project/plugins.sbt index 823e2da1..5e2c1357 100644 --- a/modules/sbt-github-header/src/sbt-test/sbt-github-header/fail-if-no-license/project/plugins.sbt +++ b/modules/sbt-github-header/src/sbt-test/sbt-github-header/fail-if-no-license/project/plugins.sbt @@ -1,2 +1,2 @@ -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % sys.props("plugin.version")) diff --git a/modules/sbt-github-header/src/sbt-test/sbt-github-header/fail-if-no-year-range/project/plugins.sbt b/modules/sbt-github-header/src/sbt-test/sbt-github-header/fail-if-no-year-range/project/plugins.sbt index 823e2da1..5e2c1357 100644 --- a/modules/sbt-github-header/src/sbt-test/sbt-github-header/fail-if-no-year-range/project/plugins.sbt +++ b/modules/sbt-github-header/src/sbt-test/sbt-github-header/fail-if-no-year-range/project/plugins.sbt @@ -1,2 +1,2 @@ -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % sys.props("plugin.version")) diff --git a/modules/sbt-github-header/src/sbt-test/sbt-github-header/fail-if-unable-to-infer-license/project/plugins.sbt b/modules/sbt-github-header/src/sbt-test/sbt-github-header/fail-if-unable-to-infer-license/project/plugins.sbt index 823e2da1..5e2c1357 100644 --- a/modules/sbt-github-header/src/sbt-test/sbt-github-header/fail-if-unable-to-infer-license/project/plugins.sbt +++ b/modules/sbt-github-header/src/sbt-test/sbt-github-header/fail-if-unable-to-infer-license/project/plugins.sbt @@ -1,2 +1,2 @@ -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % sys.props("plugin.version")) diff --git a/modules/sbt-github-header/src/sbt-test/sbt-github-header/use-organization-name-and-homepage-as-copyright-owner/project/plugins.sbt b/modules/sbt-github-header/src/sbt-test/sbt-github-header/use-organization-name-and-homepage-as-copyright-owner/project/plugins.sbt index 823e2da1..5e2c1357 100644 --- a/modules/sbt-github-header/src/sbt-test/sbt-github-header/use-organization-name-and-homepage-as-copyright-owner/project/plugins.sbt +++ b/modules/sbt-github-header/src/sbt-test/sbt-github-header/use-organization-name-and-homepage-as-copyright-owner/project/plugins.sbt @@ -1,2 +1,2 @@ -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % sys.props("plugin.version")) diff --git a/modules/sbt-github-header/src/sbt-test/sbt-github-header/use-organization-name-as-copyright-owner/project/plugins.sbt b/modules/sbt-github-header/src/sbt-test/sbt-github-header/use-organization-name-as-copyright-owner/project/plugins.sbt index 823e2da1..5e2c1357 100644 --- a/modules/sbt-github-header/src/sbt-test/sbt-github-header/use-organization-name-as-copyright-owner/project/plugins.sbt +++ b/modules/sbt-github-header/src/sbt-test/sbt-github-header/use-organization-name-as-copyright-owner/project/plugins.sbt @@ -1,2 +1,2 @@ -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % sys.props("plugin.version")) diff --git a/project/plugins.sbt b/project/plugins.sbt index 307c5d43..b00d7285 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,7 +4,7 @@ addSbtPlugin("com.alejandrohdezma" % "sbt-ci" % "2.9.0") addSbtPlugin("com.alejandrohdezma" % "sbt-scalafmt-defaults" % "0.7.1") addSbtPlugin("com.alejandrohdezma" % "sbt-scalafix-defaults" % "0.10.0") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.11") -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.1") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.6") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") From 7ed0f05a948bc11cb3e52a7d22748bf5ba334e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Herna=CC=81ndez?= Date: Sat, 19 Nov 2022 08:33:31 +0100 Subject: [PATCH 2/3] Update `SbtGithubHeaderPlugin` to latest version of `sbt-header` --- .../sbtheader/SbtGithubHeaderPlugin.scala | 30 +++++-------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/modules/sbt-github-header/src/main/scala/com/alejandrohdezma/sbt/github/sbtheader/SbtGithubHeaderPlugin.scala b/modules/sbt-github-header/src/main/scala/com/alejandrohdezma/sbt/github/sbtheader/SbtGithubHeaderPlugin.scala index 1ade3e16..8c7c955c 100644 --- a/modules/sbt-github-header/src/main/scala/com/alejandrohdezma/sbt/github/sbtheader/SbtGithubHeaderPlugin.scala +++ b/modules/sbt-github-header/src/main/scala/com/alejandrohdezma/sbt/github/sbtheader/SbtGithubHeaderPlugin.scala @@ -16,8 +16,6 @@ package com.alejandrohdezma.sbt.github.sbtheader -import scala.collection.breakOut - import sbt.Def import sbt.Keys._ import sbt._ @@ -26,8 +24,7 @@ import com.alejandrohdezma.sbt.github.SbtGithubPlugin import com.alejandrohdezma.sbt.github.SbtGithubPlugin.autoImport._ import de.heikoseeberger.sbtheader.HeaderPlugin import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport._ -import de.heikoseeberger.sbtheader.License._ -import de.heikoseeberger.sbtheader.SpdxLicense +import de.heikoseeberger.sbtheader.LicenseDetection /** Populates the `headerLicense` setting from [[https://github.com/sbt/sbt-header sbt-header]] with values extracted * from Github by `SbtGithubPlugin`: @@ -57,26 +54,15 @@ object SbtGithubHeaderPlugin extends AutoPlugin { override def requires: Plugins = HeaderPlugin && SbtGithubPlugin - private val spdxMapping = - Vector( - ALv2, MIT, MPLv2, BSD2Clause, BSD3Clause, GPLv3OrLater, GPLv3Only, GPLv3, LGPLv3OrLater, LGPLv3Only, LGPLv3, - AGPLv3OrLater, AGPLv3Only, AGPLv3 - ).map(l => (l.spdxIdentifier, l))(breakOut): Map[String, SpdxLicense] - override def projectSettings: Seq[Def.Setting[_]] = Seq( - headerLicense := { - val licenseName = licenses.value match { - case (name, _) :: Nil => Some(name) - case _ => None - } - - for { - name <- licenseName - license <- spdxMapping.get(name) - year <- yearRange.value - } yield license(year, copyrightOwner.value, headerLicenseStyle.value) - }, + headerLicense := LicenseDetection( + licenses.value.toList, + copyrightOwner.value, + startYear.value, + yearRange.value.flatMap(_.split("-").lastOption).map(_.toInt), + headerLicenseStyle.value + ), copyrightOwner := { organizationHomepage.value .map(url => s"${organizationName.value} <$url>") From c382d72b08eb374fb1f273526eb85eeb36fc7578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Herna=CC=81ndez?= Date: Tue, 22 Nov 2022 07:51:15 +0100 Subject: [PATCH 3/3] Use `yearRange` instead of `startYear` --- .../sbt/github/sbtheader/SbtGithubHeaderPlugin.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/sbt-github-header/src/main/scala/com/alejandrohdezma/sbt/github/sbtheader/SbtGithubHeaderPlugin.scala b/modules/sbt-github-header/src/main/scala/com/alejandrohdezma/sbt/github/sbtheader/SbtGithubHeaderPlugin.scala index 8c7c955c..25a54027 100644 --- a/modules/sbt-github-header/src/main/scala/com/alejandrohdezma/sbt/github/sbtheader/SbtGithubHeaderPlugin.scala +++ b/modules/sbt-github-header/src/main/scala/com/alejandrohdezma/sbt/github/sbtheader/SbtGithubHeaderPlugin.scala @@ -59,7 +59,7 @@ object SbtGithubHeaderPlugin extends AutoPlugin { headerLicense := LicenseDetection( licenses.value.toList, copyrightOwner.value, - startYear.value, + yearRange.value.flatMap(_.split("-").headOption).map(_.toInt), yearRange.value.flatMap(_.split("-").lastOption).map(_.toInt), headerLicenseStyle.value ),