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/06 09:43:08 UTC

[incubator-pekko] branch main updated: can only set headerLicense config once (#234)

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.git


The following commit(s) were added to refs/heads/main by this push:
     new f9eb8aaebf can only set headerLicense config once (#234)
f9eb8aaebf is described below

commit f9eb8aaebfbd0c2fdb8e898c5787904fc7455714
Author: PJ Fanning <pj...@users.noreply.github.com>
AuthorDate: Mon Mar 6 10:43:02 2023 +0100

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

diff --git a/project/CopyrightHeader.scala b/project/CopyrightHeader.scala
index 6d2012a1c5..84ea9bfe84 100644
--- a/project/CopyrightHeader.scala
+++ b/project/CopyrightHeader.scala
@@ -34,20 +34,12 @@ trait 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, additional)
+    Def.settings(headerMappingSettings, additional)
 
   def additional: Seq[Def.Setting[_]] =
     Def.settings(Compile / compile := {
@@ -59,9 +51,6 @@ 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 =
     """Licensed to the Apache Software Foundation (ASF) under one or more
       |license agreements; and to You under the Apache License, version 2.0:
@@ -92,14 +81,15 @@ trait 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: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org