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

Bye Scala Meta #71

Closed
wants to merge 7 commits into from
Closed
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
38 changes: 17 additions & 21 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import ReleaseTransformations._
import sbtrelease.Version.Bump
import pl.project13.scala.sbt._

lazy val buildSettings = inThisBuild(
Seq(
Expand All @@ -9,53 +8,49 @@ lazy val buildSettings = inThisBuild(
)
)

lazy val akkaVersion = "2.5.18"

lazy val akkaVersion = "2.5.22"
lazy val akkaPersistenceCassandraVersion = "0.61"

lazy val catsVersion = "1.4.0"
lazy val catsEffectVersion = "1.0.0"
lazy val catsVersion = "1.6.0"
lazy val catsEffectVersion = "1.3.0"
lazy val scodecVersion = "1.10.4"
lazy val logbackVersion = "1.2.3"
lazy val cassandraDriverExtrasVersion = "3.1.0"
lazy val jsr305Version = "3.0.1"
lazy val boopickleVersion = "1.3.0"
lazy val monocleVersion = "1.5.1-cats"
lazy val fs2Version = "1.0.4"
lazy val log4catsVersion = "0.2.0-M1"
lazy val scodecBitsVersion = "1.1.10"
lazy val scodecCoreVersion = "1.10.3"
lazy val catsTaglessVersion = "0.6"

lazy val scalaCheckVersion = "1.13.4"
lazy val scalaTestVersion = "3.0.5"
lazy val scalaCheckShapelessVersion = "1.1.8"
lazy val shapelessVersion = "2.3.3"
lazy val kindProjectorVersion = "0.9.9"
lazy val betterMonadicForVersion = "0.3.0-M4"
lazy val scalametaVersion = "1.8.0"
lazy val kindProjectorVersion = "0.10.0"
lazy val betterMonadicForVersion = "0.3.0"

// Example dependencies

lazy val circeVersion = "0.10.1"
lazy val http4sVersion = "0.20.0-M3"
lazy val scalametaParadiseVersion = "3.0.0-M11"

lazy val log4catsVersion = "0.3.0"
lazy val catsMTLVersion = "0.4.0"
lazy val catsTaglessVersion = "0.2.0"

lazy val commonSettings = Seq(
resolvers += "jitpack" at "https://jitpack.io",
scalacOptions ++= commonScalacOptions,
addCompilerPlugin("org.spire-math" %% "kind-projector" % kindProjectorVersion),
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(
scalacOptions += "-Xplugin-require:macroparadise",
addCompilerPlugin(
"org.scalameta" % "paradise" % scalametaParadiseVersion cross CrossVersion.full
),
sources in (Compile, doc) := Nil // macroparadise doesn't work with scaladoc yet.
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
)

lazy val aecorSettings = buildSettings ++ commonSettings ++ publishSettings
Expand Down Expand Up @@ -150,15 +145,16 @@ lazy val coreSettings = Seq(
"com.chuusai" %% "shapeless" % shapelessVersion,
"org.typelevel" %% "cats-core" % catsVersion,
"org.typelevel" %% "cats-effect" % catsEffectVersion,
"org.scodec" %% "scodec-bits" % "1.1.6",
"org.scodec" %% "scodec-core" % "1.10.3"
"org.scodec" %% "scodec-bits" % scodecBitsVersion,
"org.scodec" %% "scodec-core" % scodecCoreVersion
)
)

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

Expand Down Expand Up @@ -187,7 +183,7 @@ lazy val akkaPersistenceSettings = commonProtobufSettings ++ Seq(
lazy val akkaGenericSettings = commonProtobufSettings ++ Seq(
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-cluster-sharding" % akkaVersion,
"org.typelevel" %% "cats-tagless-macros" % catsTaglessVersion
"org.typelevel" %% "cats-tagless-macros" % catsTaglessVersion % Test
)
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
package aecor.runtime.akkageneric

import aecor.encoding.{KeyDecoder, KeyEncoder}
import aecor.macros.boopickleWireProtocol
import boopickle.Default._
import aecor.encoding.{ KeyDecoder, KeyEncoder, WireProtocol }
import aecor.macros.boopickle.BoopickleWireProtocol
import cats.effect.Sync
import cats.effect.concurrent.Ref
import cats.implicits._
import cats.tagless.autoFunctorK
import cats.tagless.FunctorK

@autoFunctorK(false)
@boopickleWireProtocol
trait Counter[F[_]] {
def increment: F[Long]
def decrement: F[Long]
def value: F[Long]
}

object Counter {

def inmem[F[_]: Sync]: F[Counter[F]] =
Ref[F].of(0L).map { ref =>
new Counter[F] {
override def increment: F[Long] = ref.update(_ + 1L) >> value
override def decrement: F[Long] = ref.update(_ - 1L) >> value
override def value: F[Long] = ref.get
Ref[F]
.of(0L)
.map { ref =>
new Counter[F] {
override def increment: F[Long] = ref.update(_ + 1L) >> value
override def decrement: F[Long] = ref.update(_ - 1L) >> value
override def value: F[Long] = ref.get
}
}
}

import boopickle.Default._

implicit def wireProtocol: WireProtocol[Counter] = BoopickleWireProtocol.derive
implicit def functorK: FunctorK[Counter] = cats.tagless.Derive.functorK
}

final case class CounterId(value: String) extends AnyVal
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package aecor.macros.boopickle
import aecor.encoding.WireProtocol

object BoopickleWireProtocol {
def derive[M[_[_]]]: WireProtocol[M] = macro DeriveMacros.derive[M]
}
Loading