def project()

in build.sbt [327:439]


def project(moduleName: String) =
  Project(id = moduleName, base = file(moduleName)).settings(
    name := s"pekko-$moduleName")

def httpMarshallersScalaSubproject(moduleName: String) =
  Project(
    id = s"http-$moduleName",
    base = file(s"http-marshallers-scala/http-$moduleName"))
    .dependsOn(http)
    .settings(
      name := s"pekko-http-$moduleName")
    .settings(commonSettings)
    .enablePlugins(BootstrapGenjavadoc)
    .enablePlugins(ReproducibleBuildsPlugin)

def httpMarshallersJavaSubproject(moduleName: String) =
  Project(
    id = s"http-$moduleName",
    base = file(s"http-marshallers-java/http-$moduleName"))
    .settings(
      name := s"pekko-http-$moduleName")
    .dependsOn(http)
    .settings(commonSettings)
    .enablePlugins(BootstrapGenjavadoc)
    .enablePlugins(ReproducibleBuildsPlugin)

lazy val httpScalafix = project("http-scalafix")
  .enablePlugins(NoPublish, NoScala3)
  .disablePlugins(MimaPlugin)
  .aggregate(httpScalafixRules, httpScalafixTestInput, httpScalafixTestOutput, httpScalafixTests)

lazy val httpScalafixRules =
  Project(id = "http-scalafix-rules", base = file("http-scalafix/scalafix-rules"))
    .settings(
      name := "pekko-http-scalafix-rules",
      libraryDependencies += Dependencies.Compile.scalafix)
    .enablePlugins(NoScala3)
    .disablePlugins(MimaPlugin) // tooling, no bin compat guaranteed

lazy val httpScalafixTestInput =
  Project(id = "http-scalafix-test-input", base = file("http-scalafix/scalafix-test-input"))
    .dependsOn(http)
    .addPekkoModuleDependency("pekko-stream", "", PekkoCoreDependency.default)
    .enablePlugins(NoPublish, NoScala3)
    .disablePlugins(MimaPlugin, HeaderPlugin /* because it gets confused about metaheader required for tests */ )
    .settings(
      addCompilerPlugin(scalafixSemanticdb),
      scalacOptions ++= List(
        "-Yrangepos",
        "-P:semanticdb:synthetics:on"),
      scalacOptions := scalacOptions.value.filterNot(Set("-deprecation", "-Xlint").contains(_)) // we expect deprecated stuff in there
    )

lazy val httpScalafixTestOutput =
  Project(id = "http-scalafix-test-output", base = file("http-scalafix/scalafix-test-output"))
    .dependsOn(http)
    .addPekkoModuleDependency("pekko-stream", "", PekkoCoreDependency.default)
    .enablePlugins(NoPublish, NoScala3)
    .disablePlugins(MimaPlugin, HeaderPlugin /* because it gets confused about metaheader required for tests */ )

lazy val httpScalafixTests =
  Project(id = "http-scalafix-tests", base = file("http-scalafix/scalafix-tests"))
    .enablePlugins(NoPublish, NoScala3)
    .disablePlugins(MimaPlugin)
    .settings(
      name := "pekko-http-scalafix-tests",
      publish / skip := true,
      libraryDependencies += ("ch.epfl.scala" % "scalafix-testkit" % Dependencies.scalafixVersion % Test).cross(
        CrossVersion.full),
      Compile / compile :=
        (Compile / compile).dependsOn(httpScalafixTestInput / Compile / compile).value,
      scalafixTestkitOutputSourceDirectories :=
        (httpScalafixTestOutput / Compile / sourceDirectories).value,
      scalafixTestkitInputSourceDirectories :=
        (httpScalafixTestInput / Compile / sourceDirectories).value,
      scalafixTestkitInputClasspath :=
        (httpScalafixTestInput / Compile / fullClasspath).value)
    .dependsOn(httpScalafixRules)
    .enablePlugins(ScalafixTestkitPlugin)

lazy val docs = project("docs")
  .enablePlugins(ParadoxPlugin, PekkoParadoxPlugin, NoPublish)
  .disablePlugins(MimaPlugin)
  .addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default)
  .addPekkoModuleDependency("pekko-actor-typed", "provided", PekkoCoreDependency.default)
  .addPekkoModuleDependency("pekko-multi-node-testkit", "provided", PekkoCoreDependency.default)
  .addPekkoModuleDependency("pekko-stream-testkit", "provided", PekkoCoreDependency.default)
  .addPekkoModuleDependency("pekko-actor-testkit-typed", "provided", PekkoCoreDependency.default)
  .dependsOn(
    httpCore, http, httpXml, http2Tests, httpMarshallersJava, httpMarshallersScala, httpCaching, httpCors,
    httpTests % "compile;test->test", httpTestkit % "compile;test->test", httpScalafixRules % ScalafixConfig)
  .settings(Dependencies.docs)
  .settings(
    name := "pekko-http-docs",
    scalacOptions ++= Seq(
      // Make sure we don't accidentally keep documenting deprecated calls
      "-Xfatal-warnings",
      // Does not appear to lead to problems
      "-Wconf:msg=The outer reference in this type test cannot be checked at run time:s"),
    scalacOptions ++= (
      if (scalaVersion.value.startsWith("3")) Seq.empty
      else Seq(
        // In docs adding an unused variable can be helpful, for example
        // to show its type
        "-Xlint:-unused")
    ),
    scalacOptions --= Seq(
      // Code after ??? can be considered 'dead',  but still useful for docs
      "-Ywarn-dead-code"),
    paradoxParsingTimeout := {
      import scala.concurrent.duration._
      10.seconds
    },