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

build: Build gardening #4404

Merged
merged 3 commits into from
May 20, 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
13 changes: 4 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import akka._
import akka.ValidatePullRequest._
import AkkaDependency._
import Dependencies.{h2specExe, h2specName}
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys.MultiJvm
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import com.typesafe.sbt.MultiJvmPlugin.autoImport.MultiJvm
import java.nio.file.Files
import java.nio.file.attribute.{PosixFileAttributeView, PosixFilePermission}

Expand Down Expand Up @@ -51,9 +49,7 @@ inThisBuild(Def.settings(
onLoad in Global := {
sLog.value.info(s"Building Akka HTTP ${version.value} against Akka ${AkkaDependency.akkaVersion} on Scala ${(httpCore / scalaVersion).value}")
(onLoad in Global).value
},

scalafixScalaBinaryVersion := scalaBinaryVersion.value,
}
))

// When this is updated the set of modules in Http.allModules should also be updated
Expand Down Expand Up @@ -83,7 +79,7 @@ lazy val root = Project(
id = "akka-http-root",
base = file(".")
)
.enablePlugins(UnidocRoot, NoPublish, PublishRsyncPlugin, AggregatePRValidation, NoScala3)
.enablePlugins(UnidocRoot, NoPublish, PublishRsyncPlugin, NoScala3)
.disablePlugins(
MimaPlugin,
com.geirsson.CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin
Expand Down Expand Up @@ -276,7 +272,7 @@ lazy val httpTests = project("akka-http-tests")
.disablePlugins(MimaPlugin) // this is only tests
.configs(MultiJvm)
.settings(headerSettings(MultiJvm))
.settings(ValidatePR / additionalTasks += MultiJvm / headerCheck)
.settings(AkkaHttpValidatePullRequest.additionalTasks += MultiJvm / headerCheck)
.addAkkaModuleDependency("akka-stream", "provided")
.addAkkaModuleDependency("akka-multi-node-testkit", "test")
.settings(
Expand Down Expand Up @@ -515,7 +511,6 @@ lazy val docs = project("docs")
),
apidocRootPackage := "akka",
Formatting.docFormatSettings,
ValidatePR / additionalTasks ++= Seq(Compile / paradox),
ThisBuild / publishRsyncHost := "akkarepo@gustav.akka.io",
publishRsyncArtifacts := List((Compile / paradox).value -> gustavDir("docs").value),
)
Expand Down
10 changes: 5 additions & 5 deletions project/CopyrightHeader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

package akka

import sbt._, Keys._
import de.heikoseeberger.sbtheader.{ CommentCreator, HeaderPlugin }
import sbt.*
import Keys.*
import de.heikoseeberger.sbtheader.{CommentCreator, HeaderPlugin}

object CopyrightHeader extends AutoPlugin {
import HeaderPlugin.autoImport._
import ValidatePullRequest.{ additionalTasks, ValidatePR }
import akka.AkkaHttpValidatePullRequest.additionalTasks

override def requires = HeaderPlugin
override def trigger = allRequirements
Expand All @@ -27,8 +28,7 @@ object CopyrightHeader extends AutoPlugin {
)
)
},
ValidatePR / additionalTasks += Compile / headerCheck,
ValidatePR / additionalTasks += Test / headerCheck
Def.settings(additionalTasks += Compile / headerCheck, additionalTasks += Test / headerCheck),
johanandren marked this conversation as resolved.
Show resolved Hide resolved
)

// We hard-code this so PR's created in year X will not suddenly in X+1.
Expand Down
2 changes: 1 addition & 1 deletion project/Formatting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package akka

import sbt._
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys.MultiJvm
import com.typesafe.sbt.MultiJvmPlugin.autoImport.MultiJvm
import com.typesafe.sbt.SbtScalariform.ScalariformKeys

object Formatting {
Expand Down
12 changes: 9 additions & 3 deletions project/Github.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ package akka

object GitHub {

def envTokenOrThrow: String =
System.getenv("PR_VALIDATOR_GH_TOKEN")
.ensuring(_ != null, "No PR_VALIDATOR_GH_TOKEN env var provided, unable to reach github!")
def envTokenOrThrow: Option[String] =
sys.env.get("PR_VALIDATOR_GH_TOKEN").orElse {
if (sys.env.contains("ghprbPullId")) {
throw new Exception(
"No PR_VALIDATOR_GH_TOKEN env var provided during GitHub Pull Request Builder build, unable to reach GitHub!")
} else {
None
}
}

def url(v: String, isSnapshot: Boolean): String = {
val branch = if (isSnapshot) "main" else "v" + v
Expand Down
7 changes: 4 additions & 3 deletions project/MultiNode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

package akka

import com.typesafe.sbt.{SbtMultiJvm, SbtScalariform}
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys._
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.MultiJvmPlugin
import com.typesafe.sbt.MultiJvmPlugin.autoImport._
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import sbt._
import sbt.Keys._
Expand Down Expand Up @@ -49,7 +50,7 @@ object MultiNode extends AutoPlugin {
}

private val multiJvmSettings =
SbtMultiJvm.multiJvmSettings ++
MultiJvmPlugin.multiJvmSettings ++
inConfig(MultiJvm)(SbtScalariform.configScalariformSettings) ++
Seq(
MultiJvm / jvmOptions := defaultMultiJvmOptions,
Expand Down
Loading
Loading