Skip to content

Commit

Permalink
Merge pull request #482 from alejandrohdezma/bump-sbt-header
Browse files Browse the repository at this point in the history
Bump sbt header
  • Loading branch information
alejandrohdezma authored Nov 22, 2022
2 parents dc75193 + c382d72 commit 56083b2
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.alejandrohdezma.sbt.github.sbtheader

import scala.collection.breakOut

import sbt.Def
import sbt.Keys._
import sbt._
Expand All @@ -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`:
Expand Down Expand Up @@ -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,
yearRange.value.flatMap(_.split("-").headOption).map(_.toInt),
yearRange.value.flatMap(_.split("-").lastOption).map(_.toInt),
headerLicenseStyle.value
),
copyrightOwner := {
organizationHomepage.value
.map(url => s"${organizationName.value} <$url>")
Expand Down
Original file line number Diff line number Diff line change
@@ -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"))
Original file line number Diff line number Diff line change
@@ -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"))
Original file line number Diff line number Diff line change
@@ -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"))
Original file line number Diff line number Diff line change
@@ -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"))
Original file line number Diff line number Diff line change
@@ -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"))
Original file line number Diff line number Diff line change
@@ -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"))
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 56083b2

Please sign in to comment.