Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish for Scala 2.13 #79

Merged
merged 12 commits into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: scala
scala:
- 2.12.8
- 2.13.0

jdk:
- openjdk8
Expand Down
192 changes: 84 additions & 108 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -69,7 +80,6 @@ lazy val aecor = project
akkaPersistence,
akkaGeneric,
distributedProcessing,
kafkaDistributedProcessing,
example,
schedule,
testKit,
Expand All @@ -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")
Expand All @@ -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)
Expand All @@ -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(
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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._

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

class GenericRuntimeSpec
extends TestKit(ActorSystem("test", GenericRuntimeSpec.conf))
with FunSuiteLike
with AnyFunSuiteLike
with Matchers
with ScalaFutures
with BeforeAndAfterAll {
Expand All @@ -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 {
Expand Down
Loading