Skip to content

Commit 56083b2

Browse files
Merge pull request #482 from alejandrohdezma/bump-sbt-header
Bump sbt header
2 parents dc75193 + c382d72 commit 56083b2

File tree

8 files changed

+15
-29
lines changed

8 files changed

+15
-29
lines changed

modules/sbt-github-header/src/main/scala/com/alejandrohdezma/sbt/github/sbtheader/SbtGithubHeaderPlugin.scala

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package com.alejandrohdezma.sbt.github.sbtheader
1818

19-
import scala.collection.breakOut
20-
2119
import sbt.Def
2220
import sbt.Keys._
2321
import sbt._
@@ -26,8 +24,7 @@ import com.alejandrohdezma.sbt.github.SbtGithubPlugin
2624
import com.alejandrohdezma.sbt.github.SbtGithubPlugin.autoImport._
2725
import de.heikoseeberger.sbtheader.HeaderPlugin
2826
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport._
29-
import de.heikoseeberger.sbtheader.License._
30-
import de.heikoseeberger.sbtheader.SpdxLicense
27+
import de.heikoseeberger.sbtheader.LicenseDetection
3128

3229
/** Populates the `headerLicense` setting from [[https://github.com/sbt/sbt-header sbt-header]] with values extracted
3330
* from Github by `SbtGithubPlugin`:
@@ -57,26 +54,15 @@ object SbtGithubHeaderPlugin extends AutoPlugin {
5754

5855
override def requires: Plugins = HeaderPlugin && SbtGithubPlugin
5956

60-
private val spdxMapping =
61-
Vector(
62-
ALv2, MIT, MPLv2, BSD2Clause, BSD3Clause, GPLv3OrLater, GPLv3Only, GPLv3, LGPLv3OrLater, LGPLv3Only, LGPLv3,
63-
AGPLv3OrLater, AGPLv3Only, AGPLv3
64-
).map(l => (l.spdxIdentifier, l))(breakOut): Map[String, SpdxLicense]
65-
6657
override def projectSettings: Seq[Def.Setting[_]] =
6758
Seq(
68-
headerLicense := {
69-
val licenseName = licenses.value match {
70-
case (name, _) :: Nil => Some(name)
71-
case _ => None
72-
}
73-
74-
for {
75-
name <- licenseName
76-
license <- spdxMapping.get(name)
77-
year <- yearRange.value
78-
} yield license(year, copyrightOwner.value, headerLicenseStyle.value)
79-
},
59+
headerLicense := LicenseDetection(
60+
licenses.value.toList,
61+
copyrightOwner.value,
62+
yearRange.value.flatMap(_.split("-").headOption).map(_.toInt),
63+
yearRange.value.flatMap(_.split("-").lastOption).map(_.toInt),
64+
headerLicenseStyle.value
65+
),
8066
copyrightOwner := {
8167
organizationHomepage.value
8268
.map(url => s"${organizationName.value} <$url>")
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0")
1+
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0")
22
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % sys.props("plugin.version"))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0")
1+
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0")
22
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % sys.props("plugin.version"))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0")
1+
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0")
22
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % sys.props("plugin.version"))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0")
1+
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0")
22
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % sys.props("plugin.version"))
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0")
1+
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0")
22
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % sys.props("plugin.version"))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0")
1+
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0")
22
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % sys.props("plugin.version"))

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ addSbtPlugin("com.alejandrohdezma" % "sbt-ci" % "2.9.0")
44
addSbtPlugin("com.alejandrohdezma" % "sbt-scalafmt-defaults" % "0.7.1")
55
addSbtPlugin("com.alejandrohdezma" % "sbt-scalafix-defaults" % "0.10.0")
66
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.11")
7-
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0")
7+
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0")
88
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.1")
99
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.6")
1010
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")

0 commit comments

Comments
 (0)