Skip to content

Commit

Permalink
Merge pull request #1338 from adpi2/pekko-migration
Browse files Browse the repository at this point in the history
Migrate to Pekko
  • Loading branch information
adpi2 authored Feb 12, 2024
2 parents 24f07a9 + 9300c9f commit cdfaa00
Show file tree
Hide file tree
Showing 43 changed files with 200 additions and 199 deletions.
42 changes: 21 additions & 21 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ lazy val template = project
libraryDependencies ++= Seq(
"com.github.nscala-time" %% "nscala-time" % V.nscalaTime,
"com.typesafe" % "config" % "1.4.3",
"com.typesafe.akka" %% "akka-http-core" % V.akkaHttp,
"org.apache.pekko" %% "pekko-http-core" % V.pekkoHttp,
"org.scalatest" %% "scalatest" % V.scalatest % Test
)
)
Expand All @@ -67,9 +67,9 @@ lazy val infra = project
libraryDependencies ++= Seq(
"com.sksamuel.elastic4s" %% "elastic4s-client-esjava" % V.elastic4s,
"org.flywaydb" % "flyway-core" % "8.5.13", // for database migration
"com.typesafe.akka" %% "akka-stream" % V.akka,
"com.typesafe.akka" %% "akka-http" % V.akkaHttp,
"de.heikoseeberger" %% "akka-http-circe" % "1.39.2",
"org.apache.pekko" %% "pekko-stream" % V.pekko,
"org.apache.pekko" %% "pekko-http" % V.pekkoHttp,
"com.github.pjfanning" %% "pekko-http-circe" % "2.3.4",
"io.get-coursier" %% "coursier" % V.coursier,
"io.get-coursier" %% "coursier-sbt-maven-repository" % V.coursier,
"org.tpolecat" %% "doobie-scalatest" % V.doobie % Test,
Expand Down Expand Up @@ -161,16 +161,16 @@ lazy val server = project
"org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.4",
"com.typesafe.play" %%% "play-json" % V.playJson,
"org.scalatest" %% "scalatest" % V.scalatest % "test,it",
"com.typesafe.akka" %% "akka-testkit" % V.akka % "test,it",
"com.typesafe.akka" %% "akka-slf4j" % V.akka,
"com.typesafe.akka" %% "akka-serialization-jackson" % V.akka,
"com.typesafe.akka" %% "akka-actor-typed" % V.akka,
"com.typesafe.akka" %% "akka-stream-testkit" % V.akka % Test,
"com.typesafe.akka" %% "akka-http-testkit" % V.akkaHttp % Test,
"ch.megard" %% "akka-http-cors" % "1.2.0",
"com.softwaremill.akka-http-session" %% "core" % "0.7.1",
"com.typesafe.akka" %% "akka-http" % V.akkaHttp,
"org.endpoints4s" %% "akka-http-server" % "7.2.0",
"org.apache.pekko" %% "pekko-testkit" % V.pekko % "test,it",
"org.apache.pekko" %% "pekko-slf4j" % V.pekko,
"org.apache.pekko" %% "pekko-serialization-jackson" % V.pekko,
"org.apache.pekko" %% "pekko-actor-typed" % V.pekko,
"org.apache.pekko" %% "pekko-stream-testkit" % V.pekko % Test,
"org.apache.pekko" %% "pekko-http-testkit" % V.pekkoHttp % Test,
"org.apache.pekko" %% "pekko-http-cors" % V.pekkoHttp,
"com.softwaremill.pekko-http-session" %% "core" % "0.7.1",
"org.apache.pekko" %% "pekko-http" % V.pekkoHttp,
"org.endpoints4s" %% "pekko-http-server" % "1.0.1",
"org.webjars" % "bootstrap-sass" % "3.4.1",
"org.webjars" % "bootstrap-switch" % "3.3.4",
"org.webjars" % "bootstrap-select" % "1.13.18",
Expand Down Expand Up @@ -221,14 +221,14 @@ lazy val data = project
loggingSettings,
libraryDependencies ++= Seq(
"com.github.nscala-time" %% "nscala-time" % V.nscalaTime,
"com.typesafe.akka" %% "akka-stream" % V.akka,
"com.typesafe.akka" %% "akka-actor-typed" % V.akka,
"com.typesafe.akka" %% "akka-serialization-jackson" % V.akka,
"com.typesafe.akka" %% "akka-slf4j" % V.akka,
"org.apache.pekko" %% "pekko-stream" % V.pekko,
"org.apache.pekko" %% "pekko-actor-typed" % V.pekko,
"org.apache.pekko" %% "pekko-serialization-jackson" % V.pekko,
"org.apache.pekko" %% "pekko-slf4j" % V.pekko,
"org.apache.maven" % "maven-model-builder" % "3.9.5",
"org.jsoup" % "jsoup" % "1.17.2",
"org.apache.ivy" % "ivy" % "2.5.2",
"com.typesafe.akka" %% "akka-http" % V.akkaHttp,
"org.apache.pekko" %% "pekko-http" % V.pekkoHttp,
"org.json4s" %% "json4s-native" % V.json4s,
"org.scalatest" %% "scalatest" % V.scalatest % Test
),
Expand All @@ -242,8 +242,8 @@ lazy val data = project
lazy val V = new {
val doobie = "0.13.4"
val playJson = "2.9.4"
val akka = "2.6.18"
val akkaHttp = "10.2.10"
val pekko = "1.0.2"
val pekkoHttp = "1.0.1"
val elastic4s = "8.11.5"
val nscalaTime = "2.32.0"
val scalatest = "3.2.17"
Expand Down
2 changes: 1 addition & 1 deletion modules/data/src/main/scala/scaladex/data/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.sys.process.Process

import akka.actor.ActorSystem
import cats.effect._
import com.typesafe.scalalogging.LazyLogging
import doobie.hikari._
import org.apache.pekko.actor.ActorSystem
import scaladex.core.util.ScalaExtensions._
import scaladex.core.util.TimeUtils
import scaladex.data.init.Init
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package scaladex.infra

import akka.actor.ActorSystem
import org.apache.pekko.actor.ActorSystem
import org.scalatest.funspec.AsyncFunSpec
import org.scalatest.matchers.should.Matchers
import scaladex.core.model.Project
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
package scaladex.infra

import scala.annotation.nowarn
import scala.concurrent.ExecutionContextExecutor
import scala.concurrent.Future
import scala.concurrent.Promise
import scala.util.Failure
import scala.util.Success
import scala.util.Try

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.HttpRequest
import akka.http.scaladsl.model.HttpResponse
import akka.stream.OverflowStrategy
import akka.stream.QueueOfferResult
import akka.stream.scaladsl.Flow
import akka.stream.scaladsl.Keep
import akka.stream.scaladsl.Sink
import akka.stream.scaladsl.Source
import akka.stream.scaladsl.SourceQueueWithComplete
import de.heikoseeberger.akkahttpcirce.FailFastCirceSupport
import com.github.pjfanning.pekkohttpcirce.FailFastCirceSupport
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.model.HttpRequest
import org.apache.pekko.http.scaladsl.model.HttpResponse
import org.apache.pekko.stream.OverflowStrategy
import org.apache.pekko.stream.QueueOfferResult
import org.apache.pekko.stream.scaladsl.Flow
import org.apache.pekko.stream.scaladsl.Keep
import org.apache.pekko.stream.scaladsl.Sink
import org.apache.pekko.stream.scaladsl.Source
import org.apache.pekko.stream.scaladsl.SourceQueueWithComplete

abstract class CommonAkkaHttpClient(implicit system: ActorSystem) extends FailFastCirceSupport {

Expand All @@ -30,7 +31,7 @@ abstract class CommonAkkaHttpClient(implicit system: ActorSystem) extends FailFa

val queue: SourceQueueWithComplete[(HttpRequest, Promise[HttpResponse])] =
Source
.queue[(HttpRequest, Promise[HttpResponse])](10000, OverflowStrategy.dropNew)
.queue[(HttpRequest, Promise[HttpResponse])](10000, OverflowStrategy.dropNew: @nowarn)
.via(poolClientFlow)
.toMat(Sink.foreach {
case (Success(resp), p) => p.success(resp)
Expand Down
36 changes: 18 additions & 18 deletions modules/infra/src/main/scala/scaladex/infra/GithubClientImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@ import scala.concurrent.Promise
import scala.concurrent.duration.DurationInt
import scala.util.Try

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.ContentTypes
import akka.http.scaladsl.model.HttpEntity
import akka.http.scaladsl.model.HttpHeader
import akka.http.scaladsl.model.HttpMethods
import akka.http.scaladsl.model.HttpRequest
import akka.http.scaladsl.model.HttpResponse
import akka.http.scaladsl.model.ResponseEntity
import akka.http.scaladsl.model.StatusCodes
import akka.http.scaladsl.model.Uri
import akka.http.scaladsl.model.headers.Authorization
import akka.http.scaladsl.model.headers.OAuth2BearerToken
import akka.http.scaladsl.model.headers.RawHeader
import akka.http.scaladsl.settings.ConnectionPoolSettings
import akka.http.scaladsl.unmarshalling.Unmarshal
import akka.stream.scaladsl.Flow
import akka.util.ByteString
import cats.implicits.toTraverseOps
import com.typesafe.scalalogging.LazyLogging
import io.circe.Json
import io.circe.syntax._
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.model.ContentTypes
import org.apache.pekko.http.scaladsl.model.HttpEntity
import org.apache.pekko.http.scaladsl.model.HttpHeader
import org.apache.pekko.http.scaladsl.model.HttpMethods
import org.apache.pekko.http.scaladsl.model.HttpRequest
import org.apache.pekko.http.scaladsl.model.HttpResponse
import org.apache.pekko.http.scaladsl.model.ResponseEntity
import org.apache.pekko.http.scaladsl.model.StatusCodes
import org.apache.pekko.http.scaladsl.model.Uri
import org.apache.pekko.http.scaladsl.model.headers.Authorization
import org.apache.pekko.http.scaladsl.model.headers.OAuth2BearerToken
import org.apache.pekko.http.scaladsl.model.headers.RawHeader
import org.apache.pekko.http.scaladsl.settings.ConnectionPoolSettings
import org.apache.pekko.http.scaladsl.unmarshalling.Unmarshal
import org.apache.pekko.stream.scaladsl.Flow
import org.apache.pekko.util.ByteString
import scaladex.core.model.GithubCommitActivity
import scaladex.core.model.GithubInfo
import scaladex.core.model.GithubResponse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ import scala.concurrent.Promise
import scala.util.Try
import scala.util.control.NonFatal

import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model
import akka.http.scaladsl.model.HttpRequest
import akka.http.scaladsl.model.HttpResponse
import akka.http.scaladsl.model.StatusCodes
import akka.http.scaladsl.settings.ConnectionPoolSettings
import akka.http.scaladsl.unmarshalling.Unmarshaller
import akka.stream.scaladsl.Flow
import akka.util.ByteString
import com.typesafe.scalalogging.LazyLogging
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.http.scaladsl.model
import org.apache.pekko.http.scaladsl.model.HttpRequest
import org.apache.pekko.http.scaladsl.model.HttpResponse
import org.apache.pekko.http.scaladsl.model.StatusCodes
import org.apache.pekko.http.scaladsl.settings.ConnectionPoolSettings
import org.apache.pekko.http.scaladsl.unmarshalling.Unmarshaller
import org.apache.pekko.stream.scaladsl.Flow
import org.apache.pekko.util.ByteString
import scaladex.core.model.Artifact
import scaladex.core.model.Artifact.MavenReference
import scaladex.core.model.SbtPlugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package scaladex.infra

import java.time.Instant

import akka.actor.ActorSystem
import org.apache.pekko.actor.ActorSystem
import org.scalatest.funspec.AsyncFunSpec
import org.scalatest.matchers.should.Matchers
import scaladex.core.model.Artifact
Expand Down
4 changes: 2 additions & 2 deletions modules/server/src/it/scala/scaladex/RelevanceTest.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package scaladex

import scala.concurrent.Future
import akka.actor.ActorSystem
import akka.testkit.TestKit
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.testkit.TestKit
import org.scalatest.Assertion
import org.scalatest.BeforeAndAfterAll
import org.scalatest.funsuite.AsyncFunSuiteLike
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ package scaladex.server
import scala.collection.concurrent.TrieMap
import scala.concurrent.Future

import akka.actor.ActorSystem
import akka.http.scaladsl._
import akka.http.scaladsl.model.HttpMethods.POST
import akka.http.scaladsl.model.Uri._
import akka.http.scaladsl.model._
import akka.http.scaladsl.model.headers._
import akka.http.scaladsl.unmarshalling.Unmarshal
import com.github.pjfanning.pekkohttpcirce.FailFastCirceSupport
import com.typesafe.scalalogging.LazyLogging
import de.heikoseeberger.akkahttpcirce.FailFastCirceSupport
import io.circe.Json
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.http.scaladsl._
import org.apache.pekko.http.scaladsl.model.HttpMethods.POST
import org.apache.pekko.http.scaladsl.model.Uri._
import org.apache.pekko.http.scaladsl.model._
import org.apache.pekko.http.scaladsl.model.headers._
import org.apache.pekko.http.scaladsl.unmarshalling.Unmarshal
import scaladex.core.model.GithubResponse
import scaladex.core.model.UserInfo
import scaladex.core.model.UserState
Expand Down
10 changes: 5 additions & 5 deletions modules/server/src/main/scala/scaladex/server/Server.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import scala.util.Failure
import scala.util.Success
import scala.util.control.NonFatal

import akka.actor.ActorSystem
import akka.http.scaladsl._
import akka.http.scaladsl.model.StatusCodes
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server._
import cats.effect.ContextShift
import cats.effect.IO
import com.typesafe.scalalogging.LazyLogging
import doobie.util.ExecutionContexts
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.http.scaladsl._
import org.apache.pekko.http.scaladsl.model.StatusCodes
import org.apache.pekko.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.server._
import scaladex.core.service.WebDatabase
import scaladex.data.util.PidLock
import scaladex.infra.DataPaths
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package scaladex.server

// https://github.com/btomala/akka-http-twirl

import akka.http.scaladsl.marshalling.Marshaller
import akka.http.scaladsl.marshalling.ToEntityMarshaller
import akka.http.scaladsl.model.MediaType
import akka.http.scaladsl.model.MediaTypes._
import org.apache.pekko.http.scaladsl.marshalling.Marshaller
import org.apache.pekko.http.scaladsl.marshalling.ToEntityMarshaller
import org.apache.pekko.http.scaladsl.model.MediaType
import org.apache.pekko.http.scaladsl.model.MediaTypes._
import play.twirl.api.Html
import play.twirl.api.Txt
import play.twirl.api.Xml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package scaladex.server.config

import com.softwaremill.session.SessionConfig
import com.softwaremill.pekkohttpsession.SessionConfig
import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
import scaladex.core.model.Env
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package scaladex.server.route
import akka.http.scaladsl.model.StatusCodes
import akka.http.scaladsl.model.Uri
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server.Route
import org.apache.pekko.http.scaladsl.model.StatusCodes
import org.apache.pekko.http.scaladsl.model.Uri
import org.apache.pekko.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.server.Route
import scaladex.core.model.Artifact
import scaladex.core.model.Env
import scaladex.core.model.Project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package scaladex.server.route
import scala.concurrent.ExecutionContext
import scala.util.Success

import akka.http.scaladsl.model.StatusCodes
import akka.http.scaladsl.model._
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server.Route
import com.typesafe.scalalogging.LazyLogging
import org.apache.pekko.http.scaladsl.model.StatusCodes
import org.apache.pekko.http.scaladsl.model._
import org.apache.pekko.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.server.Route
import scaladex.core.model.Env
import scaladex.core.model.UserState
import scaladex.core.service.WebDatabase
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package scaladex.server.route

import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server.Route
import org.apache.pekko.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.server.Route

object Assets {
val routes: Route =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ import java.util.UUID
import scala.util.Success
import scala.util.Try

import akka.actor.ActorSystem
import akka.http.scaladsl.model.StatusCodes.TemporaryRedirect
import akka.http.scaladsl.model.Uri.Query
import akka.http.scaladsl.model._
import akka.http.scaladsl.model.headers.Referer
import akka.http.scaladsl.server.Directive1
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server.Route
import com.softwaremill.session.CsrfDirectives._
import com.softwaremill.session.CsrfOptions._
import com.softwaremill.session.SessionConfig
import com.softwaremill.session.SessionDirectives._
import com.softwaremill.session.SessionManager
import com.softwaremill.session.SessionOptions._
import com.softwaremill.session.SessionSerializer
import com.softwaremill.session.SingleValueSessionSerializer
import com.softwaremill.session.javadsl.InMemoryRefreshTokenStorage
import com.softwaremill.pekkohttpsession.CsrfDirectives._
import com.softwaremill.pekkohttpsession.CsrfOptions._
import com.softwaremill.pekkohttpsession.SessionConfig
import com.softwaremill.pekkohttpsession.SessionDirectives._
import com.softwaremill.pekkohttpsession.SessionManager
import com.softwaremill.pekkohttpsession.SessionOptions._
import com.softwaremill.pekkohttpsession.SessionSerializer
import com.softwaremill.pekkohttpsession.SingleValueSessionSerializer
import com.softwaremill.pekkohttpsession.javadsl.InMemoryRefreshTokenStorage
import com.typesafe.scalalogging.LazyLogging
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.http.scaladsl.model.StatusCodes.TemporaryRedirect
import org.apache.pekko.http.scaladsl.model.Uri.Query
import org.apache.pekko.http.scaladsl.model._
import org.apache.pekko.http.scaladsl.model.headers.Referer
import org.apache.pekko.http.scaladsl.server.Directive1
import org.apache.pekko.http.scaladsl.server.Directives._
import org.apache.pekko.http.scaladsl.server.Route
import scaladex.core.model.UserState
import scaladex.core.service.GithubAuth
import scaladex.core.service.WebDatabase
Expand Down
Loading

0 comments on commit cdfaa00

Please sign in to comment.