You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by fa...@apache.org on 2023/03/06 09:38:00 UTC

[incubator-pekko-persistence-cassandra] branch main updated: add headers to conf files (#23)

This is an automated email from the ASF dual-hosted git repository.

fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-persistence-cassandra.git


The following commit(s) were added to refs/heads/main by this push:
     new 4ce5a8a  add headers to conf files (#23)
4ce5a8a is described below

commit 4ce5a8a7cfdef6eb562625da326e860a1540a661
Author: PJ Fanning <pj...@users.noreply.github.com>
AuthorDate: Mon Mar 6 10:37:54 2023 +0100

    add headers to conf files (#23)
    
    * add headers to conf files
    
    * fix header create
    
    * Update checks.yml
---
 .github/release-drafter.yml              | 22 -----------
 .github/workflows/checks.yml             |  2 +-
 .github/workflows/release-drafter.yml    | 19 ---------
 .github/workflows/release.yml            | 49 -----------------------
 CONTRIBUTING.md                          |  2 +-
 core/src/main/resources/reference.conf   |  1 +
 core/src/test/resources/application.conf |  2 +
 docs/release-train-issue-template.md     | 68 --------------------------------
 docs/src/main/paradox/overview.md        |  4 +-
 project/Common.scala                     | 22 +++++------
 project/CopyrightHeader.scala            | 55 +++++++++++++++++---------
 project/Dependencies.scala               |  9 +++++
 12 files changed, 62 insertions(+), 193 deletions(-)

diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml
deleted file mode 100644
index d21bf34..0000000
--- a/.github/release-drafter.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-template: |
-  ## Akka Persistence Cassandra $NEXT_PATCH_VERSION Released
-
-  Dear hakkers,
-
-  We are pleased to announce a new patch release of Akka Persistence Cassandra 1.x. This release includes the following changes:
-
-  $CHANGES
-
-  A total of *TODO* issues were closed since *TODO*. The complete list can be found on the *TODO* $NEXT_PATCH_VERSION milestone on GitHub.
-
-  # Credits 
-
-  For this release we had the help of *TODO* committers – thank you all very much!
-
-  *TODO*
-
-  Thanks to [Lightbend](https://www.lightbend.com) for their continued sponsorship of the Akka core team's efforts. Lightbend [offers commercial support](https://www.lightbend.com/lightbend-platform-subscription) for Akka.
-
-  Happy hakking!
-
-  – The Akka Team
diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml
index a07ffdf..50a8f7b 100644
--- a/.github/workflows/checks.yml
+++ b/.github/workflows/checks.yml
@@ -41,7 +41,7 @@ jobs:
         run: sbt "verifyCodeStyle; +Test/compile" # todo: add mimaReportBinaryIssues
 
 
-  check-docs::
+  check-docs:
     name: ScalaDoc, Documentation with Paradox
     if: github.repository == 'apache/incubator-pekko-persistence-cassandra'
     runs-on: ubuntu-20.04
diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml
deleted file mode 100644
index 94f67f4..0000000
--- a/.github/workflows/release-drafter.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-name: Release Drafter
-
-on:
-  push:
-    # branches to consider in the event; optional, defaults to all
-    branches:
-      - master
-      - main
-
-jobs:
-  update_release_draft:
-    runs-on: ubuntu-20.04
-    steps:
-      # Drafts your next Release notes as Pull Requests are merged into "master"
-      - uses: release-drafter/release-drafter@v5
-        with:
-          config-name: release-drafter.yml # located in .github/ in default branch
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
deleted file mode 100644
index 32b60ef..0000000
--- a/.github/workflows/release.yml
+++ /dev/null
@@ -1,49 +0,0 @@
-name: Publish
-
-on:
-  push:
-    branches:
-      - master
-      - main
-      - release-*
-    tags: ["v*"]
-
-jobs:
-  release:
-    # runs on main repo only
-    if: false # github.repository == 'apache/incubator-pekko-persistence-cassandra'
-    name: Release
-    environment: release
-    runs-on: ubuntu-20.04
-    env:
-      JAVA_OPTS: -Xms2G -Xmx2G -Xss2M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
-    steps:
-      - name: Checkout
-        uses: actions/checkout@v3
-        with:
-          # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
-          fetch-depth: 0
-
-      - name: Setup Java 8
-        uses: actions/setup-java@v3
-        with:
-          distribution: temurin
-          java-version: 8
-
-      - name: Publish artifacts for all Scala versions
-        env:
-          PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
-          PGP_SECRET: ${{ secrets.PGP_SECRET }}
-          SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
-          SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
-        run: sbt ci-release
-
-      - name: Publish API and reference documentation
-        env:
-          GUSTAV_KEY: ${{ secrets.GUSTAV_KEY }}
-        run: |+
-          eval "$(ssh-agent -s)"
-          echo $GUSTAV_KEY | base64 -di > .github/id_rsa
-          chmod 600 .github/id_rsa
-          ssh-add .github/id_rsa
-          sbt ++2.13.8 docs/publishRsync
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 56e43f9..9434ed1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -125,7 +125,7 @@ Each project must also create and maintain a list of all dependencies and their
 
 ## Work In Progress
 
-It is ok to work on a public feature branch in the GitHub repository. Something that can sometimes be useful for early feedback etc. If so then it is preferable to name the branch accordingly. This can be done by either prefix the name with ``wip-`` as in ‘Work In Progress’, or use hierarchical names like ``wip/..``, ``feature/..`` or ``topic/..``. Either way is fine as long as it is clear that it is work in progress and not ready for merge. This work can temporarily have a lower standar [...]
+It is ok to work on a public feature branch in the GitHub repository. Something that can sometimes be useful for early feedback etc. If so then it is preferable to name the branch accordingly. This can be done by either prefix the name with ``wip-`` as in ‘Work In Progress’, or use hierarchical names like ``wip/..``, ``feature/..`` or ``topic/..``. Either way is fine as long as it is clear that it is work in progress and not ready for merge. This work can temporarily have a lower standar [...]
 
 Also, to facilitate both well-formed commits and working together, the ``wip`` and ``feature``/``topic`` identifiers also have special meaning.   Any branch labelled with ``wip`` is considered “git-unstable” and may be rebased and have its history rewritten.   Any branch with ``feature``/``topic`` in the name is considered “stable” enough for others to depend on when a group is working on a feature.
 
diff --git a/core/src/main/resources/reference.conf b/core/src/main/resources/reference.conf
index e485f37..0520b25 100644
--- a/core/src/main/resources/reference.conf
+++ b/core/src/main/resources/reference.conf
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: Apache-2.0
 
 # This configures the default settings for all Cassandra Journal plugin
 # instances in the system. If you are using just one configuration for
diff --git a/core/src/test/resources/application.conf b/core/src/test/resources/application.conf
index 4c15680..685dc29 100644
--- a/core/src/test/resources/application.conf
+++ b/core/src/test/resources/application.conf
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: Apache-2.0
+
 datastax-java-driver {
   basic {
     request {
diff --git a/docs/release-train-issue-template.md b/docs/release-train-issue-template.md
deleted file mode 100644
index 9ea60ae..0000000
--- a/docs/release-train-issue-template.md
+++ /dev/null
@@ -1,68 +0,0 @@
-Release Akka Persistence Cassandra $VERSION$
-
-<!--
-
-(Liberally copied and adopted from Scala itself https://github.com/scala/scala-dev/blob/b11cd2e4a4431de7867db6b39362bea8fa6650e7/notes/releases/template.md)
-
-For every release, make a copy of this file named after the release, and expand the variables.
-Ideally replacing variables could become a script you can run on your local machine.
-
-Variables to be expanded in this template:
-- $VERSION$=??? 
-
--->
-
-### before the release
-
-- [ ] Create a new milestone for the [next version](https://github.com/akka/akka-persistence-cassandra/milestones)
-- [ ] Check [closed issues without a milestone](https://github.com/akka/akka-persistence-cassandra/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20no%3Amilestone) and either assign them the 'upcoming' release milestone or `invalid/not release-bound`
-- [ ] Make sure all important / big PRs have been merged by now
-
-### Preparing release notes in the documentation / announcement
-
-- [ ] For non-patch releases: Create a news item draft PR on [akka.github.com](https://github.com/akka/akka.github.com), using the milestone
-- [ ] Move all [unclosed issues](https://github.com/akka/akka-persistence-cassandra/issues?q=is%3Aopen+is%3Aissue+milestone%3A$VERSION$) for this milestone to the next milestone
-- [ ] Close the [milestone](https://github.com/akka/akka-persistence-cassandra/milestones?direction=asc&sort=due_date)
-
-### Cutting the release
-
-- [ ] Make sure any running [Github Action builds](https://github.com/apache/incubator-pekko-persistence-cassandra/actions) for the commit you would like to release have completed.
-- [ ] Create the [release notes](https://github.com/akka/akka-persistence-cassandra/releases) with the next tag version `v$VERSION$`, title, release description and contributors (the latter generated by [`authors`](https://github.com/2m/authors) (eg. `authors v1.0.1 HEAD`))
-- [ ] Check that Github Actions CI release build has executed successfully (Github Actions will start a [CI build](https://github.com/apache/incubator-pekko-persistence-cassandra/actions) for the new tag and publish artifacts to Bintray and documentation to Gustav)
-- [ ] Go to [Bintray](https://bintray.com/akka/maven/akka-persistence-cassandra) and select the just released version
-- [ ] Log in, go to the Maven Central tab, check the *Close and release repository when done* checkbox and sync with Sonatype (using your Sonatype TOKEN key and password)
-
-### Check availability
-
-- [ ] Check [reference](https://doc.akka.io/docs/akka-persistence-cassandra/$VERSION$/) documentation
-- [ ] Check the release on [Maven central](https://repo1.maven.org/maven2/com/typesafe/akka/akka-persistence-cassandra_2.12/$VERSION$/)
-
-### When everything is on maven central
-  - [ ] `ssh akkarepo@gustav.akka.io`
-    - [ ] update the `current` links on `repo.akka.io` by with the script:
-         ```
-         ./update-akka-persistence-cassandra-current-version.sh $VERSION$
-         ```
-    - [ ] check changes and commit the new version to the local git repository
-         ```
-         cd ~/www
-         git add docs/akka-persistence-cassandra/current docs/akka-persistence-cassandra/$VERSION$
-         git commit -m "akka-persistence-cassandra $VERSION$"
-         ```
-
-### Announcements
-
-For non-patch (minor/major) releases:
-
-- [ ] Merge draft news item for [akka.io](https://github.com/akka/akka.github.com)
-
-For patch and non-patch releases:
-
-- [ ] Send a release notification to [Lightbend discuss](https://discuss.akka.io)
-- [ ] Tweet using the akkateam account (or ask someone to) about the new release
-- [ ] Announce on [Gitter akka/akka](https://gitter.im/akka/akka-persistence-cassandra)
-- [ ] Announce internally
-
-### Afterwards
-
-- Close this issue
diff --git a/docs/src/main/paradox/overview.md b/docs/src/main/paradox/overview.md
index fbf502f..de36c06 100644
--- a/docs/src/main/paradox/overview.md
+++ b/docs/src/main/paradox/overview.md
@@ -40,7 +40,7 @@ To use the plugin with **Akka 2.5.x** you must use @extref:[version 0.103](apc-0
 [bintray-badge]:  https://api.bintray.com/packages/akka/snapshots/akka-persistence-cassandra/images/download.svg
 [bintray]:        https://bintray.com/akka/snapshots/akka-persistence-cassandra/_latestVersion
 
-Snapshots are published to a snapshot repository in Sonatype after every successful build on master. Add the following to your project build definition to resolve snapshots:
+Snapshots are published to a snapshot repository in Sonatype after every successful build on main branch. Add the following to your project build definition to resolve snapshots:
 
 sbt
 :   ```scala
@@ -83,6 +83,6 @@ It moved to the [Akka](https://github.com/akka/) organisation in 2016 and the fi
 
 ## Contributing
 
-Please feel free to contribute to Akka and Akka Persistence Cassandra by reporting issues you identify, or by suggesting changes to the code. Please refer to our [contributing instructions](https://github.com/akka/akka/blob/master/CONTRIBUTING.md) to learn how it can be done.
+Please feel free to contribute to Akka and Akka Persistence Cassandra by reporting issues you identify, or by suggesting changes to the code. Please refer to our [contributing instructions](https://github.com/apache/incubator-pekko/blob/main/CONTRIBUTING.md) to learn how it can be done.
 
 We want Akka to strive in a welcoming and open atmosphere and expect all contributors to respect our [code of conduct](https://www.lightbend.com/conduct).
diff --git a/project/Common.scala b/project/Common.scala
index 0111969..1c051ed 100644
--- a/project/Common.scala
+++ b/project/Common.scala
@@ -1,5 +1,13 @@
+/*
+ * 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 Apache Pekko project, which was derived from Akka.
+ */
+
 import com.lightbend.paradox.projectinfo.ParadoxProjectInfoPluginKeys._
-import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport._
 import de.heikoseeberger.sbtheader._
 import org.scalafmt.sbt.ScalafmtPlugin.autoImport._
 import sbt.Keys._
@@ -48,7 +56,7 @@ object Common extends AutoPlugin {
       "-sourcepath",
       (ThisBuild / baseDirectory).value.toString,
       "-doc-source-url", {
-        val branch = if (isSnapshot.value) "master" else s"v${version.value}"
+        val branch = if (isSnapshot.value) "main" else s"v${version.value}"
         s"https://github.com/apache/incubator-pekko-persistence-cassandra/tree/${branch}€{FILE_PATH_EXT}#L€{FILE_LINE}"
       },
       "-doc-canonical-base-url",
@@ -59,7 +67,6 @@ object Common extends AutoPlugin {
     Compile / doc / scalacOptions --= Seq("-Xfatal-warnings"),
     scalafmtOnCompile := true,
     autoAPIMappings := true,
-    headerLicense := Some(HeaderLicense.Custom(apacheHeader)),
     sonatypeProfileName := "org.apache.pekko",
     Test / logBuffered := System.getProperty("pekko.logBufferedTests", "false").toBoolean,
     // show full stack traces and test case durations
@@ -69,13 +76,4 @@ object Common extends AutoPlugin {
     // -q Suppress stdout for successful tests.
     Test / testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v", "-q"),
     Test / parallelExecution := false)
-
-  def apacheHeader: String =
-    """Licensed to the Apache Software Foundation (ASF) under one or more
-      |license agreements; and to You under the Apache License, version 2.0:
-      |
-      |  https://www.apache.org/licenses/LICENSE-2.0
-      |
-      |This file is part of the Apache Pekko project, derived from Akka.
-      |""".stripMargin
 }
diff --git a/project/CopyrightHeader.scala b/project/CopyrightHeader.scala
index 3fddd4d..54270e9 100644
--- a/project/CopyrightHeader.scala
+++ b/project/CopyrightHeader.scala
@@ -30,6 +30,7 @@ trait CopyrightHeader extends AutoPlugin {
           headerMappings := headerMappings.value ++ Map(
             HeaderFileType.scala -> cStyleComment,
             HeaderFileType.java -> cStyleComment,
+            HeaderFileType.conf -> hashLineComment,
             HeaderFileType("template") -> cStyleComment)))
     }
 
@@ -45,10 +46,7 @@ trait CopyrightHeader extends AutoPlugin {
         (Test / compile).value
       })
 
-  def headerFor(year: String): String =
-    s"Copyright (C) $year Lightbend Inc. <https://www.lightbend.com>"
-
-  def apacheHeader: String =
+  val apacheHeader: String =
     """Licensed to the Apache Software Foundation (ASF) under one or more
       |license agreements; and to You under the Apache License, version 2.0:
       |
@@ -57,37 +55,56 @@ trait CopyrightHeader extends AutoPlugin {
       |This file is part of the Apache Pekko project, derived from Akka.
       |""".stripMargin
 
+  val apacheSpdxHeader: String = "SPDX-License-Identifier: Apache-2.0"
+
   val cStyleComment: CommentStyle = HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
 
     override def apply(text: String, existingText: Option[String]): String = {
       val formatted = existingText match {
-        case Some(existedText) if isValidCopyRightAnnotated(existedText) =>
+        case Some(existedText) if isValidCopyrightAnnotated(existedText) =>
           existedText
-        case Some(existedText) if isOnlyLightbendCopyRightAnnotated(existedText) =>
+        case Some(existedText) if isOnlyLightbendCopyrightAnnotated(existedText) =>
           HeaderCommentStyle.cStyleBlockComment.commentCreator(text, existingText) + NewLine * 2 + existedText
         case Some(existedText) =>
-          throw new IllegalStateException(s"Unable to detect copyright for header:[${existedText}]")
+          throw new IllegalStateException(s"Unable to detect Copyright for header:[${existedText}]")
         case None =>
           HeaderCommentStyle.cStyleBlockComment.commentCreator(text, existingText)
       }
       formatted.trim
     }
+  })
 
-    private def isApacheCopyRighted(text: String): Boolean =
-      text.contains("Licensed to the Apache Software Foundation (ASF)") ||
-      text.contains("www.apache.org/licenses/license-2.0")
-
-    private def isLightbendCopyRighted(text: String): Boolean =
-      text.contains("Lightbend Inc.")
-
-    private def isValidCopyRightAnnotated(text: String): Boolean = {
-      isApacheCopyRighted(text)
-    }
+  val hashLineComment = HeaderCommentStyle.hashLineComment.copy(commentCreator = new CommentCreator() {
 
-    private def isOnlyLightbendCopyRightAnnotated(text: String): Boolean = {
-      isLightbendCopyRighted(text) && !isApacheCopyRighted(text)
+    // deliberately hardcode use of apacheSpdxHeader and ignore input text
+    override def apply(text: String, existingText: Option[String]): String = {
+      val formatted = existingText match {
+        case Some(currentText) if isApacheCopyrighted(currentText) =>
+          currentText
+        case Some(currentText) =>
+          HeaderCommentStyle.hashLineComment.commentCreator(apacheSpdxHeader, existingText) + NewLine * 2 + currentText
+        case None =>
+          HeaderCommentStyle.hashLineComment.commentCreator(apacheSpdxHeader, existingText)
+      }
+      formatted.trim
     }
   })
+
+  private def isApacheCopyrighted(text: String): Boolean =
+    text.contains("Licensed to the Apache Software Foundation (ASF)") ||
+    text.contains("www.apache.org/licenses/license-2.0") ||
+    text.contains("Apache-2.0")
+
+  private def isLightbendCopyrighted(text: String): Boolean =
+    text.contains("Lightbend Inc.")
+
+  private def isValidCopyrightAnnotated(text: String): Boolean = {
+    isApacheCopyrighted(text)
+  }
+
+  private def isOnlyLightbendCopyrightAnnotated(text: String): Boolean = {
+    isLightbendCopyrighted(text) && !isApacheCopyrighted(text)
+  }
 }
 
 object CopyrightHeader extends CopyrightHeader
diff --git a/project/Dependencies.scala b/project/Dependencies.scala
index 5b2f895..0268226 100644
--- a/project/Dependencies.scala
+++ b/project/Dependencies.scala
@@ -1,3 +1,12 @@
+/*
+ * 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 Apache Pekko project, which was derived from Akka.
+ */
+
 import sbt._
 import Keys._
 


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