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-management.git
The following commit(s) were added to refs/heads/main by this push:
new d27eabe add license headers to conf (#40)
d27eabe is described below
commit d27eabe5d1979c421235d2c453cb01cb52d97ba2
Author: PJ Fanning <[email protected]>
AuthorDate: Mon Mar 6 10:37:16 2023 +0100
add license headers to conf (#40)
---
.../src/main/resources/reference.conf | 4 +-
.../src/main/resources/reference.conf | 4 +-
discovery-consul/src/main/resources/reference.conf | 4 +-
.../src/main/resources/reference.conf | 2 +
.../src/test/resources/application.conf | 2 +
.../src/main/resources/reference.conf | 4 +-
.../src/main/resources/application.conf | 2 +
.../src/main/resources/application.conf | 2 +
.../src/main/resources/application.conf | 2 +
.../src/main/resources/application.conf | 2 +
.../local/src/main/resources/application.conf | 2 +
.../src/main/resources/application.conf | 2 +
.../src/main/resources/application.conf | 2 +
lease-kubernetes/src/main/resources/reference.conf | 2 +
.../src/main/resources/reference.conf | 2 +
.../src/test/resources/reference.conf | 2 +
.../src/main/resources/reference.conf | 2 +
.../src/test/resources/application.conf | 2 +
.../src/main/resources/reference.conf | 2 +
.../src/main/resources/reference.conf | 2 +
management/src/main/resources/reference.conf | 6 ++-
management/src/test/resources/reference.conf | 2 +
project/CopyrightHeader.scala | 62 ++++++++++++++--------
23 files changed, 90 insertions(+), 28 deletions(-)
diff --git a/discovery-aws-api-async/src/main/resources/reference.conf
b/discovery-aws-api-async/src/main/resources/reference.conf
index c146c49..f3e1672 100644
--- a/discovery-aws-api-async/src/main/resources/reference.conf
+++ b/discovery-aws-api-async/src/main/resources/reference.conf
@@ -1,5 +1,7 @@
+# SPDX-License-Identifier: Apache-2.0
+
######################################################
-# Apache Pekko Service Discovery AWS Config #
+# Apache Pekko Service Discovery AWS Config #
######################################################
pekko.discovery {
diff --git a/discovery-aws-api/src/main/resources/reference.conf
b/discovery-aws-api/src/main/resources/reference.conf
index a34d967..d5d14b5 100644
--- a/discovery-aws-api/src/main/resources/reference.conf
+++ b/discovery-aws-api/src/main/resources/reference.conf
@@ -1,5 +1,7 @@
+# SPDX-License-Identifier: Apache-2.0
+
######################################################
-# Apache Pekko Service Discovery AWS Config #
+# Apache Pekko Service Discovery AWS Config #
######################################################
pekko.discovery {
diff --git a/discovery-consul/src/main/resources/reference.conf
b/discovery-consul/src/main/resources/reference.conf
index 42ff8cd..733c0d7 100644
--- a/discovery-consul/src/main/resources/reference.conf
+++ b/discovery-consul/src/main/resources/reference.conf
@@ -1,5 +1,7 @@
+# SPDX-License-Identifier: Apache-2.0
+
######################################################
-# Apache Pekko Service Discovery Consul Config #
+# Apache Pekko Service Discovery Consul Config #
######################################################
pekko.discovery {
diff --git a/discovery-kubernetes-api/src/main/resources/reference.conf
b/discovery-kubernetes-api/src/main/resources/reference.conf
index 82e3742..a9d68a2 100644
--- a/discovery-kubernetes-api/src/main/resources/reference.conf
+++ b/discovery-kubernetes-api/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
######################################################
# Apache Pekko Service Discovery Kubernetes API Config #
######################################################
diff --git a/discovery-kubernetes-api/src/test/resources/application.conf
b/discovery-kubernetes-api/src/test/resources/application.conf
index 4a7d852..0398580 100644
--- a/discovery-kubernetes-api/src/test/resources/application.conf
+++ b/discovery-kubernetes-api/src/test/resources/application.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko.discovery {
kubernetes-api {
# Must exist to load K8s API discovery:
diff --git a/discovery-marathon-api/src/main/resources/reference.conf
b/discovery-marathon-api/src/main/resources/reference.conf
index 3c253a5..ba1d63b 100644
--- a/discovery-marathon-api/src/main/resources/reference.conf
+++ b/discovery-marathon-api/src/main/resources/reference.conf
@@ -1,5 +1,7 @@
+# SPDX-License-Identifier: Apache-2.0
+
######################################################
-# Apache Pekko Service Discovery Marathon API Config #
+# Apache Pekko Service Discovery Marathon API Config #
######################################################
pekko.discovery {
diff --git a/integration-test/aws-api-ec2/src/main/resources/application.conf
b/integration-test/aws-api-ec2/src/main/resources/application.conf
index 87073fc..90c5d01 100644
--- a/integration-test/aws-api-ec2/src/main/resources/application.conf
+++ b/integration-test/aws-api-ec2/src/main/resources/application.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
purpose = "demo"
purpose = ${?PURPOSE}
diff --git
a/integration-test/kubernetes-api-java/src/main/resources/application.conf
b/integration-test/kubernetes-api-java/src/main/resources/application.conf
index c9b8d92..005d3a9 100644
--- a/integration-test/kubernetes-api-java/src/main/resources/application.conf
+++ b/integration-test/kubernetes-api-java/src/main/resources/application.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko {
loggers = ["org.apache.pekko.event.slf4j.Slf4jLogger"]
loglevel = "DEBUG"
diff --git
a/integration-test/kubernetes-api/src/main/resources/application.conf
b/integration-test/kubernetes-api/src/main/resources/application.conf
index c9b8d92..005d3a9 100644
--- a/integration-test/kubernetes-api/src/main/resources/application.conf
+++ b/integration-test/kubernetes-api/src/main/resources/application.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko {
loggers = ["org.apache.pekko.event.slf4j.Slf4jLogger"]
loglevel = "DEBUG"
diff --git
a/integration-test/kubernetes-dns/src/main/resources/application.conf
b/integration-test/kubernetes-dns/src/main/resources/application.conf
index 80de891..a822e8b 100644
--- a/integration-test/kubernetes-dns/src/main/resources/application.conf
+++ b/integration-test/kubernetes-dns/src/main/resources/application.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko {
loglevel = DEBUG
actor {
diff --git a/integration-test/local/src/main/resources/application.conf
b/integration-test/local/src/main/resources/application.conf
index 901b7b4..b674b6a 100644
--- a/integration-test/local/src/main/resources/application.conf
+++ b/integration-test/local/src/main/resources/application.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko {
loglevel = INFO
diff --git
a/integration-test/marathon-api-docker/src/main/resources/application.conf
b/integration-test/marathon-api-docker/src/main/resources/application.conf
index 1853475..1108e21 100644
--- a/integration-test/marathon-api-docker/src/main/resources/application.conf
+++ b/integration-test/marathon-api-docker/src/main/resources/application.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko {
loglevel = INFO
diff --git a/lease-kubernetes-int-test/src/main/resources/application.conf
b/lease-kubernetes-int-test/src/main/resources/application.conf
index a017a5d..5b9e8cc 100644
--- a/lease-kubernetes-int-test/src/main/resources/application.conf
+++ b/lease-kubernetes-int-test/src/main/resources/application.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko {
loglevel = DEBUG
coordinated-shutdown {
diff --git a/lease-kubernetes/src/main/resources/reference.conf
b/lease-kubernetes/src/main/resources/reference.conf
index a4963f9..d980645 100644
--- a/lease-kubernetes/src/main/resources/reference.conf
+++ b/lease-kubernetes/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko.coordination.lease.kubernetes {
lease-class =
"org.apache.pekko.coordination.lease.kubernetes.KubernetesLease"
diff --git a/management-cluster-bootstrap/src/main/resources/reference.conf
b/management-cluster-bootstrap/src/main/resources/reference.conf
index e14c4d8..59362c6 100644
--- a/management-cluster-bootstrap/src/main/resources/reference.conf
+++ b/management-cluster-bootstrap/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
######################################################
# Apache Pekko Cluster Bootstrap Config #
######################################################
diff --git a/management-cluster-bootstrap/src/test/resources/reference.conf
b/management-cluster-bootstrap/src/test/resources/reference.conf
index 08de2e2..b0538e4 100644
--- a/management-cluster-bootstrap/src/test/resources/reference.conf
+++ b/management-cluster-bootstrap/src/test/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko {
actor {
provider = "cluster"
diff --git a/management-cluster-http/src/main/resources/reference.conf
b/management-cluster-http/src/main/resources/reference.conf
index f394313..403d173 100644
--- a/management-cluster-http/src/main/resources/reference.conf
+++ b/management-cluster-http/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
######################################################
# Apache Pekko Management Cluster Reference Config File #
######################################################
diff --git a/management-cluster-http/src/test/resources/application.conf
b/management-cluster-http/src/test/resources/application.conf
index e30b2c9..be13e67 100644
--- a/management-cluster-http/src/test/resources/application.conf
+++ b/management-cluster-http/src/test/resources/application.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko {
actor {
provider = "cluster"
diff --git a/management-loglevels-log4j2/src/main/resources/reference.conf
b/management-loglevels-log4j2/src/main/resources/reference.conf
index a53a61b..f24e502 100644
--- a/management-loglevels-log4j2/src/main/resources/reference.conf
+++ b/management-loglevels-log4j2/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko.management.http.routes {
loglevels-log4j2 =
"org.apache.pekko.management.loglevels.log4j2.LogLevelRoutes"
}
diff --git a/management-loglevels-logback/src/main/resources/reference.conf
b/management-loglevels-logback/src/main/resources/reference.conf
index f0dfaeb..acd08fd 100644
--- a/management-loglevels-logback/src/main/resources/reference.conf
+++ b/management-loglevels-logback/src/main/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko.management.http.routes {
loglevels-logback =
"org.apache.pekko.management.loglevels.logback.LogLevelRoutes"
}
diff --git a/management/src/main/resources/reference.conf
b/management/src/main/resources/reference.conf
index d682c8b..29728d0 100644
--- a/management/src/main/resources/reference.conf
+++ b/management/src/main/resources/reference.conf
@@ -1,6 +1,8 @@
-######################################################
+# SPDX-License-Identifier: Apache-2.0
+
+##############################################################
# Apache Pekko Http Cluster Management Reference Config File #
-######################################################
+##############################################################
# This is the reference config file that contains all the default settings.
# Make your edits/overrides in your application.conf.
diff --git a/management/src/test/resources/reference.conf
b/management/src/test/resources/reference.conf
index 31154bf..062858e 100644
--- a/management/src/test/resources/reference.conf
+++ b/management/src/test/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko {
remote {
diff --git a/project/CopyrightHeader.scala b/project/CopyrightHeader.scala
index 3fddd4d..292f824 100644
--- a/project/CopyrightHeader.scala
+++ b/project/CopyrightHeader.scala
@@ -13,6 +13,7 @@
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport._
import de.heikoseeberger.sbtheader.{ CommentCreator, CommentStyle,
HeaderPlugin, NewLine }
+import org.apache.commons.lang3.StringUtils
import sbt.Keys._
import sbt._
@@ -30,6 +31,7 @@ trait CopyrightHeader extends AutoPlugin {
headerMappings := headerMappings.value ++ Map(
HeaderFileType.scala -> cStyleComment,
HeaderFileType.java -> cStyleComment,
+ HeaderFileType.conf -> hashLineComment,
HeaderFileType("template") -> cStyleComment)))
}
@@ -45,10 +47,7 @@ trait CopyrightHeader extends AutoPlugin {
(Test / compile).value
})
- def headerFor(year: String): String =
- s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
-
- def apacheHeader: String =
+ val apacheHeader: String =
"""Licensed to the Apache Software Foundation (ASF) under one or more
|license agreements; and to You under the Apache License, version 2.0:
|
@@ -57,37 +56,56 @@ 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: CommentStyle =
HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new
CommentCreator() {
override def apply(text: String, existingText: Option[String]): String = {
val formatted = existingText match {
- case Some(existedText) if isValidCopyRightAnnotated(existedText) =>
- existedText
- case Some(existedText) if
isOnlyLightbendCopyRightAnnotated(existedText) =>
- HeaderCommentStyle.cStyleBlockComment.commentCreator(text,
existingText) + NewLine * 2 + existedText
- case Some(existedText) =>
- throw new IllegalStateException(s"Unable to detect copyright for
header:[${existedText}]")
+ case Some(currentText) if isValidCopyrightAnnotated(currentText) =>
+ currentText
+ case Some(currentText) if
isOnlyLightbendCopyrightAnnotated(currentText) =>
+ HeaderCommentStyle.cStyleBlockComment.commentCreator(text,
existingText) + NewLine * 2 + currentText
+ case Some(currentText) =>
+ throw new IllegalStateException(s"Unable to detect copyright for
header:[${currentText}]")
case None =>
HeaderCommentStyle.cStyleBlockComment.commentCreator(text,
existingText)
}
formatted.trim
}
+ })
- private def isApacheCopyRighted(text: String): Boolean =
- text.contains("Licensed to the Apache Software Foundation (ASF)") ||
- text.contains("www.apache.org/licenses/license-2.0")
-
- private def isLightbendCopyRighted(text: String): Boolean =
- text.contains("Lightbend Inc.")
-
- private def isValidCopyRightAnnotated(text: String): Boolean = {
- isApacheCopyRighted(text)
- }
+ val hashLineComment = HeaderCommentStyle.hashLineComment.copy(commentCreator
= new CommentCreator() {
- private def isOnlyLightbendCopyRightAnnotated(text: String): Boolean = {
- isLightbendCopyRighted(text) && !isApacheCopyRighted(text)
+ // deliberately hardcode use of apacheSpdxHeader and ignore input text
+ override def apply(text: String, existingText: Option[String]): String = {
+ val formatted = existingText match {
+ case Some(currentText) if isApacheCopyrighted(currentText) =>
+ currentText
+ case Some(currentText) =>
+ HeaderCommentStyle.hashLineComment.commentCreator(apacheSpdxHeader,
existingText) + NewLine * 2 + currentText
+ case None =>
+ HeaderCommentStyle.hashLineComment.commentCreator(apacheSpdxHeader,
existingText)
+ }
+ formatted.trim
}
})
+
+ 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.contains(text, "Apache-2.0")
+
+ private def isLightbendCopyrighted(text: String): Boolean =
+ text.contains("Lightbend Inc.")
+
+ private def isValidCopyrightAnnotated(text: String): Boolean = {
+ isApacheCopyrighted(text)
+ }
+
+ private def isOnlyLightbendCopyrightAnnotated(text: String): Boolean = {
+ isLightbendCopyrighted(text) && !isApacheCopyrighted(text)
+ }
}
object CopyrightHeader extends CopyrightHeader
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]