Skip to content

Commit

Permalink
Add sbt-license-report
Browse files Browse the repository at this point in the history
  • Loading branch information
mdedetrich committed Aug 1, 2023
1 parent a671ae6 commit 9ebce1c
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 1 deletion.
9 changes: 8 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,14 @@ lazy val docs = project
"extref.pekko-http.base_url" -> s"https://pekko.apache.org/docs/pekko-http/current/%s",
"scaladoc.pekko.http.base_url" -> s"https://pekko.apache.org/api/pekko-http/current/",
"extref.pekko-grpc.base_url" -> s"https://pekko.apache.org/docs/pekko-grpc/current/%s",
"scaladoc.akka.management.base_url" -> s"/${(Preprocess / siteSubdirName).value}/"))
"scaladoc.akka.management.base_url" -> s"/${(Preprocess / siteSubdirName).value}/"),
Compile / paradoxMarkdownToHtml / sourceGenerators += Def.taskDyn {
val targetFile = (Compile / paradox / sourceManaged).value / "license-report.md"

(LocalRootProject / dumpLicenseReportAggregate).map { dir =>
IO.copy(List(dir / "pekko-management-root-licenses.md" -> targetFile)).toList
}
}.taskValue)

def pekkoModule(moduleName: String): Project =
Project(id = moduleName, base = file(moduleName))
Expand Down
1 change: 1 addition & 0 deletions docs/src/main/paradox/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Various parts of Pekko management can be used together for deploying Pekko Clust
@@@ index

- [Release Notes](release-notes/index.md)
- [License Report](license-report.md)
- [Deploy guide for Kubernetes](kubernetes-deployment/index.md)
- [Pekko Management](pekko-management.md)
- [Migrating from older versions](migration.md)
Expand Down
49 changes: 49 additions & 0 deletions project/LicenseReport.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import sbt._
import sbtlicensereport.SbtLicenseReport
import sbtlicensereport.SbtLicenseReport.autoImportImpl._
import sbtlicensereport.license.{ DepModuleInfo, LicenseInfo, MarkDown }

object LicenseReport extends AutoPlugin {

override lazy val projectSettings = Seq(
licenseReportTypes := Seq(MarkDown),
licenseReportMakeHeader := (language => language.header1("License Report")),
licenseConfigurations := Set("compile", "test", "provided"),
licenseDepExclusions := {
case DepModuleInfo("org.apache.pekko", _, _) => true // Inter pekko project dependencies are pointless
case DepModuleInfo(_, "scala-library", _) => true // Scala library is part of Scala language
case DepModuleInfo(_, "scala-reflect", _) => true // Scala reflect is part of Scala language
},
licenseOverrides := {
// Missing license in POM
case DepModuleInfo("io.netty", "netty-tcnative-classes", _) => LicenseInfo.APACHE2
},
licenseReportColumns := Seq(
Column.Category,
Column.License,
Column.Dependency,
Column.OriginatingArtifactName,
Column.Configuration))

override def requires = plugins.JvmPlugin && SbtLicenseReport

override def trigger = allRequirements

}
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
addSbtPlugin("net.bzzt" % "sbt-reproducible-builds" % "0.31")
addSbtPlugin("org.mdedetrich" % "sbt-apache-sonatype" % "0.1.10")
addSbtPlugin("com.github.pjfanning" % "sbt-source-dist" % "0.1.8")
addSbtPlugin("com.github.sbt" % "sbt-license-report" % "1.6.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.2")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.0")

Expand Down

0 comments on commit 9ebce1c

Please sign in to comment.