You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by fa...@apache.org on 2023/03/03 18:33:10 UTC
[incubator-pekko-http] branch main updated: add license headers to conf files (#102)
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-http.git
The following commit(s) were added to refs/heads/main by this push:
new 07201517a add license headers to conf files (#102)
07201517a is described below
commit 07201517af529b567cd7c68df9b60c54aafff6f2
Author: PJ Fanning <pj...@users.noreply.github.com>
AuthorDate: Fri Mar 3 19:33:05 2023 +0100
add license headers to conf files (#102)
* add license headers to conf files and fix up some stray akka refs in those files
* Update reference.conf
---
docs/src/test/resources/application.conf | 2 ++
http-caching/src/main/resources/reference.conf | 8 +++---
http-core/src/main/resources/reference.conf | 14 ++++++-----
http-core/src/test/resources/reference.conf | 2 ++
http-testkit/src/main/resources/reference.conf | 2 ++
http-tests/src/test/resources/application.conf | 2 ++
http/src/main/resources/reference.conf | 12 +++++----
project/CopyrightHeader.scala | 34 ++++++++++++++++++++++++--
8 files changed, 60 insertions(+), 16 deletions(-)
diff --git a/docs/src/test/resources/application.conf b/docs/src/test/resources/application.conf
index a89d4bf2b..129c36566 100644
--- a/docs/src/test/resources/application.conf
+++ b/docs/src/test/resources/application.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko {
# needed because we add pekko-actor-typed here but don't include an slf4j implementation
use-slf4j = off
diff --git a/http-caching/src/main/resources/reference.conf b/http-caching/src/main/resources/reference.conf
index 329897e2f..1a21221f2 100644
--- a/http-caching/src/main/resources/reference.conf
+++ b/http-caching/src/main/resources/reference.conf
@@ -1,6 +1,8 @@
-###########################################
-# akka-http-caching Reference Config File #
-###########################################
+# SPDX-License-Identifier: Apache-2.0
+
+############################################
+# pekko-http-caching 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/http-core/src/main/resources/reference.conf b/http-core/src/main/resources/reference.conf
index b84b5e367..3589b7e60 100644
--- a/http-core/src/main/resources/reference.conf
+++ b/http-core/src/main/resources/reference.conf
@@ -1,6 +1,8 @@
-########################################
+# SPDX-License-Identifier: Apache-2.0
+
+#########################################
# pekko-http-core Reference Config File #
-########################################
+#########################################
# This is the reference config file that contains all the default settings.
# Make your edits/overrides in your application.conf.
@@ -21,7 +23,7 @@ pekko.http {
# "PREVIEW" features that are not yet fully production ready.
# These flags can change or be removed between patch releases.
preview {
- # If this setting is enabled AND the akka-http2-support is found
+ # If this setting is enabled AND the pekko-http2-support is found
# on the classpath, `Http().newServerAt(...).bind` and `bindSync`
# will be enabled to use HTTP/2.
#
@@ -123,7 +125,7 @@ pekko.http {
# the client in the error response.
# Should be disabled for browser-facing APIs due to the risk of XSS attacks
# and (probably) enabled for internal or non-browser APIs.
- # Note that akka-http will always produce log messages containing the full
+ # Note that pekko-http will always produce log messages containing the full
# error details.
verbose-error-messages = off
@@ -317,7 +319,7 @@ pekko.http {
#
# It is also possible to provide a payload for each heartbeat message,
# this setting can be configured programatically by modifying the websocket settings.
- # See: https://doc.akka.io/docs/akka-http/current/server-side/websocket-support.html
+ # See: https://pekko.apache.org/docs/pekko-http/current/server-side/websocket-support.html
periodic-keep-alive-mode = ping
# Interval for sending periodic keep-alives
@@ -712,7 +714,7 @@ pekko.http {
# Enables/disables the logging of warning messages in case an incoming
# message (request or response) contains an HTTP header which cannot be
# parsed into its high-level model class due to incompatible syntax.
- # Note that, independently of this settings, akka-http will accept messages
+ # Note that, independently of this settings, pekko-http will accept messages
# with such headers as long as the message as a whole would still be legal
# under the HTTP specification even without this header.
# If a header cannot be parsed into a high-level model instance it will be
diff --git a/http-core/src/test/resources/reference.conf b/http-core/src/test/resources/reference.conf
index 6ef870b7d..90159c695 100644
--- a/http-core/src/test/resources/reference.conf
+++ b/http-core/src/test/resources/reference.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko {
loggers = ["org.apache.pekko.testkit.TestEventListener"]
actor {
diff --git a/http-testkit/src/main/resources/reference.conf b/http-testkit/src/main/resources/reference.conf
index c6a75cca2..3f0707679 100644
--- a/http-testkit/src/main/resources/reference.conf
+++ b/http-testkit/src/main/resources/reference.conf
@@ -1 +1,3 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko.http.testkit.marshalling.timeout = 1 s
diff --git a/http-tests/src/test/resources/application.conf b/http-tests/src/test/resources/application.conf
index fc4e29014..e8b0eb68a 100644
--- a/http-tests/src/test/resources/application.conf
+++ b/http-tests/src/test/resources/application.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
pekko {
loggers = ["org.apache.pekko.testkit.TestEventListener"]
actor {
diff --git a/http/src/main/resources/reference.conf b/http/src/main/resources/reference.conf
index c8f5b5d01..9eeb9b01f 100644
--- a/http/src/main/resources/reference.conf
+++ b/http/src/main/resources/reference.conf
@@ -1,6 +1,8 @@
-###################################
-# akka-http Reference Config File #
-###################################
+# SPDX-License-Identifier: Apache-2.0
+
+####################################
+# pekko-http Reference Config File #
+####################################
# This is the reference config file that contains all the default settings.
# Make your edits/overrides in your application.conf.
@@ -11,7 +13,7 @@ pekko.http {
# client in the error response
# Should be disabled for browser-facing APIs due to the risk of XSS attacks
# and (probably) enabled for internal or non-browser APIs
- # (Note that akka-http will always produce log messages containing the full error details)
+ # (Note that pekko-http will always produce log messages containing the full error details)
verbose-error-messages = off
# Enables/disables ETag and `If-Modified-Since` support for FileAndResourceDirectives
@@ -56,7 +58,7 @@ pekko.http {
# The maximum size for parsing lines of a server-sent event.
max-line-size = 4096
- # Empty events are used by the akka-http SSE infrastructure for heartbeats. Received heartbeats are ignored by default
+ # Empty events are used by the pekko-http SSE infrastructure for heartbeats. Received heartbeats are ignored by default
# and not delivered in the user stream.
#
# This setting can be enabled to pass those empty events to the application for explicit handling.
diff --git a/project/CopyrightHeader.scala b/project/CopyrightHeader.scala
index f3758ad0b..6def9e621 100644
--- a/project/CopyrightHeader.scala
+++ b/project/CopyrightHeader.scala
@@ -24,7 +24,7 @@ object CopyrightHeader extends AutoPlugin {
override def requires = HeaderPlugin
override def trigger = allRequirements
- override def projectSettings = Def.settings(
+ private def headerMappingSettings = Def.settings(
Seq(Compile, Test).flatMap { config =>
inConfig(config)(
Seq(
@@ -35,6 +35,18 @@ object CopyrightHeader extends AutoPlugin {
HeaderFileType("template") -> cStyleComment)))
})
+ 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)
+
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:
@@ -44,6 +56,8 @@ object 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 = {
@@ -61,12 +75,28 @@ object 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) =>
+ currentText
+ case Some(currentText) =>
+ HeaderCommentStyle.hashLineComment.commentCreator(text, existingText) + NewLine * 2 + 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.")
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org