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 80ff7ba2c can only set headerLicense once (#104)
80ff7ba2c is described below

commit 80ff7ba2cc13427d008fe44a215ebcde1fde5d38
Author: PJ Fanning <[email protected]>
AuthorDate: Mon Mar 6 10:42:37 2023 +0100

    can only set headerLicense once (#104)
---
 project/CopyrightHeader.scala | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/project/CopyrightHeader.scala b/project/CopyrightHeader.scala
index 6def9e621..cc409376f 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
 
-  private def headerMappingSettings = Def.settings(
+  override def projectSettings = Def.settings(
     Seq(Compile, Test).flatMap { config =>
       inConfig(config)(
         Seq(
@@ -32,21 +32,10 @@ object CopyrightHeader extends AutoPlugin {
           headerMappings := headerMappings.value ++ Map(
             HeaderFileType.scala -> cStyleComment,
             HeaderFileType.java -> cStyleComment,
+            HeaderFileType.conf -> hashLineComment,
             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:
@@ -77,14 +66,15 @@ object CopyrightHeader extends AutoPlugin {
 
   val hashLineComment = HeaderCommentStyle.hashLineComment.copy(commentCreator 
= new CommentCreator() {
 
+    // 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(text, 
existingText) + NewLine * 2 + currentText
+          HeaderCommentStyle.hashLineComment.commentCreator(apacheSpdxHeader, 
existingText) + NewLine * 2 + currentText
         case None =>
-          HeaderCommentStyle.hashLineComment.commentCreator(text, existingText)
+          HeaderCommentStyle.hashLineComment.commentCreator(apacheSpdxHeader, 
existingText)
       }
       formatted.trim
     }


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

Reply via email to