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

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


The following commit(s) were added to refs/heads/main by this push:
     new 6932020f add license header to conf files (#31)
6932020f is described below

commit 6932020f30eb75319beb9f0c1bcf4d99c53931c0
Author: PJ Fanning <[email protected]>
AuthorDate: Thu Mar 2 23:39:39 2023 +0100

    add license header to conf files (#31)
---
 cassandra/src/main/resources/reference.conf        |  2 ++
 couchbase/src/main/resources/reference.conf        |  2 ++
 .../src/main/resources/reference.conf              |  2 ++
 .../src/main/resources/reference.conf              |  2 ++
 .../src/main/resources/reference.conf              |  2 ++
 .../src/main/resources/reference.conf              |  2 ++
 .../src/main/resources/reference.conf              |  2 ++
 google-common/src/main/resources/reference.conf    |  2 ++
 google-fcm/src/main/resources/reference.conf       |  2 ++
 huawei-push-kit/src/main/resources/reference.conf  |  2 ++
 ironmq/src/main/resources/reference.conf           |  2 ++
 jms/src/main/resources/reference.conf              |  2 ++
 kudu/src/main/resources/reference.conf             |  2 ++
 orientdb/src/main/resources/reference.conf         |  2 ++
 pravega/src/main/resources/reference.conf          |  2 ++
 project/CopyrightHeader.scala                      | 34 ++++++++++++++++++++--
 reference/src/main/resources/application.conf      |  2 ++
 s3/src/main/resources/reference.conf               |  2 ++
 .../src/main/resources/reference.conf              |  2 ++
 19 files changed, 68 insertions(+), 2 deletions(-)

diff --git a/cassandra/src/main/resources/reference.conf 
b/cassandra/src/main/resources/reference.conf
index 6cd498df..11ad4d86 100644
--- a/cassandra/src/main/resources/reference.conf
+++ b/cassandra/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 alpakka.cassandra {
   # The implementation of `akka.stream.alpakka.cassandra.CqlSessionProvider`
   # used for creating the `CqlSession`.
diff --git a/couchbase/src/main/resources/reference.conf 
b/couchbase/src/main/resources/reference.conf
index 62ef9cd7..f777ea8f 100644
--- a/couchbase/src/main/resources/reference.conf
+++ b/couchbase/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 alpakka.couchbase {
   session {
     # The couchbase nodes to connect to as hostnames of ip-addresses
diff --git a/google-cloud-bigquery-storage/src/main/resources/reference.conf 
b/google-cloud-bigquery-storage/src/main/resources/reference.conf
index 0e04bf86..da08deda 100644
--- a/google-cloud-bigquery-storage/src/main/resources/reference.conf
+++ b/google-cloud-bigquery-storage/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 alpakka.google {
 
   credentials.default-scopes = ${?alpakka.google.credentials.default-scopes} 
["https://www.googleapis.com/auth/bigquery.readonly";]
diff --git a/google-cloud-bigquery/src/main/resources/reference.conf 
b/google-cloud-bigquery/src/main/resources/reference.conf
index c16cb08f..3e106dac 100644
--- a/google-cloud-bigquery/src/main/resources/reference.conf
+++ b/google-cloud-bigquery/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 alpakka.google {
   credentials.default-scopes = ${?alpakka.google.credentials.default-scopes} 
["https://www.googleapis.com/auth/bigquery";]
 
diff --git a/google-cloud-pub-sub-grpc/src/main/resources/reference.conf 
b/google-cloud-pub-sub-grpc/src/main/resources/reference.conf
index 7132cff3..4d07d7d1 100644
--- a/google-cloud-pub-sub-grpc/src/main/resources/reference.conf
+++ b/google-cloud-pub-sub-grpc/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 alpakka.google.credentials.default-scopes = 
${?alpakka.google.credentials.default-scopes} 
["https://www.googleapis.com/auth/pubsub";]
 
 alpakka.google.cloud.pubsub.grpc {
diff --git a/google-cloud-pub-sub/src/main/resources/reference.conf 
b/google-cloud-pub-sub/src/main/resources/reference.conf
index 597e2edd..9f0520cb 100644
--- a/google-cloud-pub-sub/src/main/resources/reference.conf
+++ b/google-cloud-pub-sub/src/main/resources/reference.conf
@@ -1 +1,3 @@
+# SPDX-License-Identifier: Apache-2.0
+
 alpakka.google.credentials.default-scopes = 
${?alpakka.google.credentials.default-scopes} 
["https://www.googleapis.com/auth/pubsub";]
diff --git a/google-cloud-storage/src/main/resources/reference.conf 
b/google-cloud-storage/src/main/resources/reference.conf
index 9375df12..eef4af22 100644
--- a/google-cloud-storage/src/main/resources/reference.conf
+++ b/google-cloud-storage/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 alpakka.google {
 
   credentials {
diff --git a/google-common/src/main/resources/reference.conf 
b/google-common/src/main/resources/reference.conf
index 86de8559..f16f741c 100644
--- a/google-common/src/main/resources/reference.conf
+++ b/google-common/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 alpakka.google {
 
   credentials {
diff --git a/google-fcm/src/main/resources/reference.conf 
b/google-fcm/src/main/resources/reference.conf
index 76ca4598..21f5ebcf 100644
--- a/google-fcm/src/main/resources/reference.conf
+++ b/google-fcm/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 alpakka.google {
   credentials {
     default-scopes = ${?alpakka.google.credentials.default-scopes} 
["https://www.googleapis.com/auth/firebase.messaging";]
diff --git a/huawei-push-kit/src/main/resources/reference.conf 
b/huawei-push-kit/src/main/resources/reference.conf
index c885344e..3a4b1fa3 100644
--- a/huawei-push-kit/src/main/resources/reference.conf
+++ b/huawei-push-kit/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 alpakka.huawei.pushkit {
   app-id: ""
   app-secret: ""
diff --git a/ironmq/src/main/resources/reference.conf 
b/ironmq/src/main/resources/reference.conf
index c3dfc292..310c3e63 100644
--- a/ironmq/src/main/resources/reference.conf
+++ b/ironmq/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 alpakka.ironmq {
 
   // The IronMg endpoint. It may vary due to availability zone and region.
diff --git a/jms/src/main/resources/reference.conf 
b/jms/src/main/resources/reference.conf
index 1957324a..1c07a380 100644
--- a/jms/src/main/resources/reference.conf
+++ b/jms/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 # Settings for the Alpakka JMS connector
 #
 alpakka.jms {
diff --git a/kudu/src/main/resources/reference.conf 
b/kudu/src/main/resources/reference.conf
index 509a61ed..48e2f6d2 100644
--- a/kudu/src/main/resources/reference.conf
+++ b/kudu/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 alpakka.kudu {
 
   # the hostname and port to locate the master
diff --git a/orientdb/src/main/resources/reference.conf 
b/orientdb/src/main/resources/reference.conf
index 99dea96e..97aa4876 100644
--- a/orientdb/src/main/resources/reference.conf
+++ b/orientdb/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 alpakka.orientdb.pinned-dispatcher {
   # see https://orientdb.com/docs/last/Java-Multi-Threading.html
   executor = "thread-pool-executor"
diff --git a/pravega/src/main/resources/reference.conf 
b/pravega/src/main/resources/reference.conf
index d70829a2..6a80a7f2 100644
--- a/pravega/src/main/resources/reference.conf
+++ b/pravega/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 akka.alpakka.pravega {
   #
   # ClientConfig (Pravega internals)
diff --git a/project/CopyrightHeader.scala b/project/CopyrightHeader.scala
index 98561c88..6250ec7a 100644
--- a/project/CopyrightHeader.scala
+++ b/project/CopyrightHeader.scala
@@ -34,7 +34,17 @@ trait CopyrightHeader extends AutoPlugin {
             HeaderFileType("template") -> cStyleComment)))
     }
 
-  override def projectSettings: Seq[Def.Setting[_]] = 
Def.settings(headerMappingSettings, additional)
+  private def confHeaderMappingSettings: Seq[Def.Setting[_]] =
+    Seq(Compile, Test).flatMap { config =>
+      inConfig(config)(
+        Seq(
+          headerLicense := Some(HeaderLicense.Custom(apacheSpdxHeader)),
+          headerMappings := headerMappings.value ++ Map(
+            HeaderFileType.conf -> hashLineComment)))
+    }
+
+  override def projectSettings: Seq[Def.Setting[_]] =
+    Def.settings(headerMappingSettings, confHeaderMappingSettings, additional)
 
   def additional: Seq[Def.Setting[_]] =
     Def.settings(Compile / compile := {
@@ -55,6 +65,8 @@ trait CopyrightHeader extends AutoPlugin {
       |This file is part of the Apache Pekko project, derived from Akka.
       |""".stripMargin
 
+  val apacheSpdxHeader: String = "SPDX-License-Identifier: Apache-2.0"
+
   val cStyleComment = 
HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new 
CommentCreator() {
 
     override def apply(text: String, existingText: Option[String]): String = {
@@ -72,12 +84,30 @@ trait CopyrightHeader extends AutoPlugin {
     }
   })
 
+  val hashLineComment = HeaderCommentStyle.hashLineComment.copy(commentCreator 
= new CommentCreator() {
+
+    override def apply(text: String, existingText: Option[String]): String = {
+      val formatted = existingText match {
+        case Some(currentText) if isApacheCopyrighted(currentText) || 
isGenerated(currentText) =>
+          currentText
+        case Some(currentText) if 
isOnlyLightbendCopyrightAnnotated(currentText) =>
+          HeaderCommentStyle.hashLineComment.commentCreator(text, 
existingText) + NewLine * 2 + currentText
+        case Some(currentText) =>
+          throw new IllegalStateException(s"Unable to detect copyright for 
header: [${currentText}]")
+        case None =>
+          HeaderCommentStyle.hashLineComment.commentCreator(text, existingText)
+      }
+      formatted.trim
+    }
+  })
+
   private def isGenerated(text: String): Boolean =
     StringUtils.contains(text, "DO NOT EDIT DIRECTLY")
 
   private def isApacheCopyrighted(text: String): Boolean =
     StringUtils.containsIgnoreCase(text, "licensed to the apache software 
foundation (asf)") ||
-    StringUtils.containsIgnoreCase(text, "www.apache.org/licenses/license-2.0")
+    StringUtils.containsIgnoreCase(text, 
"www.apache.org/licenses/license-2.0") ||
+    StringUtils.contains(text, "Apache-2.0")
 
   private def isLightbendCopyrighted(text: String): Boolean =
     StringUtils.containsIgnoreCase(text, "lightbend inc.")
diff --git a/reference/src/main/resources/application.conf 
b/reference/src/main/resources/application.conf
index 40a2ab85..d55bd884 100644
--- a/reference/src/main/resources/application.conf
+++ b/reference/src/main/resources/application.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 # use 'alpakka' namespace for connector settings
 alpakka.reference {
 
diff --git a/s3/src/main/resources/reference.conf 
b/s3/src/main/resources/reference.conf
index d0936080..e92d85df 100644
--- a/s3/src/main/resources/reference.conf
+++ b/s3/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 alpakka.s3 {
   # whether the buffer request chunks (up to 5MB each) to "memory" or "disk"
   buffer = "memory"
diff --git a/unix-domain-socket/src/main/resources/reference.conf 
b/unix-domain-socket/src/main/resources/reference.conf
index e182c12f..640fbf12 100644
--- a/unix-domain-socket/src/main/resources/reference.conf
+++ b/unix-domain-socket/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 akka.stream.alpakka.unix-domain-socket {
   // Size of the buffer to receive data. The Linux /proc/sys/net/core/wmem_max 
is around 200k,
   // so 64k seems reasonable given 8k is normal for TCP. Denominations of the 
power of 2 are


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to