You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by md...@apache.org on 2023/08/01 17:18:48 UTC

[incubator-pekko-management] branch main updated: Add sbt-license-report

This is an automated email from the ASF dual-hosted git repository.

mdedetrich pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-management.git


The following commit(s) were added to refs/heads/main by this push:
     new bdb9f143 Add sbt-license-report
bdb9f143 is described below

commit bdb9f143556b465174fd3dd67ffea2ec5f4a5221
Author: Matthew de Detrich <ma...@aiven.io>
AuthorDate: Tue Aug 1 19:01:12 2023 +0200

    Add sbt-license-report
---
 build.sbt                      |  9 +++++++-
 docs/src/main/paradox/index.md |  1 +
 project/LicenseReport.scala    | 49 ++++++++++++++++++++++++++++++++++++++++++
 project/plugins.sbt            |  1 +
 4 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/build.sbt b/build.sbt
index 1ea3330f..cdfeaf0f 100644
--- a/build.sbt
+++ b/build.sbt
@@ -295,7 +295,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))
diff --git a/docs/src/main/paradox/index.md b/docs/src/main/paradox/index.md
index 88c47a3a..824ee23e 100644
--- a/docs/src/main/paradox/index.md
+++ b/docs/src/main/paradox/index.md
@@ -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)
diff --git a/project/LicenseReport.scala b/project/LicenseReport.scala
new file mode 100644
index 00000000..cde98271
--- /dev/null
+++ b/project/LicenseReport.scala
@@ -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
+
+}
diff --git a/project/plugins.sbt b/project/plugins.sbt
index bd3e4ecf..ed14f0a3 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -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")
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org