You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by GitBox <gi...@apache.org> on 2022/11/16 06:04:04 UTC

[GitHub] [incubator-pekko] He-Pin opened a new pull request, #50: =sbt Use apache header for new files.

He-Pin opened a new pull request, #50:
URL: https://github.com/apache/incubator-pekko/pull/50

   refs: https://github.com/apache/incubator-pekko/issues/38
   
   - Keep the exists ones' header
   - New file use Aapache header


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
mdedetrich commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1319740602

   I personally don't think this is a major change, since it has zero effect on the software whatsoever and is just updating the project to be legally compliant wrt headers.
   
   I have already approved the PR so my stance isn't going to block anything, but we really need to come to strict set of agreements on what is minor and what is major especially if we are going to block pull requests over it


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1317980853

   @mdedetrich Yes, I was wondering write a more flexible code to handle various condition too, but maybe it's ok for now?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
mdedetrich commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1316631045

   Actually it was discussed here https://github.com/apache/incubator-pekko/issues/38#issuecomment-1311468140


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
mdedetrich commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1360967927

   > We do not not want to replace any existing headers but we want to put this additional header at the top of every file:
   
   Perfect. Lets put the header in every file in this PR and get it over and done with.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] pjfanning commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
pjfanning commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023934188


##########
project/CopyrightHeader.scala:
##########
@@ -40,55 +40,34 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
 
     override def apply(text: String, existingText: Option[String]): String = {
       val formatted = existingText match {
         case Some(existedText) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          existedText

Review Comment:
   the Lightbend header should not be editted at all - whatever year is in the file now should stay that way indefinitely



##########
project/CopyrightHeader.scala:
##########
@@ -40,55 +40,34 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
 
     override def apply(text: String, existingText: Option[String]): String = {
       val formatted = existingText match {
         case Some(existedText) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          existedText

Review Comment:
   the Lightbend header should not be edited at all - whatever year is in the file now should stay that way indefinitely



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023951051


##########
project/CopyrightHeader.scala:
##########
@@ -40,55 +40,34 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
 
     override def apply(text: String, existingText: Option[String]): String = {
       val formatted = existingText match {
         case Some(existedText) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          existedText
         case None =>
           HeaderCommentStyle.cStyleBlockComment.commentCreator(text, existingText)
       }

Review Comment:
   This is done and I manually checked.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] justinmclean commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
justinmclean commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1356931991

   Hi,
   
   The project is "Apache Pekko" not “Pekko”.
   
   Justin
   
   > On 19 Dec 2022, at 8:46 am, PJ Fanning ***@***.***> wrote:
   > 
   > 
   > @He-Pin <https://github.com/He-Pin> I think there is some agreement in https://issues.apache.org/jira/browse/LEGAL-626 <https://issues.apache.org/jira/browse/LEGAL-626> now.
   > 
   > We do not not want to replace ant existing headers but we want to put this additional header at the top of every file:
   > 
   > /*
   >  * Licensed to the Apache Software Foundation (ASF) under one or more
   >  * license agreements; and to You under the Apache License, version 2.0:
   >  *
   >  *   https://www.apache.org/licenses/LICENSE-2.0
   >  *
   >  * This file is part of the Pekko project, derived from Akka.
   >  */
   > —
   > Reply to this email directly, view it on GitHub <https://github.com/apache/incubator-pekko/pull/50#issuecomment-1356882792>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABDI6CAD6ZSJNHRYORRPM3WN6A2BANCNFSM6AAAAAASB2376E>.
   > You are receiving this because you were mentioned.
   > 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1379272172

   @pjfanning Would you like to take a look at this?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin merged pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin merged PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
mdedetrich commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023764357


##########
project/CopyrightHeader.scala:
##########
@@ -40,55 +40,34 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
 
     override def apply(text: String, existingText: Option[String]): String = {
       val formatted = existingText match {
         case Some(existedText) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          existedText
         case None =>
           HeaderCommentStyle.cStyleBlockComment.commentCreator(text, existingText)
       }

Review Comment:
   > If there is a copyright statement do not modify the file.
   
   As far as I can tell, every single source file in this project already has a copyright statement so
   
   > If there is no copyright statement there should be an Apache V2 text block. If it is not there insert it.
   
   Is never going to happen until we add new source files (which hasn't happened yet).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023833112


##########
project/CopyrightHeader.scala:
##########
@@ -40,55 +40,34 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
 
     override def apply(text: String, existingText: Option[String]): String = {
       val formatted = existingText match {
         case Some(existedText) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          existedText

Review Comment:
   I see, I will try to update this after work.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
mdedetrich commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023840142


##########
project/CopyrightHeader.scala:
##########
@@ -40,55 +40,34 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
 
     override def apply(text: String, existingText: Option[String]): String = {
       val formatted = existingText match {
         case Some(existedText) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          existedText

Review Comment:
   > Is contains checking case sensitive? If not the Apache license contains the word "copyright" and may cause a problem.
   
   No its not but that can easily be remedied, i.e.
   
   ```scala
   case Some(existingText) if existedText.toLowerCase.contains("Licensed to the Apache Software Foundation (ASF)") && existingText.toLowerCase.contains("Copyright")
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] pjfanning commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
pjfanning commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1356882792

   @He-Pin I think there is some agreement in https://issues.apache.org/jira/browse/LEGAL-626 now.
   
   We do not not want to replace ant existing headers but we want to put this additional header at the top of every file:
   
   ```
   /*
    * Licensed to the Apache Software Foundation (ASF) under one or more
    * license agreements; and to You under the Apache License, version 2.0:
    *
    *   https://www.apache.org/licenses/LICENSE-2.0
    *
    * This file is part of the Pekko project, derived from Akka.
    */
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
mdedetrich commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1372236475

   I think this is a good enough starting point to implement the proposed solution (putting the Apache header on every source file). It shouldn't be too hard for @He-Pin to do it in this PR, and once its reviewed we can finally merge it and get it over and done with.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] Claudenw commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
Claudenw commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1319664650

   @justinmclean 
   
   > 1. I don’t think this would be considered a major change.
   
   I think it is a major change as much as a sort change from bubble to quick sort would be.
   
   Original code inserted copyright and/or/ updated the date of the copyright.
   
   New code
   
   1. Checks for presence of copyright and if found does nothing.
   2. Checks for presence of Apache license and if found does nothing.
   3. If the above checks fail inserts the Apache license (we could argue that this should fail the build but that is a different discussion).
   
   The new process is more complex and when it makes a change to the file the change is significantly different.  Thus the change to this file rises to the level of a major change and this source should have the Apache license.
   
   Do you agree?
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023726287


##########
project/CopyrightHeader.scala:
##########
@@ -40,55 +40,34 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin

Review Comment:
   the new header.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] Claudenw commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
Claudenw commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023735647


##########
project/CopyrightHeader.scala:
##########
@@ -40,55 +40,34 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
 
     override def apply(text: String, existingText: Option[String]): String = {
       val formatted = existingText match {
         case Some(existedText) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          existedText
         case None =>
           HeaderCommentStyle.cStyleBlockComment.commentCreator(text, existingText)
       }

Review Comment:
   I am not certain what this file is doing (I am not a scala developer but I am trying to learn).  With that stated, my understanding is that this code modifies source files to ensure that they have the proper headers.
   
   This is going to get more complicated as we move forward.  But I think the rules are:
   
   1. If there is a copyright statement do not modify the file.
   2. If there is no copyright statement there should be an Apache V2 text block.  If it is not there insert it.
   
   If either the copyright or the Apache v2 text block is in the file do nothing.
   
   



##########
project/CopyrightHeader.scala:
##########
@@ -40,55 +40,34 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 

Review Comment:
   Can the above text be read from the copyright file itself rather than hand coded here?
   
   The file will have to be in the root LICENSE file.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
mdedetrich commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023807603


##########
project/CopyrightHeader.scala:
##########
@@ -40,55 +40,34 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
 
     override def apply(text: String, existingText: Option[String]): String = {
       val formatted = existingText match {
         case Some(existedText) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          existedText

Review Comment:
   Is it possible to be a lot more clear here about whats going on with the headers considering we have a non trivial setup regarding different types of headers, i.e. something like
   
   ```scala
   override def apply(text: String, existingText: Option[String]): String = {
     val formatted = existingText match {
       case Some(existingText) if existedText.contains("Licensed to the Apache Software Foundation (ASF)") && existingText.contains("Copyright") =>
         // This is the case where we have a major change in a previously existing source file with a copyright header, usually (but not always) Lightbend
         existingText
       case Some(existedText) if existingText.contains("Copyright")=>
         existedText
       case Some(existingText) if existedText.contains("Licensed to the Apache Software Foundation (ASF)") =>
         existingText
       case Some(_) =>
         throw new Exception(s"Unknown header detected: $existedText")
       case None =>
         HeaderCommentStyle.cStyleBlockComment.commentCreator(text, existingText)
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
mdedetrich commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023983038


##########
project/CopyrightHeader.scala:
##########
@@ -40,60 +59,61 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = 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) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          throw new IllegalStateException(s"Unable to detect copyright for header:[${existedText}]")

Review Comment:
   Well I would say an exception here is appropriate because otherwise it opens ourselves up to legal issues, also a warning would essentially be ignored by the CI.
   
   If this exception is thrown we should actually investigate what is going on.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
mdedetrich commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1319644961

   @Claudenw Considering the discussion we had in the mailing, is it okay if don't do the header change in the `project/CopyrightHeader.scala` for now? If its a problem then we can we can always update it in the future.
   
   @He-Pin Do you mind reverting the header change?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
mdedetrich commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1318513705

   TBH I can't answer that now because it's not clear, this is why I made a thread on the dev mailing list to talk about it. Please let your thoughts known there!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023726592


##########
project/CopyrightHeader.scala:
##########
@@ -40,55 +40,34 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
 
     override def apply(text: String, existingText: Option[String]): String = {
       val formatted = existingText match {
         case Some(existedText) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          existedText

Review Comment:
   will not update the years any more.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023884125


##########
project/CopyrightHeader.scala:
##########
@@ -40,55 +40,34 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
 
     override def apply(text: String, existingText: Option[String]): String = {
       val formatted = existingText match {
         case Some(existedText) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          existedText

Review Comment:
   Do we need to update the lightbend's year?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
mdedetrich commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1317010094

   @justinmclean 
   
   > 2. The PPMC needs to discuss this before changing the header.
   
   Does the PPMC have to discuss this for **every** single source file that could be considered a major change or should we just agree upon some metric?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] Claudenw commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
Claudenw commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1316684181

   > Most ASF projects use https://creadur.apache.org/rat/ to check headers in files. I'm not saying that Pekko will but I'm just highlighting that Rat exists and that a simple solution like this is fine but there is little point if we end up needing a more complicated solution.
   
   Given the number of files in this collection that will _not_ have Apache licenses in them `rat` is probably not a good solution.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1318512261

   @mdedetrich For me, I think we can just keep things simple, only add apache header to newly created files, but for now, seems there need a vote?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023965610


##########
project/CopyrightHeader.scala:
##########
@@ -40,60 +59,61 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = 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) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          throw new IllegalStateException(s"Unable to detect copyright for header:[${existedText}]")
         case None =>
           HeaderCommentStyle.cStyleBlockComment.commentCreator(text, existingText)
       }
       formatted.trim
     }
+
+    private def isValidCopyRightAnnotated(text: String): Boolean = {
+      def isApacheCopyRighted(text: String): Boolean =
+        StringUtils.contains(text, "licensed to the apache software foundation (asf)") ||
+        StringUtils.contains(text, "www.apache.org/licenses/license-2.0")
+
+      def isLAMPCopyRighted(text: String): Boolean =
+        StringUtils.contains(text, "lamp/epfl")
+
+      def isLightbendCopyRighted(text: String): Boolean =
+        StringUtils.contains(text, "lightbend inc.")
+
+      def isDebianCopyRighted(text: String): Boolean =
+        StringUtils.contains(text, "debian.org")

Review Comment:
   for akka.actor.Chameneos



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023764514


##########
project/CopyrightHeader.scala:
##########
@@ -40,55 +40,34 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 

Review Comment:
   I tooked a look at the spark project, it's works like this, but your suggestion is more elegant 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1374771664

   @mdedetrich @pjfanning @Claudenw @justinmclean Hi I have updated the headers.
   Should I do the second commit with a special git username?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
mdedetrich commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1316628966

   So I think this needs to be clarified by legal (i.e. we should make an Apache legal ticket). iirc there was a discussion elsewhere that we are not allowed to remove the lightbend copyright header and that it should be ammended.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
mdedetrich commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023840142


##########
project/CopyrightHeader.scala:
##########
@@ -40,55 +40,34 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
 
     override def apply(text: String, existingText: Option[String]): String = {
       val formatted = existingText match {
         case Some(existedText) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          existedText

Review Comment:
   > Is contains checking case sensitive? If not the Apache license contains the word "copyright" and may cause a problem.
   
   No its not but that can easily be remedied, i.e.
   
   ```scala
   case Some(existingText) if existedText.toLowerCase.contains("Licensed to the Apache Software Foundation (ASF)") && existingText.contains("Copyright")
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
mdedetrich commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023840142


##########
project/CopyrightHeader.scala:
##########
@@ -40,55 +40,34 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
 
     override def apply(text: String, existingText: Option[String]): String = {
       val formatted = existingText match {
         case Some(existedText) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          existedText

Review Comment:
   > Is contains checking case sensitive? If not the Apache license contains the word "copyright" and may cause a problem.
   
   No its not but that can easily be remedied, i.e.
   
   ```scala
   case Some(existingText) if existedText.toLowerCase.contains("licensed to the apache software foundation (asf)") && existingText.toLowerCase.contains("copyright")
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023952559


##########
project/CopyrightHeader.scala:
##########
@@ -40,60 +59,57 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = 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) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          throw new IllegalStateException(s"Unable to detect copyright for header:[${existedText}]")
         case None =>
           HeaderCommentStyle.cStyleBlockComment.commentCreator(text, existingText)
       }
       formatted.trim
     }
+
+    private def isValidCopyRightAnnotated(text: String): Boolean = {
+      def isApacheCopyRighted(text: String): Boolean =
+        StringUtils.contains(text, "licensed to the apache software foundation (asf)") ||
+        StringUtils.contains(text, "http://www.apache.org/licenses/license-2.0")
+
+      def isLAMPCopyRighted(text: String): Boolean =
+        StringUtils.contains(text, "lamp/epfl")

Review Comment:
   for akka.routing.MurmurHash



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] justinmclean commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
justinmclean commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1316965854

   Hi,
   > Have one review comment. Since this change inofitself is also considered a major change (legally speaking) we also need to modify this header file to a combined copyright + apache
   > 
   
   1. I don’t think this would be considered a major change.
   2. The PPMC needs to discuss this before changing the header.
   
   Kind Regards,
   Justin
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] pjfanning commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
pjfanning commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1356932872

   > Hi, The project is "Apache Pekko" not “Pekko”. Justin
   
   Adjusted my comment to use "Apache Pekko"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1372295513

   i will update my prs tomorrow, stay turn


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023952053


##########
project/CopyrightHeader.scala:
##########
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /*
  * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
  */

Review Comment:
   The new header is updated as @mdedetrich suggested.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] Claudenw commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
Claudenw commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023834977


##########
project/CopyrightHeader.scala:
##########
@@ -40,55 +40,34 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
 
     override def apply(text: String, existingText: Option[String]): String = {
       val formatted = existingText match {
         case Some(existedText) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          existedText

Review Comment:
   Is `contains` checking case sensitive?  If not the Apache license contains the word "copyright" and may cause a problem.
   Alternatively the test could look for " * Copyright " as the beginning of a line.
   Alternative 2 the test could be changed to look for " * Copyright"



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1319648549

   > @Claudenw Considering the discussion we had in the mailing, is it okay if don't do the header change in the `project/CopyrightHeader.scala` for now? If its a problem then we can we can always update it in the future.
   > 
   > @He-Pin Do you mind reverting the header change?
   
   WILL DO


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1319955386

   I think if we need to update all current `Lightbend copyrighted` files to something like:
   https://issues.apache.org/jira/browse/LEGAL-626?focusedCommentId=17635668&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17635668
   ```
   /*
    * Pekko is a fork of Akka 2.6.20. Any modifications are:
    *
    * Licensed to the Apache Software Foundation (ASF) under one
    * or more contributor license agreements.  See the NOTICE file
    * distributed with this work for additional information
    * regarding copyright ownership.  The ASF licenses this file
    * to you under the Apache License, Version 2.0 (the
    * "License"); you may not use this file except in compliance
    * with the License.  You may obtain a copy of the License at
    *
    *   http://www.apache.org/licenses/LICENSE-2.0
    *
    * Unless required by applicable law or agreed to in writing,
    * software distributed under the License is distributed on an
    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    * KIND, either express or implied.  See the License for the
    * specific language governing permissions and limitations
    * under the License. 
    *
    * See source control history for modification details.
    */
   /*
    * Akka 2.6.20 is provided under the Apache-2.0 license.
    */
   /*
    * Copyright (C) 20YY-20YY Lightbend Inc. <https://www.lightbend.com>
    */
   ```
   
   We can do it in a later separated PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on a diff in pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on code in PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#discussion_r1023974901


##########
project/CopyrightHeader.scala:
##########
@@ -40,60 +59,61 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  // We hard-code this so PR's created in year X will not suddenly fail in X+1.
-  // Of course we should remember to update it early in the year.
-  val CurrentYear = "2022"
-  val CopyrightPattern = "Copyright \\([Cc]\\) (\\d{4}([-–]\\d{4})?) (Lightbend|Typesafe) Inc. <.*>".r
-  val CopyrightHeaderPattern = s"(?s).*${CopyrightPattern}.*".r
-
   def headerFor(year: String): String =
     s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
 
-  val cStyleComment = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
-
-    def updateLightbendHeader(header: String): String = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        if (years != CurrentYear)
-          CopyrightPattern.replaceFirstIn(header, headerFor(years + "-" + CurrentYear))
-        else
-          CopyrightPattern.replaceFirstIn(header, headerFor(years))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        CopyrightPattern.replaceFirstIn(header, headerFor(years.replace(endYears, "-" + CurrentYear)))
-      case _ =>
-        header
-    }
+  def apacheHeader: String =
+    """Licensed to the Apache Software Foundation (ASF) under one
+      |or more contributor license agreements.  See the NOTICE file
+      |distributed with this work for additional information
+      |regarding copyright ownership.  The ASF licenses this file
+      |to you under the Apache License, Version 2.0 (the
+      |"License"); you may not use this file except in compliance
+      |with the License.  You may obtain a copy of the License at
+      |
+      |  http://www.apache.org/licenses/LICENSE-2.0
+      |
+      |Unless required by applicable law or agreed to in writing,
+      |software distributed under the License is distributed on an
+      |"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |KIND, either express or implied.  See the License for the
+      |specific language governing permissions and limitations
+      |under the License.
+      |""".stripMargin
 
-    def parseStartAndEndYear(header: String): Option[(String, Option[String])] = header match {
-      case CopyrightHeaderPattern(years, null, _) =>
-        Some((years, None))
-      case CopyrightHeaderPattern(years, endYears, _) =>
-        Some((years, Some(endYears)))
-      case _ =>
-        None
-    }
+  val cStyleComment = 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) =>
-          parseStartAndEndYear(existedText) match {
-            case Some((years, None)) =>
-              if (years != CurrentYear) {
-                val header = headerFor(years + "-" + CurrentYear)
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-              } else {
-                HeaderCommentStyle.cStyleBlockComment.commentCreator(headerFor(CurrentYear), existingText)
-              }
-            case Some((years, Some(endYears))) =>
-              val header = headerFor(years.replace(endYears, "-" + CurrentYear))
-              HeaderCommentStyle.cStyleBlockComment.commentCreator(header, existingText)
-            case None =>
-              existedText
-          }
+          throw new IllegalStateException(s"Unable to detect copyright for header:[${existedText}]")

Review Comment:
   Just a warning ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1375040526

   ```
   [01-08 09:37:32.574] [info]   - must work for small functions *** FAILED *** (30 milliseconds)
   [01-08 09:37:32.575] [info]     LineNumberSpecCodeForScala.scala:22 did not equal LineNumberSpecCodeForScala.scala:13 (LineNumberSpec.scala:28)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] He-Pin commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
He-Pin commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1319679995

   @justinmclean @Claudenw @mdedetrich Hi, team , how about I just add the new apache header, I hope this one get merged this weekend:)
   Just as @Claudenw said, I think this is a major change because it will create default apache header instead of lightbend one.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
mdedetrich commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1318273170

   @He-Pin For now its fine which is why I approved the PR, we can always improve it later and it doesn't make sense to block the PR due to this.
   
   The only thing that we need clarity on is whether we have the change the header for `project/CopyrightHeader.scala` file itself.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] justinmclean commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
justinmclean commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1319736532

   If the PPMC thinks it's a major change I'm good with that.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] pjfanning commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
pjfanning commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1316667127

   Most ASF projects use https://creadur.apache.org/rat/ to check headers in files. I'm not saying that Pekko will but I'm just highlighting that Rat exists and that a simple solution like this is fine but there is little point if we end up needing a more complicated solution.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] mdedetrich commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
mdedetrich commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1374775372

   > Should I do the second commit with a special git username?
   
   I don't think that's necessary, the special git username is just for formatting commits since they don't change cosebase in any fundamental way.
   
   If you want, you can be a bit more clean and put the modification of source files with the header into a separate commit and do rebase and merge to have a nicer git history.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


[GitHub] [incubator-pekko] pjfanning commented on pull request #50: !sbt Use apache header for new files.

Posted by GitBox <gi...@apache.org>.
pjfanning commented on PR #50:
URL: https://github.com/apache/incubator-pekko/pull/50#issuecomment-1372234416

   @He-Pin @mdedetrich should we start this task again or is this a good starting point for the agreed solution?
   
   The agreed solution is to put the header in https://github.com/apache/incubator-pekko/pull/50#issuecomment-1356882792 into every file, old and new. Any existing headers are retained. We can put the new header on top of every file.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org