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

enable compile inline (upgrade sbt-pekko-build) #418

Merged
merged 3 commits into from
Jan 14, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
65 changes: 34 additions & 31 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ commands := commands.value.filterNot { command =>
}
}

// pekkoInlineEnabled must be set to false when this is backported to 1.0.x branch
ThisBuild / pekkoInlineEnabled := true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this part is not needed since its already enabled by default, I was planning to add

// pekkoInlineEnabled must be set to false when this is backported to 1.0.x branch
ThisBuild / pekkoInlineEnabled := false

When doing the cherry pick backport to 1.0.x.

I can handle the backports if you want, this is not hard to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to keep this explicit. There are a few contributors and they are not all up to date with the subtleties of this sbt plugin.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, I won't fight over this. We can always change it later once the storm of the 1.1.x releases are over


ThisBuild / reproducibleBuildsCheckResolver := Resolver.ApacheMavenStagingRepo

addCommandAlias("verifyCodeStyle", "scalafmtCheckAll; scalafmtSbtCheck; +headerCheckAll; javafmtCheckAll")
Expand All @@ -49,7 +52,7 @@ inThisBuild(Def.settings(
concurrentRestrictions in Global += Tags.limit(Tags.Test, 1),
onLoad in Global := {
sLog.value.info(
s"Building Pekko HTTP ${version.value} against Pekko ${PekkoDependency.pekkoVersion} on Scala ${(httpCore / scalaVersion).value}")
s"Building Pekko HTTP ${version.value} against Pekko ${PekkoCoreDependency.version} on Scala ${(httpCore / scalaVersion).value}")
(onLoad in Global).value
},
projectInfoVersion := (if (isSnapshot.value) "snapshot" else version.value),
Expand Down Expand Up @@ -130,7 +133,7 @@ val scalaMacroSupport = Seq(
lazy val parsing = project("parsing")
.settings(commonSettings)
.settings(AutomaticModuleName.settings("pekko.http.parsing"))
.addPekkoModuleDependency("pekko-actor", "provided")
.addPekkoModuleDependency("pekko-actor", "provided", PekkoCoreDependency.default)
.settings(Dependencies.parsing)
.settings(scalacOptions += "-language:_")
.settings(scalaMacroSupport)
Expand All @@ -143,11 +146,11 @@ lazy val httpCore = project("http-core")
.settings(AutomaticModuleName.settings("pekko.http.core"))
.settings(AddMetaInfLicenseFiles.httpCoreSettings)
.dependsOn(parsing /*, httpScalafixRules % ScalafixConfig*/ )
.addPekkoModuleDependency("pekko-stream", "provided")
.addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default)
.addPekkoModuleDependency(
"pekko-stream-testkit",
"test",
PekkoDependency.default)
PekkoCoreDependency.default)
.settings(Dependencies.httpCore)
.settings(VersionGenerator.versionSettings)
.settings(scalaMacroSupport)
Expand All @@ -162,7 +165,7 @@ lazy val http = project("http")
.settings(commonSettings)
.settings(AutomaticModuleName.settings("pekko.http"))
.dependsOn(httpCore)
.addPekkoModuleDependency("pekko-stream", "provided")
.addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default)
.settings(Dependencies.http)
.settings(
Compile / scalacOptions += "-language:_")
Expand All @@ -177,8 +180,8 @@ lazy val http2Tests = project("http2-tests")
.settings(commonSettings)
.settings(AutomaticModuleName.settings("pekko.http.http2"))
.dependsOn(httpCore, httpTestkit % "test", httpCore % "test->test")
.addPekkoModuleDependency("pekko-stream", "provided")
.addPekkoModuleDependency("pekko-stream-testkit", "test")
.addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default)
.addPekkoModuleDependency("pekko-stream-testkit", "test", PekkoCoreDependency.default)
.settings(Dependencies.http2Tests)
.settings {
lazy val h2specPath = Def.task {
Expand Down Expand Up @@ -219,8 +222,8 @@ lazy val httpTestkit = project("http-testkit")
.settings(commonSettings)
.settings(AutomaticModuleName.settings("pekko.http.testkit"))
.dependsOn(http)
.addPekkoModuleDependency("pekko-stream-testkit", "provided")
.addPekkoModuleDependency("pekko-testkit", "provided")
.addPekkoModuleDependency("pekko-stream-testkit", "provided", PekkoCoreDependency.default)
.addPekkoModuleDependency("pekko-testkit", "provided", PekkoCoreDependency.default)
.settings(Dependencies.httpTestkit)
.settings(
// don't ignore Suites which is the default for the junit-interface
Expand All @@ -242,8 +245,8 @@ lazy val httpTests = project("http-tests")
.disablePlugins(MimaPlugin) // this is only tests
.configs(MultiJvm)
.settings(headerSettings(MultiJvm))
.addPekkoModuleDependency("pekko-stream", "provided")
.addPekkoModuleDependency("pekko-multi-node-testkit", "test")
.addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default)
.addPekkoModuleDependency("pekko-multi-node-testkit", "test", PekkoCoreDependency.default)
.settings(
// Fix to reenable scala-steward, see https://gitter.im/scala-steward-org/scala-steward?at=6183bb66d78911028a1b7cd8
// Putting that jar file with the complicated name into the git tree directly breaks if something in the environment
Expand All @@ -262,7 +265,7 @@ lazy val httpTests = project("http-tests")
lazy val httpJmhBench = project("http-bench-jmh")
.settings(commonSettings)
.dependsOn(http, httpCors, http2Tests % "compile->compile,test")
.addPekkoModuleDependency("pekko-stream")
.addPekkoModuleDependency("pekko-stream", "", PekkoCoreDependency.default)
.enablePlugins(JmhPlugin)
.enablePlugins(NoPublish) // don't release benchs
.disablePlugins(MimaPlugin)
Expand All @@ -276,13 +279,13 @@ lazy val httpMarshallersScala = project("http-marshallers-scala")
lazy val httpXml =
httpMarshallersScalaSubproject("xml")
.settings(AutomaticModuleName.settings("pekko.http.marshallers.scalaxml"))
.addPekkoModuleDependency("pekko-stream", "provided")
.addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default)
.settings(Dependencies.httpXml)

lazy val httpSprayJson =
httpMarshallersScalaSubproject("spray-json")
.settings(AutomaticModuleName.settings("pekko.http.marshallers.sprayjson"))
.addPekkoModuleDependency("pekko-stream", "provided")
.addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default)
.settings(Dependencies.httpSprayJson)

lazy val httpMarshallersJava = project("http-marshallers-java")
Expand All @@ -294,8 +297,8 @@ lazy val httpMarshallersJava = project("http-marshallers-java")
lazy val httpJackson =
httpMarshallersJavaSubproject("jackson")
.settings(AutomaticModuleName.settings("pekko.http.marshallers.jackson"))
.addPekkoModuleDependency("pekko-stream", "provided")
.addPekkoModuleDependency("pekko-stream-testkit", "test")
.addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default)
.addPekkoModuleDependency("pekko-stream-testkit", "test", PekkoCoreDependency.default)
.dependsOn(httpTestkit % "test")
.settings(Dependencies.httpJackson)
.enablePlugins(ScaladocNoVerificationOfDiagrams)
Expand All @@ -305,8 +308,8 @@ lazy val httpCaching = project("http-caching")
name := "pekko-http-caching")
.settings(commonSettings)
.settings(AutomaticModuleName.settings("pekko.http.caching"))
.addPekkoModuleDependency("pekko-stream", "provided")
.addPekkoModuleDependency("pekko-stream-testkit", "provided")
.addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default)
.addPekkoModuleDependency("pekko-stream-testkit", "provided", PekkoCoreDependency.default)
.settings(Dependencies.httpCaching)
.dependsOn(http, httpCore, httpTestkit % "test")
.enablePlugins(BootstrapGenjavadoc)
Expand All @@ -317,8 +320,8 @@ lazy val httpCors = project("http-cors")
.settings(commonSettings)
.settings(AutomaticModuleName.settings("pekko.http.cors"))
.settings(AddMetaInfLicenseFiles.httpCorsSettings)
.addPekkoModuleDependency("pekko-stream", "provided")
.addPekkoModuleDependency("pekko-stream-testkit", "provided")
.addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default)
.addPekkoModuleDependency("pekko-stream-testkit", "provided", PekkoCoreDependency.default)
.settings(Dependencies.httpCors)
.dependsOn(http, httpCore, httpTestkit % "test")
.enablePlugins(BootstrapGenjavadoc)
Expand Down Expand Up @@ -365,7 +368,7 @@ lazy val httpScalafixRules =
lazy val httpScalafixTestInput =
Project(id = "http-scalafix-test-input", base = file("http-scalafix/scalafix-test-input"))
.dependsOn(http)
.addPekkoModuleDependency("pekko-stream")
.addPekkoModuleDependency("pekko-stream", "", PekkoCoreDependency.default)
.enablePlugins(NoPublish, NoScala3)
.disablePlugins(MimaPlugin, HeaderPlugin /* because it gets confused about metaheader required for tests */ )
.settings(
Expand All @@ -379,7 +382,7 @@ lazy val httpScalafixTestInput =
lazy val httpScalafixTestOutput =
Project(id = "http-scalafix-test-output", base = file("http-scalafix/scalafix-test-output"))
.dependsOn(http)
.addPekkoModuleDependency("pekko-stream")
.addPekkoModuleDependency("pekko-stream", "", PekkoCoreDependency.default)
.enablePlugins(NoPublish, NoScala3)
.disablePlugins(MimaPlugin, HeaderPlugin /* because it gets confused about metaheader required for tests */ )

Expand All @@ -406,11 +409,11 @@ lazy val httpScalafixTests =
lazy val docs = project("docs")
.enablePlugins(ParadoxPlugin, PekkoParadoxPlugin, NoPublish)
.disablePlugins(MimaPlugin)
.addPekkoModuleDependency("pekko-stream", "provided")
.addPekkoModuleDependency("pekko-actor-typed", "provided")
.addPekkoModuleDependency("pekko-multi-node-testkit", "provided")
.addPekkoModuleDependency("pekko-stream-testkit", "provided")
.addPekkoModuleDependency("pekko-actor-testkit-typed", "provided")
.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)
Expand Down Expand Up @@ -440,15 +443,15 @@ lazy val docs = project("docs")
Compile / paradoxProperties ++= Map(
"project.name" -> "Apache Pekko HTTP",
"canonical.base_url" -> "https://pekko.apache.org/docs/pekko-http/current",
"pekko.version" -> PekkoDependency.pekkoVersion,
"pekko.version" -> PekkoCoreDependency.version,
"jackson.xml.version" -> Dependencies.jacksonXmlVersion,
"scalafix.version" -> _root_.scalafix.sbt.BuildInfo.scalafixVersion, // grab from scalafix plugin directly
"extref.pekko-docs.base_url" -> s"https://pekko.apache.org/docs/pekko/current/%s",
"javadoc.java.base_url" -> "https://docs.oracle.com/en/java/javase/11/docs/api/java.base/",
"javadoc.java.link_style" -> "direct",
"javadoc.org.apache.pekko.base_url" -> s"https://pekko.apache.org/japi/pekko/${PekkoDependency.default.link}",
"javadoc.org.apache.pekko.base_url" -> s"https://pekko.apache.org/japi/pekko/${PekkoCoreDependency.default.link}",
"javadoc.org.apache.pekko.link_style" -> "direct",
"scaladoc.org.apache.pekko.base_url" -> s"https://pekko.apache.org/api/pekko/${PekkoDependency.default.link}",
"scaladoc.org.apache.pekko.base_url" -> s"https://pekko.apache.org/api/pekko/${PekkoCoreDependency.default.link}",
"scaladoc.org.apache.pekko.link_style" -> "direct",
"javadoc.org.apache.pekko.http.base_url" -> s"https://pekko.apache.org/api/pekko-http/${projectInfoVersion.value}",
"scaladoc.org.apache.pekko.http.base_url" -> s"https://pekko.apache.org/japi/pekko-http/${projectInfoVersion.value}",
Expand All @@ -461,7 +464,7 @@ lazy val docs = project("docs")
lazy val compatibilityTests = Project("http-compatibility-tests", file("http-compatibility-tests"))
.enablePlugins(NoPublish, NoScala3)
.disablePlugins(MimaPlugin)
.addPekkoModuleDependency("pekko-stream", "provided")
.addPekkoModuleDependency("pekko-stream", "provided", PekkoCoreDependency.default)
.settings(
libraryDependencies ++= Seq(
"org.apache.pekko" %% "pekko-http" % MiMa.latest101Version % "provided",
Expand Down
24 changes: 24 additions & 0 deletions project/PekkoCoreDependency.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import com.github.pjfanning.pekkobuild.PekkoDependency

object PekkoCoreDependency extends PekkoDependency {
override val checkProject: String = "pekko-cluster-sharding-typed"
override val module: Option[String] = None
override val currentVersion: String = "1.0.2"
}
3 changes: 1 addition & 2 deletions project/VersionGenerator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import sbt._
import sbt.Keys._
import com.github.pjfanning.pekkobuild.PekkoDependency

/**
* Generate version.conf and pekko/Version.scala files based on the version setting.
Expand Down Expand Up @@ -45,7 +44,7 @@ object VersionGenerator {

def generateVersion(dir: SettingKey[File], locate: File => File, template: String) = Def.task[Seq[File]] {
val file = locate(dir.value)
val content = template.stripMargin.format(version.value, PekkoDependency.minPekkoVersion)
val content = template.stripMargin.format(version.value, PekkoCoreDependency.minVersion)
if (!file.exists || IO.read(file) != content) IO.write(file, content)
Seq(file)
}
Expand Down
3 changes: 1 addition & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

resolvers += Classpaths.sbtPluginReleases
resolvers += Classpaths.typesafeReleases
resolvers ++= Resolver.sonatypeOssRepos("releases") // to more quickly obtain paradox right after release

addSbtPlugin("com.typesafe.sbt" % "sbt-multi-jvm" % "0.4.0")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3")
Expand Down Expand Up @@ -39,7 +38,7 @@ addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1")
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1")
addSbtPlugin("org.mdedetrich" % "sbt-apache-sonatype" % "0.1.10")
addSbtPlugin("com.github.pjfanning" % "sbt-source-dist" % "0.1.11")
addSbtPlugin("com.github.pjfanning" % "sbt-pekko-build" % "0.2.0")
addSbtPlugin("com.github.pjfanning" % "sbt-pekko-build" % "0.3.0")
addSbtPlugin("net.virtual-void" % "sbt-hackers-digest" % "0.1.2")
addSbtPlugin("com.lightbend.sbt" % "sbt-java-formatter" % "0.7.0")

Expand Down