Skip to content
Permalink
Browse files

Publish for Scala 2.13 (#79)

  • Loading branch information...
notxcain committed Jul 17, 2019
1 parent 6c11698 commit 593343bd20780467d8e2e12c9ca1c614a9cfe2c2
Showing with 255 additions and 243 deletions.
  1. +1 −0 .travis.yml
  2. +84 −108 build.sbt
  3. +1 −1 modules/akka-cluster-runtime/src/main/scala/aecor/runtime/akkageneric/GenericAkkaRuntime.scala
  4. +1 −1 ...ka-cluster-runtime/src/main/scala/aecor/runtime/akkageneric/serialization/MessageSerializer.scala
  5. +6 −5 modules/akka-cluster-runtime/src/test/scala/aecor/runtime/akkageneric/GenericRuntimeSpec.scala
  6. +4 −3 modules/akka-cluster-runtime/src/test/scala/aecor/runtime/akkageneric/MessageSerializerTest.scala
  7. +5 −5 ...kka-persistence-runtime/src/main/scala/aecor/runtime/akkapersistence/AkkaPersistenceRuntime.scala
  8. +2 −1 ...ersistence-runtime/src/main/scala/aecor/runtime/akkapersistence/AkkaPersistenceRuntimeActor.scala
  9. +0 −1 ...time/src/main/scala/aecor/runtime/akkapersistence/readside/AkkaPersistenceEventJournalQuery.scala
  10. +2 −2 ...stence-runtime/src/main/scala/aecor/runtime/akkapersistence/serialization/MessageSerializer.scala
  11. +1 −1 modules/core/src/main/scala/aecor/data/Fold.scala
  12. +8 −8 modules/core/src/main/scala/aecor/util/effect.scala
  13. +2 −2 modules/distributed-processing/src/main/scala/aecor/distributedprocessing/AkkaStreamProcess.scala
  14. +3 −2 modules/example/src/main/scala/aecor/example/App.scala
  15. +1 −1 modules/example/src/main/scala/aecor/example/ScheduleApp.scala
  16. +2 −3 modules/example/src/main/scala/aecor/example/account/AccountEvent.scala
  17. +3 −2 modules/example/src/main/scala/aecor/example/account/deployment.scala
  18. +21 −0 modules/example/src/main/scala/aecor/example/common/Fs2AkkaStreamInterop.scala
  19. +0 −1 modules/example/src/main/scala/aecor/example/persistentEncoderUtil.scala
  20. +3 −3 modules/example/src/main/scala/aecor/example/transaction/TransactionEvent.scala
  21. +3 −3 modules/example/src/main/scala/aecor/example/transaction/deployment.scala
  22. +2 −3 ...→ kafka-distributed-processing}/src/test/scala/aecor/kafkadistributedprocessing/ChannelTest.scala
  23. +9 −0 modules/kafka-distributed-processing/src/test/scala/aecor/kafkadistributedprocessing/IOSupport.scala
  24. +5 −7 ...-processing}/src/test/scala/aecor/kafkadistributedprocessing/KafkaDistributedProcessingTest.scala
  25. 0 ... kafka-distributed-processing}/src/test/scala/aecor/kafkadistributedprocessing/KafkaSupport.scala
  26. +3 −4 ...s → kafka-distributed-processing}/src/test/scala/aecor/kafkadistributedprocessing/KafkaTest.scala
  27. +4 −4 modules/schedule/src/main/scala/aecor/schedule/CassandraScheduleEntryRepository.scala
  28. +2 −2 modules/schedule/src/main/scala/aecor/schedule/DefaultScheduleBucket.scala
  29. +2 −2 modules/schedule/src/main/scala/aecor/schedule/Schedule.scala
  30. +1 −1 modules/schedule/src/main/scala/aecor/schedule/process/DefaultScheduleEventJournal.scala
  31. +7 −5 modules/schedule/src/main/scala/aecor/schedule/process/PeriodicProcessRuntime.scala
  32. +5 −1 modules/test-kit/src/main/scala/aecor/testkit/StateEventJournal.scala
  33. +0 −1 modules/tests/src/main/scala/aecor/tests/PersistentEncoderCirce.scala
  34. +7 −5 modules/tests/src/main/scala/aecor/tests/e2e/Counter.scala
  35. +3 −3 modules/tests/src/test/scala/aecor/tests/ActionTSpec.scala
  36. +9 −7 modules/tests/src/test/scala/aecor/tests/AkkaPersistenceRuntimeSpec.scala
  37. +3 −2 modules/tests/src/test/scala/aecor/tests/BoopickleWireProtocolTest.scala
  38. +3 −2 modules/tests/src/test/scala/aecor/tests/ComposerSpec.scala
  39. +3 −2 modules/tests/src/test/scala/aecor/tests/EndToEndTest.scala
  40. +3 −2 modules/tests/src/test/scala/aecor/tests/EventsourcedBehaviorSpec.scala
  41. +3 −2 modules/tests/src/test/scala/aecor/tests/ScheduleBucketSpec.scala
  42. +14 −19 modules/tests/src/test/scala/aecor/tests/ScheduleEventCodecSpec.scala
  43. +11 −14 modules/tests/src/test/scala/aecor/tests/TaggingTest.scala
  44. +2 −2 modules/tests/src/test/scala/aecor/tests/TestActorSystem.scala
  45. +1 −0 project/plugins.sbt
@@ -1,6 +1,7 @@
language: scala
scala:
- 2.12.8
- 2.13.0

jdk:
- openjdk8
192 build.sbt
@@ -4,57 +4,68 @@ import sbtrelease.Version.Bump
lazy val buildSettings = inThisBuild(
Seq(
organization := "io.aecor",
scalaVersion := "2.12.8"
crossScalaVersions := Seq("2.13.0", "2.12.8")
)
)

lazy val akkaVersion = "2.5.23"
lazy val akkaPersistenceCassandraVersion = "0.62"


lazy val apacheKafkaClientsVersion = "2.1.1"
lazy val catsVersion = "1.6.1"
lazy val catsEffectVersion = "1.3.1"
lazy val catsVersion = "2.0.0-M4"
lazy val catsEffectVersion = "2.0.0-M4"

lazy val logbackVersion = "1.2.3"
lazy val cassandraDriverExtrasVersion = "3.7.2"
lazy val jsr305Version = "3.0.2"
lazy val boopickleVersion = "1.3.1"
lazy val monocleVersion = "1.6.0-RC1"

lazy val fs2Version = "1.0.5"
lazy val fs2Version = "1.1.0-M1"
lazy val scodecBitsVersion = "1.1.12"
lazy val scodecCoreVersion = "1.11.4"

lazy val catsTaglessVersion = "0.9"

lazy val scalaCheckVersion = "1.13.5"
lazy val scalaTestVersion = "3.0.5"
lazy val scalaCheckShapelessVersion = "1.1.8"
lazy val scalaCheckVersion = "1.14.0"
lazy val scalaTestVersion = "3.0.8"
lazy val scalaCheckShapelessVersion = "1.2.3"
lazy val embeddedKafkaVersion = "2.3.0"
lazy val shapelessVersion = "2.3.3"
lazy val kindProjectorVersion = "0.10.3"
lazy val betterMonadicForVersion = "0.3.0"

// Example dependencies

lazy val circeVersion = "0.11.1"
lazy val http4sVersion = "0.20.6"
lazy val circeVersion = "0.12.0-M4"
lazy val http4sVersion = "0.21.0-M2"
lazy val log4catsVersion = "0.3.0"
lazy val catsMTLVersion = "0.5.0"
lazy val catsMTLVersion = "0.6.0"

lazy val commonSettings = Seq(
scalacOptions ++= commonScalacOptions,
scalacOptions += "-Xsource:2.13",
addCompilerPlugin("org.typelevel" %% "kind-projector" % kindProjectorVersion),
addCompilerPlugin("com.olegpy" %% "better-monadic-for" % betterMonadicForVersion),
parallelExecution in Test := false,
scalacOptions in (Compile, doc) := (scalacOptions in (Compile, doc)).value
.filter(_ != "-Xfatal-warnings"),
) ++ warnUnusedImport

lazy val macroSettings = Seq(
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full)
)

lazy val macroSettings =
Seq(
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
// if scala 2.13+ is used, quasiquotes are merged into scala-reflect
case Some((2, scalaMajor)) if scalaMajor >= 13 => Seq()
// otherwise, quasiquotes are provided by macro paradise
case _ =>
Seq(compilerPlugin("org.scalamacros" %% "paradise" % "2.1.0" cross CrossVersion.full))
}
},
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value % Provided,
"org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided
)
)

lazy val aecorSettings = buildSettings ++ commonSettings ++ publishSettings

lazy val aecor = project
@@ -69,7 +80,6 @@ lazy val aecor = project
akkaPersistence,
akkaGeneric,
distributedProcessing,
kafkaDistributedProcessing,
example,
schedule,
testKit,
@@ -96,32 +106,38 @@ lazy val akkaPersistence = aecorModule(
"Aecor Runtime based on Akka Cluster Sharding and Persistence"
).dependsOn(core)
.settings(aecorSettings)
.settings(commonProtobufSettings)
.settings(akkaPersistenceSettings)

lazy val akkaGeneric =
aecorModule("akka-cluster-runtime", "Aecor Runtime based on Akka Cluster Sharding")
.dependsOn(core)
.dependsOn(boopickleWireProtocol % "test->compile")
.settings(aecorSettings)
.settings(macroSettings)
.settings(commonTestSettings)
.settings(commonProtobufSettings)
.settings(akkaGenericSettings)

lazy val distributedProcessing =
aecorModule("distributed-processing", "Aecor Distributed Processing")
.dependsOn(core)
.settings(aecorSettings)
.settings(commonProtobufSettings)
.settings(distributedProcessingSettings)

lazy val kafkaDistributedProcessing =
aecorModule("kafka-distributed-processing", "Aecor Distributed Processing based on Kafka partition assignment")
.dependsOn(core)
aecorModule(
"kafka-distributed-processing",
"Aecor Distributed Processing based on Kafka partition assignment"
).dependsOn(core)
.settings(aecorSettings)
.settings(commonTestSettings)
.settings(kafkaDistributedProcessingSettings)

lazy val schedule = aecorModule("schedule", "Aecor Schedule")
.dependsOn(akkaPersistence, distributedProcessing, boopickleWireProtocol)
.settings(aecorSettings)
.settings(commonProtobufSettings)
.settings(scheduleSettings)

lazy val testKit = aecorModule("test-kit", "Aecor Test Kit")
@@ -130,13 +146,14 @@ lazy val testKit = aecorModule("test-kit", "Aecor Test Kit")
.settings(testKitSettings)

lazy val tests = aecorModule("tests", "Aecor Tests")
.dependsOn(core, schedule, testKit, akkaPersistence, distributedProcessing, kafkaDistributedProcessing, boopickleWireProtocol)
.dependsOn(core, schedule, testKit, akkaPersistence, distributedProcessing, boopickleWireProtocol)
.settings(aecorSettings)
.settings(noPublishSettings)
.settings(testingSettings)
.settings(commonTestSettings)
.settings(testsSettings)

lazy val example = aecorModule("example", "Aecor Example Application")
.dependsOn(core, schedule, distributedProcessing, kafkaDistributedProcessing, boopickleWireProtocol)
.dependsOn(core, schedule, distributedProcessing, boopickleWireProtocol)
.settings(aecorSettings)
.settings(noPublishSettings)
.settings(exampleSettings)
@@ -159,71 +176,67 @@ lazy val coreSettings = Seq(
)
)

lazy val boopickleWireProtocolSettings = Seq(
libraryDependencies ++= Seq(
"io.suzaku" %% "boopickle" % boopickleVersion,
"org.scala-lang" % "scala-compiler" % scalaVersion.value % "provided",
"org.scala-lang" % "scala-reflect" % scalaVersion.value % "provided"
)
) ++ macroSettings
lazy val boopickleWireProtocolSettings = macroSettings ++ Seq(
libraryDependencies ++= Seq("io.suzaku" %% "boopickle" % boopickleVersion)
)

lazy val scheduleSettings = commonProtobufSettings ++ Seq(
lazy val scheduleSettings = Seq(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-tagless-macros" % catsTaglessVersion,
"com.datastax.cassandra" % "cassandra-driver-extras" % cassandraDriverExtrasVersion,
"com.google.code.findbugs" % "jsr305" % jsr305Version % Compile
)
) ++ macroSettings
)

lazy val distributedProcessingSettings = commonProtobufSettings ++ Seq(
lazy val distributedProcessingSettings = Seq(
libraryDependencies ++= Seq("com.typesafe.akka" %% "akka-cluster-sharding" % akkaVersion)
)

lazy val kafkaDistributedProcessingSettings = commonProtobufSettings ++ Seq(
lazy val kafkaDistributedProcessingSettings = Seq(
libraryDependencies ++= Seq(
"org.apache.kafka" % "kafka-clients" % apacheKafkaClientsVersion,
"co.fs2" %% "fs2-core" % fs2Version,
"co.fs2" %% "fs2-reactive-streams" % fs2Version
"co.fs2" %% "fs2-reactive-streams" % fs2Version,
"org.scalatest" %% "scalatest" % scalaTestVersion % Test,
"io.github.embeddedkafka" %% "embedded-kafka" % embeddedKafkaVersion % Test
)
)

lazy val akkaPersistenceSettings = commonProtobufSettings ++ Seq(
lazy val akkaPersistenceSettings = Seq(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-tagless-macros" % catsTaglessVersion,
"com.typesafe.akka" %% "akka-cluster-sharding" % akkaVersion,
"com.typesafe.akka" %% "akka-persistence" % akkaVersion,
"com.typesafe.akka" %% "akka-persistence-query" % akkaVersion,
"com.typesafe.akka" %% "akka-persistence-cassandra" % akkaPersistenceCassandraVersion
"com.typesafe.akka" %% "akka-persistence-cassandra" % akkaPersistenceCassandraVersion,
)
)

lazy val akkaGenericSettings = commonProtobufSettings ++ Seq(
lazy val akkaGenericSettings = Seq(
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-cluster-sharding" % akkaVersion,
"org.typelevel" %% "cats-tagless-macros" % catsTaglessVersion % Test
"org.typelevel" %% "cats-tagless-macros" % catsTaglessVersion % Test,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-persistence-cassandra-launcher" % akkaPersistenceCassandraVersion % Test
)
)

lazy val exampleSettings =
Seq(
resolvers += Resolver.sonatypeRepo("releases"),
resolvers += "krasserm at bintray" at "http://dl.bintray.com/krasserm/maven",
libraryDependencies ++=
Seq(
"org.typelevel" %% "cats-tagless-macros" % catsTaglessVersion,
"com.github.krasserm" %% "streamz-converter" % "0.10-M2",
"org.typelevel" %% "cats-mtl-core" % catsMTLVersion,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"org.http4s" %% "http4s-dsl" % http4sVersion,
"org.http4s" %% "http4s-blaze-server" % http4sVersion,
"org.http4s" %% "http4s-circe" % http4sVersion,
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"io.circe" %% "circe-java8" % circeVersion,
"ch.qos.logback" % "logback-classic" % logbackVersion
)
) ++ macroSettings
lazy val exampleSettings = Seq(
libraryDependencies ++=
Seq(
"org.typelevel" %% "cats-tagless-macros" % catsTaglessVersion,
"co.fs2" %% "fs2-reactive-streams" % fs2Version,
"org.typelevel" %% "cats-mtl-core" % catsMTLVersion,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"org.http4s" %% "http4s-dsl" % http4sVersion,
"org.http4s" %% "http4s-blaze-server" % http4sVersion,
"org.http4s" %% "http4s-circe" % http4sVersion,
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"ch.qos.logback" % "logback-classic" % logbackVersion
)
)

lazy val testKitSettings = Seq(
libraryDependencies ++= Seq(
@@ -233,65 +246,28 @@ lazy val testKitSettings = Seq(
)
)

lazy val testingSettings = Seq(
lazy val testsSettings = Seq(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-tagless-macros" % catsTaglessVersion,
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion,
"io.circe" %% "circe-java8" % circeVersion,
"org.scalacheck" %% "scalacheck" % scalaCheckVersion % Test,
"org.scalatest" %% "scalatest" % scalaTestVersion % Test,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-persistence-cassandra-launcher" % akkaPersistenceCassandraVersion % Test,
"com.github.alexarchambault" %% "scalacheck-shapeless_1.13" % scalaCheckShapelessVersion % Test,
"org.typelevel" %% "cats-testkit" % catsVersion % Test,
"io.github.embeddedkafka" %% "embedded-kafka" % "2.2.0" % Test
)
) ++ macroSettings

lazy val commonTestSettings =
Seq(
libraryDependencies ++= Seq(
"org.scalacheck" %% "scalacheck" % scalaCheckVersion % Test,
"org.scalatest" %% "scalatest" % scalaTestVersion % Test,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-persistence-cassandra-launcher" % akkaPersistenceCassandraVersion % Test,
"com.github.alexarchambault" %% "scalacheck-shapeless_1.13" % scalaCheckShapelessVersion % Test,
"org.typelevel" %% "cats-testkit" % catsVersion % Test
)
)
)

lazy val commonProtobufSettings =
Seq(
PB.targets in Compile := Seq(
scalapb.gen(flatPackage = true) -> (sourceManaged in Compile).value
)
lazy val commonTestSettings = Seq(
libraryDependencies ++= Seq(
"org.scalacheck" %% "scalacheck" % scalaCheckVersion % Test,
"org.scalatest" %% "scalatest" % scalaTestVersion % Test,
"com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % scalaCheckShapelessVersion % Test,
"org.typelevel" %% "cats-testkit" % catsVersion % Test
)

lazy val commonScalacOptions = Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-language:implicitConversions",
"-language:experimental.macros",
"-unchecked",
"-Xfatal-warnings",
"-Xlint",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Ywarn-unused-import",
"-Ypartial-unification",
"-Xsource:2.13"
)

lazy val warnUnusedImport = Seq(
scalacOptions in (Compile, console) --= Seq("-Ywarn-unused:imports", "-Xfatal-warnings")
lazy val commonProtobufSettings = Seq(
PB.targets in Compile := Seq(scalapb.gen(flatPackage = true) -> (sourceManaged in Compile).value)
)

lazy val noPublishSettings = Seq(publish := (()), publishLocal := (()), publishArtifact := false)
@@ -12,9 +12,9 @@ import akka.cluster.sharding.{ ClusterSharding, ShardRegion }
import akka.pattern._
import akka.util.Timeout
import cats.effect.Effect
import cats.tagless.syntax.functorK._
import cats.implicits._
import cats.tagless.FunctorK
import cats.tagless.syntax.functorK._
import cats.~>
import scodec.bits.BitVector

@@ -18,7 +18,7 @@ class MessageSerializer(val system: ExtendedActorSystem)
val CommandResultManifest = "C"

private val fromBinaryMap =
HashMap[String, Array[Byte] AnyRef](
HashMap[String, Array[Byte] => AnyRef](
KeyedCommandManifest -> keyedCommandFromBinary,
CommandManifest -> commandFromBinary,
CommandResultManifest -> commandResultFromBinary
@@ -4,9 +4,10 @@ import akka.actor.ActorSystem
import akka.testkit.TestKit
import cats.effect.IO
import cats.implicits._
import com.typesafe.config.{Config, ConfigFactory}
import com.typesafe.config.{ Config, ConfigFactory }
import org.scalatest.concurrent.ScalaFutures
import org.scalatest.{BeforeAndAfterAll, FunSuiteLike, Matchers}
import org.scalatest.funsuite.AnyFunSuiteLike
import org.scalatest.{ BeforeAndAfterAll, Matchers }

import scala.concurrent.duration._

@@ -20,7 +21,7 @@ object GenericRuntimeSpec {

class GenericRuntimeSpec
extends TestKit(ActorSystem("test", GenericRuntimeSpec.conf))
with FunSuiteLike
with AnyFunSuiteLike
with Matchers
with ScalaFutures
with BeforeAndAfterAll {
@@ -34,9 +35,9 @@ class GenericRuntimeSpec
override def afterAll: Unit =
TestKit.shutdownActorSystem(system)


def runCounters(name: String): IO[CounterId => Counter[IO]] =
GenericAkkaRuntime(system).runBehavior[CounterId, Counter, IO](name, (_: CounterId) => Counter.inmem[IO])
GenericAkkaRuntime(system)
.runBehavior[CounterId, Counter, IO](name, (_: CounterId) => Counter.inmem[IO])

test("routing") {
val program = for {

0 comments on commit 593343b

Please sign in to comment.
You can’t perform that action at this time.