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

Remove akka typed dependency + reorganize dependencies #5196

Merged
merged 1 commit into from
Oct 22, 2024
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
73 changes: 19 additions & 54 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ val akkaHttpCirceVersion = "1.39.2"
val akkaCorsVersion = "1.2.0"
val akkaVersion = "2.6.21"
val alpakkaVersion = "3.0.4"
val awsSdkVersion = "2.28.21"
val awsSdkVersion = "2.28.27"
val betterMonadicForVersion = "0.3.1"
val caffeineVersion = "3.1.8"
val catsEffectVersion = "3.5.4"
Expand All @@ -44,7 +44,7 @@ val kamonVersion = "2.7.5"
val kanelaAgentVersion = "1.0.18"
val kindProjectorVersion = "0.13.3"
val log4catsVersion = "2.7.0"
val logbackVersion = "1.5.10"
val logbackVersion = "1.5.11"
val magnoliaVersion = "1.1.10"
val munitVersion = "1.0.2"
val munitCatsEffectVersion = "2.0.0"
Expand All @@ -57,8 +57,6 @@ val topBraidVersion = "1.4.3"
val testContainersVersion = "1.20.2"
val testContainersScalaVersion = "0.41.4"

lazy val akkaActorTyped = "com.typesafe.akka" %% "akka-actor-typed" % akkaVersion

lazy val akkaHttp = "com.typesafe.akka" %% "akka-http" % akkaHttpVersion
lazy val akkaHttpCore = "com.typesafe.akka" %% "akka-http-core" % akkaHttpVersion
lazy val akkaHttpCirce = "de.heikoseeberger" %% "akka-http-circe" % akkaHttpCirceVersion
Expand All @@ -69,7 +67,6 @@ lazy val akkaHttpXml = "com.typesafe.akka" %% "akka-http-xml" % akkaHttp
lazy val akkaSlf4j = "com.typesafe.akka" %% "akka-slf4j" % akkaVersion
lazy val akkaStream = "com.typesafe.akka" %% "akka-stream" % akkaVersion
lazy val akkaTestKit = "com.typesafe.akka" %% "akka-testkit" % akkaVersion
lazy val akkaTestKitTyped = "com.typesafe.akka" %% "akka-actor-testkit-typed" % akkaVersion
lazy val alpakkaFile = "com.lightbend.akka" %% "akka-stream-alpakka-file" % alpakkaVersion
lazy val alpakkaSse = "com.lightbend.akka" %% "akka-stream-alpakka-sse" % alpakkaVersion
lazy val awsSdk = "software.amazon.awssdk" % "s3" % awsSdkVersion
Expand Down Expand Up @@ -204,7 +201,7 @@ lazy val kernel = project
.settings(shared, compilation, coverage, release, assertJavaVersion)
.settings(
libraryDependencies ++= Seq(
akkaActorTyped, // Needed to create content type
akkaStream, // Needed to create content type
akkaHttpCore,
caffeine,
catsCore,
Expand Down Expand Up @@ -237,9 +234,6 @@ lazy val testkit = project
.settings(
coverageMinimumStmtTotal := 0,
libraryDependencies ++= Seq(
akkaActorTyped, // Needed to create Uri
akkaHttpCore,
akkaStream,
alpakkaFile excludeAll (
ExclusionRule(organization = "com.typesafe.akka", name = "akka-stream_2.13")
),
Expand Down Expand Up @@ -291,8 +285,6 @@ lazy val rdf = project
)
.settings(
libraryDependencies ++= Seq(
akkaActorTyped, // Needed to create Uri
akkaHttpCore,
catsCore,
circeParser,
circeGeneric,
Expand All @@ -302,10 +294,7 @@ lazy val rdf = project
magnolia,
scalaReflect,
topBraidShacl,
akkaSlf4j % Test,
akkaTestKit % Test,
logback % Test,
scalaTest % Test
logback % Test
),
Test / fork := true,
addCompilerPlugin(betterMonadicFor)
Expand All @@ -322,18 +311,14 @@ lazy val sdk = project
.settings(
coverageFailOnMinimum := false,
libraryDependencies ++= Seq(
akkaStream,
akkaHttp,
akkaHttpXml exclude ("org.scala-lang.modules", "scala-xml_2.13"),
scalaXml,
circeLiteral,
circeGenericExtras,
distageCore,
akkaTestKitTyped % Test,
akkaHttpTestKit % Test,
munit % Test,
munitCatsEffect % Test,
scalaTest % Test
akkaSlf4j % Test,
akkaTestKit % Test,
akkaHttpTestKit % Test
),
addCompilerPlugin(kindProjector),
addCompilerPlugin(betterMonadicFor)
Expand All @@ -354,9 +339,7 @@ lazy val app = project
akkaHttpCors,
akkaSlf4j,
classgraph,
logback,
akkaHttpTestKit % Test,
scalaTest % Test
logback
),
addCompilerPlugin(betterMonadicFor),
run / fork := true,
Expand Down Expand Up @@ -451,11 +434,8 @@ lazy val elasticsearchPlugin = project
assembly / assemblyJarName := "elasticsearch.jar",
assembly / assemblyOption := (assembly / assemblyOption).value.withIncludeScala(false),
libraryDependencies ++= Seq(
kamonAkkaHttp % Provided,
akkaTestKitTyped % Test,
akkaSlf4j % Test,
logback % Test,
scalaTest % Test
kamonAkkaHttp % Provided,
logback % Test
),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch",
Expand All @@ -478,9 +458,7 @@ lazy val blazegraphPlugin = project
moduleName := "delta-blazegraph-plugin",
libraryDependencies ++= Seq(
kamonAkkaHttp % Provided,
akkaSlf4j % Test,
logback % Test,
scalaTest % Test
logback % Test
),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.delta.plugins.blazegraph",
Expand Down Expand Up @@ -510,9 +488,7 @@ lazy val compositeViewsPlugin = project
ExclusionRule(organization = "com.typesafe.akka", name = "akka-http_2.13")
),
kamonAkkaHttp % Provided,
akkaSlf4j % Test,
logback % Test,
scalaTest % Test
logback % Test
),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.delta.plugins.compositeviews",
Expand Down Expand Up @@ -540,9 +516,7 @@ lazy val searchPlugin = project
moduleName := "delta-search-plugin",
libraryDependencies ++= Seq(
kamonAkkaHttp % Provided,
akkaSlf4j % Test,
logback % Test,
scalaTest % Test
logback % Test
),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.delta.plugins.search",
Expand All @@ -568,11 +542,8 @@ lazy val storagePlugin = project
name := "delta-storage-plugin",
moduleName := "delta-storage-plugin",
libraryDependencies ++= Seq(
kamonAkkaHttp % Provided,
akkaSlf4j % Test,
akkaTestKitTyped % Test,
akkaHttpTestKit % Test,
logback % Test
kamonAkkaHttp % Provided,
logback % Test
) ++ Seq(
fs2ReactiveStreams,
fs2Aws,
Expand Down Expand Up @@ -615,9 +586,7 @@ lazy val archivePlugin = project
alpakkaFile excludeAll (
ExclusionRule(organization = "com.typesafe.akka", name = "akka-stream_2.13")
),
akkaSlf4j % Test,
logback % Test,
scalaTest % Test
logback % Test
),
addCompilerPlugin(betterMonadicFor),
buildInfoKeys := Seq[BuildInfoKey](version),
Expand All @@ -640,8 +609,7 @@ lazy val projectDeletionPlugin = project
name := "delta-project-deletion-plugin",
moduleName := "delta-project-deletion-plugin",
libraryDependencies ++= Seq(
kamonAkkaHttp % Provided,
scalaTest % Test
kamonAkkaHttp % Provided
),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.delta.plugins.projectdeletion",
Expand All @@ -668,9 +636,7 @@ lazy val graphAnalyticsPlugin = project
moduleName := "delta-graph-analytics-plugin",
libraryDependencies ++= Seq(
kamonAkkaHttp % Provided,
akkaSlf4j % Test,
logback % Test,
scalaTest % Test
logback % Test
),
addCompilerPlugin(betterMonadicFor),
buildInfoKeys := Seq[BuildInfoKey](version),
Expand All @@ -695,8 +661,7 @@ lazy val jiraPlugin = project
moduleName := "delta-jira-plugin",
libraryDependencies ++= Seq(
googleAuthClient,
kamonAkkaHttp % Provided,
scalaTest % Test
kamonAkkaHttp % Provided
),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.delta.plugins.jira",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package ch.epfl.bluebrain.nexus.delta

import akka.actor.typed.ActorSystem
import akka.actor.typed.scaladsl.adapter._
import akka.actor.{ActorSystem => ActorSystemClassic}
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.headers.RawHeader
import akka.http.scaladsl.server.{ExceptionHandler, RejectionHandler, Route, RouteResult}
Expand Down Expand Up @@ -151,8 +149,8 @@ object Main extends IOApp {
}

private def bootstrap(locator: Locator, plugins: List[Plugin]): Resource[IO, Unit] = {
implicit val as: ActorSystemClassic = locator.get[ActorSystem[Nothing]].toClassic
implicit val cfg: AppConfig = locator.get[AppConfig]
implicit val as: ActorSystem = locator.get[ActorSystem]
implicit val cfg: AppConfig = locator.get[AppConfig]

val startHttpServer = IOFuture.defaultCancelable(
IO(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package ch.epfl.bluebrain.nexus.delta.wiring

import akka.actor.BootstrapSetup
import akka.actor.typed.ActorSystem
import akka.actor.typed.scaladsl.Behaviors
import akka.actor.{ActorSystem, BootstrapSetup}
import akka.http.scaladsl.model.HttpMethods._
import akka.http.scaladsl.model.headers.Location
import akka.http.scaladsl.server.{ExceptionHandler, RejectionHandler, Route}
Expand Down Expand Up @@ -134,21 +132,19 @@ class DeltaModule(appCfg: AppConfig, config: Config)(implicit classLoader: Class
JWSPayloadHelper(config.jws)
}

make[ActorSystem[Nothing]].fromResource { () =>
make[ActorSystem].fromResource { () =>
val make = IO.delay(
ActorSystem[Nothing](
Behaviors.empty,
ActorSystem(
appCfg.description.fullName,
BootstrapSetup().withConfig(config).withClassloader(classLoader)
)
)
val release = (as: ActorSystem[Nothing]) => {
import akka.actor.typed.scaladsl.adapter._
IOFuture.defaultCancelable(IO(as.toClassic.terminate()).timeout(15.seconds)).void
val release = (as: ActorSystem) => {
IOFuture.defaultCancelable(IO(as.terminate()).timeout(15.seconds)).void
}
Resource.make(make)(release)
}
make[Materializer].from((as: ActorSystem[Nothing]) => SystemMaterializer(as).materializer)
make[Materializer].from((as: ActorSystem) => SystemMaterializer(as).materializer)
make[Logger].from { LoggerFactory.getLogger("delta") }
make[RejectionHandler].from { (cr: RemoteContextResolution @Id("aggregate"), ordering: JsonKeyOrdering) =>
RdfRejectionHandler(cr, ordering)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.epfl.bluebrain.nexus.delta.wiring

import akka.actor.typed.ActorSystem
import akka.actor.ActorSystem
import akka.http.scaladsl.model.{HttpRequest, Uri}
import cats.effect.{Clock, IO}
import ch.epfl.bluebrain.nexus.delta.Main.pluginsMaxPriority
Expand Down Expand Up @@ -50,8 +50,8 @@ object RealmsModule extends ModuleDef {
new RealmsRoutes(identities, realms, aclCheck)(cfg.http.baseUri, cfg.realms.pagination, cr, ordering)
}

make[HttpClient].named("realm").from { (as: ActorSystem[Nothing]) =>
HttpClient.noRetry(compression = false)(as.classicSystem)
make[HttpClient].named("realm").from { (as: ActorSystem) =>
HttpClient.noRetry(compression = false)(as)
}

many[MetadataContextValue].addEffect(MetadataContextValue.fromFile("contexts/realms-metadata.json"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,20 @@ object MainSuite {
)

Map(
"app.defaults.database.access.host" -> postgres.getHost,
"app.defaults.database.access.port" -> postgres.getMappedPort(5432).toString,
"app.database.tables-autocreate" -> "true",
"app.defaults.database.access.username" -> PostgresUser,
"app.default.database.access.password" -> PostgresPassword,
"akka.actor.testkit.typed.throw-on-shutdown-timeout" -> "false",
"plugins.elasticsearch.indexing-enabled" -> "false",
"app.defaults.database.access.host" -> postgres.getHost,
"app.defaults.database.access.port" -> postgres.getMappedPort(5432).toString,
"app.database.tables-autocreate" -> "true",
"app.defaults.database.access.username" -> PostgresUser,
"app.default.database.access.password" -> PostgresPassword,
"plugins.elasticsearch.indexing-enabled" -> "false",
//TODO Investigate how to remove this property from the config
"plugins.elasticsearch.disable-metrics-projection" -> "true",
"plugins.graph-analytics.enabled" -> "true",
"plugins.graph-analytics.indexing-enabled" -> "false",
"plugins.search.enabled" -> "true",
"plugins.search.indexing.resource-types" -> resourceTypesFile.toString,
"plugins.search.indexing.mapping" -> mappingFile.toString,
"plugins.search.indexing.query" -> queryFile.toString
"plugins.elasticsearch.disable-metrics-projection" -> "true",
"plugins.graph-analytics.enabled" -> "true",
"plugins.graph-analytics.indexing-enabled" -> "false",
"plugins.search.enabled" -> "true",
"plugins.search.indexing.resource-types" -> resourceTypesFile.toString,
"plugins.search.indexing.mapping" -> mappingFile.toString,
"plugins.search.indexing.query" -> queryFile.toString
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ch.epfl.bluebrain.nexus.delta.plugins.blazegraph

import akka.actor.typed.ActorSystem
import akka.actor.ActorSystem
import cats.effect.{Clock, IO}
import ch.epfl.bluebrain.nexus.delta.kernel.utils.{ClasspathResourceLoader, UUIDF}
import ch.epfl.bluebrain.nexus.delta.plugins.blazegraph.client.BlazegraphClient
Expand Down Expand Up @@ -48,12 +48,8 @@ class BlazegraphPluginModule(priority: Int) extends ModuleDef {
loader.propertiesOf("blazegraph/index.properties").map(DefaultProperties)
}

make[HttpClient].named("http-indexing-client").from {
(
cfg: BlazegraphViewsConfig,
as: ActorSystem[Nothing]
) =>
HttpClient()(cfg.indexingClient, as.classicSystem)
make[HttpClient].named("http-indexing-client").from { (cfg: BlazegraphViewsConfig, as: ActorSystem) =>
HttpClient()(cfg.indexingClient, as)
}

make[BlazegraphSlowQueryStore].from { (xas: Transactors) =>
Expand Down Expand Up @@ -82,29 +78,25 @@ class BlazegraphPluginModule(priority: Int) extends ModuleDef {
(
cfg: BlazegraphViewsConfig,
client: HttpClient @Id("http-indexing-client"),
as: ActorSystem[Nothing],
as: ActorSystem,
properties: DefaultProperties
) =>
BlazegraphClient(client, cfg.base, cfg.credentials, cfg.queryTimeout, properties.value)(
as.classicSystem
)
BlazegraphClient(client, cfg.base, cfg.credentials, cfg.queryTimeout, properties.value)(as)
}

make[HttpClient].named("http-query-client").from { (as: ActorSystem[Nothing]) =>
make[HttpClient].named("http-query-client").from { (as: ActorSystem) =>
val httpConfig = HttpClientConfig.noRetry(false)
HttpClient()(httpConfig, as.classicSystem)
HttpClient()(httpConfig, as)
}

make[BlazegraphClient].named("blazegraph-query-client").from {
(
cfg: BlazegraphViewsConfig,
client: HttpClient @Id("http-query-client"),
as: ActorSystem[Nothing],
as: ActorSystem,
properties: DefaultProperties
) =>
BlazegraphClient(client, cfg.base, cfg.credentials, cfg.queryTimeout, properties.value)(
as.classicSystem
)
BlazegraphClient(client, cfg.base, cfg.credentials, cfg.queryTimeout, properties.value)(as)
}

make[ValidateBlazegraphView].from {
Expand Down
Loading