Skip to content

Commit 4905c8e

Browse files
committed
Fix migration to PSH
1 parent 2b1aa2a commit 4905c8e

File tree

40 files changed

+201
-179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

40 files changed

+201
-179
lines changed

.github/workflows/standard-workflow.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ jobs:
135135
working-directory: examples/akka-persistence-app
136136

137137
# <PEKKO-REMOVE-START>
138-
patch-and-push-to-ash:
138+
patch-and-push-to-psh:
139139
if: github.event_name != 'pull_request'
140140
needs: [code-style-check, test-212, test-213-1, test-213-2, test-sbt-plugin, run-examples]
141141
runs-on: ubuntu-latest
@@ -145,20 +145,15 @@ jobs:
145145
# Fetch all history so that a push to pekko-serialization-helper succeeds.
146146
# See https://stackoverflow.com/q/76470864
147147
fetch-depth: 0
148-
- uses: coursier/cache-action@v6
149-
- uses: coursier/setup-action@v1
150148
- run: git status
151-
- run: git checkout -b chore/from-ash
149+
- run: git checkout -b TEMP/from-ash
152150
- run: curl -sL https://raw.githubusercontent.com/ap/rename/master/rename | sudo tee /usr/local/bin/rename
153151
- run: sudo chmod +x /usr/local/bin/rename
154152
- run: ./scripts/akka-to-pekko
155153
- run: git add .
156154
- run: git config user.email "psh@virtuslab.com"
157155
- run: git config user.name "Pekko Serialization Helper Bot"
158156
- run: git commit -m 'Migrate `main` branch from from akka-serialization-helper'
159-
- run: git clean -dxf
160-
- run: ./scripts/format-code
161-
- run: git commit -a --amend --no-edit
162157
- env:
163158
# 2.1 Generate an SSH key in terminal (Leave the passphrase empty)
164159
# 2.2 Add public key in the external repository: <external repository>/Settings/Deploy keys/Add deploy key
@@ -167,7 +162,7 @@ jobs:
167162
# Paste the private key.
168163
PSH_SSH_PRIVATE_KEY: ${{ secrets.PSH_SSH_PRIVATE_KEY }}
169164
run: mkdir -p ~/.ssh/ && echo "$PSH_SSH_PRIVATE_KEY" > ~/.ssh/psh && chmod 400 ~/.ssh/psh
170-
- run: git config --add --local core.sshCommand 'ssh -i ~/.ssh/psh'
165+
- run: git config core.sshCommand "ssh -i $HOME/.ssh/psh"
171166
- run: git push --force git@github.com:VirtusLab/pekko-serialization-helper.git HEAD:main
172167
# <PEKKO-REMOVE-END>
173168

.scala-steward.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ buildRoots = [
1212
]
1313

1414
# <PEKKO-UNCOMMENT> updates.allow = [ { groupId = "org.apache.pekko" } ]
15-
1615
# <PEKKO-REMOVE-START>
1716
updates.pin = [
1817
# * org.scala-lang.modules:scala-xml_2.12:2.1.0 (early-semver) is selected over 1.2.0

.scalafix.conf

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ rules = [
22
OrganizeImports
33
]
44

5-
OrganizeImports.expandRelative = true
6-
OrganizeImports.removeUnused = true
7-
OrganizeImports.groupedImports = Explode
8-
OrganizeImports.groups = [
9-
"java.",
10-
"scala.",
11-
"*",
12-
"org.virtuslab.ash"
13-
]
5+
OrganizeImports {
6+
expandRelative = true
7+
removeUnused = true
8+
groupedImports = Explode
9+
groups = [
10+
"java.",
11+
"scala.",
12+
"akka.",
13+
"*",
14+
"org.virtuslab.ash"
15+
]
16+
}

.scalafmt.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ style = defaultWithAlign
55
runner.dialect = scala213
66
docstrings.style = Asterisk
77
indentOperator.preset = spray
8-
maxColumn = 120
8+
maxColumn = 128
99
rewrite.rules = [RedundantParens, AvoidInfix]
1010
align.tokens = [{code = "=>", owner = "Case"}]
1111
align.openParenDefnSite = false

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Akka Serialization Helper
22

3-
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.virtuslab.ash/sbt-akka-serialization-helper/badge.svg)](https://mvnrepository.com/artifact/org.virtuslab.ash)
3+
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.virtuslab.ash/annotation_2.13/badge.svg)](https://mvnrepository.com/artifact/org.virtuslab.ash)
44
[![GitHub Actions](https://github.com/VirtusLab/akka-serialization-helper/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/VirtusLab/akka-serialization-helper/actions)
55
[![License: MIT](https://img.shields.io/github/license/VirtusLab/akka-serialization-helper)](LICENSE)
66

annotation/src/main/scala/org/virtuslab/ash/annotation/SerializabilityTrait.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package org.virtuslab.ash.annotation
22

33
/**
4-
* This annotation is used as a marker for Codec Registration Checker and Serializability Checker. Annotate Akka
5-
* serialization marker-trait, and the rest is done by compiler plugins.
4+
* This annotation is used as a marker for Codec Registration Checker and Serializability Checker. Annotate Akka serialization
5+
* marker-trait, and the rest is done by compiler plugins.
66
*
77
* {{{
88
* @SerializabilityTrait

annotation/src/main/scala/org/virtuslab/ash/annotation/Serializer.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ import scala.annotation.nowarn
55
/**
66
* This annotation is used by Codec Registration Checker for marking serializers.
77
*
8-
* Compiler plugin takes the body of a marked class, collects all types that are present, filters them with provided
9-
* regex and extracts type parameters. Then filtered types and extracted type parameters are checked against all direct
10-
* subtypes of `clazz`.
8+
* Compiler plugin takes the body of a marked class, collects all types that are present, filters them with provided regex and
9+
* extracts type parameters. Then filtered types and extracted type parameters are checked against all direct subtypes of
10+
* `clazz`.
1111
*
1212
* Sometimes types appear unexpectedly during type class derivation leading to false negatives, i.e. a codec reported as
13-
* registered even though it's NOT registered. The role of `typeRegexPattern` is to filter detected types, ensuring they
14-
* are used in the right context.
13+
* registered even though it's NOT registered. The role of `typeRegexPattern` is to filter detected types, ensuring they are
14+
* used in the right context.
1515
*
16-
* For example, if we want to serialize `trait Command`, then type `Registration[Command]` is relevant, while
17-
* `Option[Command]` is not.
16+
* For example, if we want to serialize `trait Command`, then type `Registration[Command]` is relevant, while `Option[Command]`
17+
* is not.
1818
*
1919
* If you are using `circe-akka-serializer`, set `typeRegexPattern` to `Register.REGISTRATION_REGEX`
2020
*

build.sbt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,10 @@ ThisBuild / organization := "org.virtuslab.ash"
3232
ThisBuild / organizationName := "VirtusLab"
3333
ThisBuild / versionScheme := Some("early-semver")
3434
ThisBuild / homepage := Some(url("https://github.com/VirtusLab/akka-serialization-helper"))
35-
ThisBuild / licenses := List(
36-
"MIT License" -> url("https://github.com/VirtusLab/akka-serialization-helper/blob/main/LICENSE"))
35+
ThisBuild / licenses := List("MIT License" -> url("https://github.com/VirtusLab/akka-serialization-helper/blob/main/LICENSE"))
3736
ThisBuild / developers := List(
3837
Developer("MarconZet", "Marcin Złakowski", "mzlakowski@virtuslab.com", url("https://github.com/MarconZet")),
39-
Developer(
40-
"LukaszKontowski",
41-
"Łukasz Kontowski",
42-
"lkontowski@virtuslab.com",
43-
url("https://github.com/LukaszKontowski")),
38+
Developer("LukaszKontowski", "Łukasz Kontowski", "lkontowski@virtuslab.com", url("https://github.com/LukaszKontowski")),
4439
Developer("PawelLipski", "Paweł Lipski", "plipski@virtuslab.com", url("https://github.com/PawelLipski")))
4540

4641
sonatypeProfileName := "org.virtuslab"

circe-akka-serializer/src/main/scala/org/virtuslab/ash/circe/CirceAkkaSerializer.scala

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import scala.reflect.ClassTag
88
import akka.actor.ExtendedActorSystem
99
import akka.event.Logging
1010
import akka.serialization.SerializerWithStringManifest
11+
1112
import io.circe._
1213
import io.circe.jawn.JawnParser
1314

@@ -98,19 +99,17 @@ abstract class CirceAkkaSerializer[Ser <: AnyRef: ClassTag](system: ExtendedActo
9899
/**
99100
* The intended usage of this method is to provide any form of support for generic classes.
100101
*
101-
* Because of type erasure, it's impossible to [[org.virtuslab.ash.circe.Register]] one generic class two times with
102-
* different type parameters.
102+
* Because of type erasure, it's impossible to [[org.virtuslab.ash.circe.Register]] one generic class two times with different
103+
* type parameters.
103104
*
104-
* The trick for combating type erasure is to register generic class only once with type parameter being its upper
105-
* bound, and provide custom made [[io.circe.Codec]] that can serialize/deserialize all classes that are used as a
106-
* type parameter.
105+
* The trick for combating type erasure is to register generic class only once with type parameter being its upper bound, and
106+
* provide custom made [[io.circe.Codec]] that can serialize/deserialize all classes that are used as a type parameter.
107107
*
108-
* For example, if the upper bound is `Any`, but you know that only `Int` and `String` are used as a type parameter,
109-
* then you can create a custom [[io.circe.Codec]] for `Any` that handles `Int` and `String` and throws `Exception`
110-
* otherwise.
108+
* For example, if the upper bound is `Any`, but you know that only `Int` and `String` are used as a type parameter, then you
109+
* can create a custom [[io.circe.Codec]] for `Any` that handles `Int` and `String` and throws `Exception` otherwise.
111110
*
112-
* To use this method correctly, set the upper bound for the type parameter of generic class to `Ser` and put the
113-
* returned Codec as implicit in a place that can be seen by type derivation.
111+
* To use this method correctly, set the upper bound for the type parameter of generic class to `Ser` and put the returned
112+
* Codec as implicit in a place that can be seen by type derivation.
114113
*
115114
* Example of generic class:
116115
* {{{
@@ -129,12 +128,7 @@ abstract class CirceAkkaSerializer[Ser <: AnyRef: ClassTag](system: ExtendedActo
129128
private def logDuration(action: String, obj: AnyRef, startTime: Long, bytes: Array[Byte]): Unit = {
130129
if (isDebugEnabled) {
131130
val durationMicros = (System.nanoTime - startTime) / 1000
132-
log.debug(
133-
"{} of [{}] took [{}] microsecond, size [{}] bytes",
134-
action,
135-
obj.getClass.getName,
136-
durationMicros,
137-
bytes.length)
131+
log.debug("{} of [{}] took [{}] microsecond, size [{}] bytes", action, obj.getClass.getName, durationMicros, bytes.length)
138132
}
139133
}
140134

circe-akka-serializer/src/main/scala/org/virtuslab/ash/circe/CirceTraitCodec.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,21 @@ trait CirceTraitCodec[Ser <: AnyRef] extends Codec[Ser] {
1717
/**
1818
* Sequence that must contain [[org.virtuslab.ash.circe.Registration]] for all direct subclasses of Ser.
1919
*
20-
* Each `Registration` is created using [[org.virtuslab.ash.circe.Register]]s
21-
* [[org.virtuslab.ash.circe.Register#apply]] method.
20+
* Each `Registration` is created using [[org.virtuslab.ash.circe.Register]]s [[org.virtuslab.ash.circe.Register#apply]]
21+
* method.
2222
*
2323
* To check if all needed classes are registered, use Codec Registration Checker.
2424
*
2525
* @see
26-
* [[org.virtuslab.ash.circe.Register]][[org.virtuslab.ash.circe.Register#apply]] for more information about type
27-
* derivation
26+
* [[org.virtuslab.ash.circe.Register]][[org.virtuslab.ash.circe.Register#apply]] for more information about type derivation
2827
*/
2928
val codecs: Seq[Registration[_ <: Ser]]
3029

3130
/**
3231
* A sequence containing information used in type migration.
3332
*
34-
* If you ever change the name of a class that is a direct descendant of `Ser` and is persisted in any way, you must
35-
* append new pair to this field.
33+
* If you ever change the name of a class that is a direct descendant of `Ser` and is persisted in any way, you must append
34+
* new pair to this field.
3635
* - The first element of the pair is a String with the value of old FQCN.
3736
* - The second element of the pair is a Class that had its name changed
3837
*

0 commit comments

Comments
 (0)