Skip to content

Commit

Permalink
Merge pull request #476 from alejandrohdezma/update/sbt-header-5.8.0
Browse files Browse the repository at this point in the history
Update sbt-header to 5.8.0
  • Loading branch information
alejandrohdezma-steward[bot] committed Oct 21, 2022
2 parents 9e0e2a2 + 5f10bca commit 2c63150
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package com.alejandrohdezma.sbt.github.sbtheader

import scala.collection.breakOut

import sbt.Def
import sbt.Keys._
import sbt._
Expand All @@ -24,7 +26,8 @@ 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.LicenseDetection
import de.heikoseeberger.sbtheader.License._
import de.heikoseeberger.sbtheader.SpdxLicense

/** Populates the `headerLicense` setting from [[https://github.com/sbt/sbt-header sbt-header]] with values extracted
* from Github by `SbtGithubPlugin`:
Expand Down Expand Up @@ -54,14 +57,26 @@ 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 := LicenseDetection(
licenses.value.toList,
copyrightOwner.value,
yearRange.value,
headerLicenseStyle.value
),
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)
},
copyrightOwner := {
organizationHomepage.value
.map(url => s"${organizationName.value} <$url>")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Disable sbt-github downloading so we don't rely in API
ThisBuild / githubEnabled := false

ThisBuild / licenses += "Apache-2.0" -> url("http://localhost")
ThisBuild / yearRange := Some("2015-2020")
ThisBuild / licenses += "Apache-2.0" -> url("http://localhost")
ThisBuild / yearRange := Some("2015-2020")

copyrightOwner := "My Company"
copyrightOwner := "My Company"
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.7.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.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.7.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.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.7.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.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.7.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % sys.props("plugin.version"))
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Disable sbt-github downloading so we don't rely in API
ThisBuild / githubEnabled := false

ThisBuild / licenses += "MIT" -> url("http://localhost")
ThisBuild / yearRange := Some("2015-2020")
ThisBuild / licenses += "MIT" -> url("http://localhost")
ThisBuild / yearRange := Some("2015-2020")

organizationName := "My Company"
organizationHomepage := Some(url("http://example.com"))
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.7.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.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.7.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % sys.props("plugin.version"))
24 changes: 12 additions & 12 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.4")
addSbtPlugin("com.alejandrohdezma" % "sbt-fix" % "0.7.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-ci" % "2.7.1")
addSbtPlugin("com.alejandrohdezma" % "sbt-scalafmt-defaults" % "0.7.1")
addSbtPlugin("com.alejandrohdezma" % "sbt-scalafix-defaults" % "0.9.1")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.11")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.7.0")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.1")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.6")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("io.kevinlee" % "sbt-github-pages" % "0.11.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-modules" % "0.2.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.4")
addSbtPlugin("com.alejandrohdezma" % "sbt-fix" % "0.7.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-ci" % "2.7.1")
addSbtPlugin("com.alejandrohdezma" % "sbt-scalafmt-defaults" % "0.7.1")
addSbtPlugin("com.alejandrohdezma" % "sbt-scalafix-defaults" % "0.9.1")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.11")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.8.0")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.1")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.6")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("io.kevinlee" % "sbt-github-pages" % "0.11.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-modules" % "0.2.0")

0 comments on commit 2c63150

Please sign in to comment.