2019-01-02 18:55:26 +08:00
|
|
|
/*
|
2021-01-08 17:55:38 +01:00
|
|
|
* Copyright (C) 2009-2021 Lightbend Inc. <https://www.lightbend.com>
|
2015-01-22 20:26:34 +02:00
|
|
|
*/
|
2018-03-13 23:45:55 +09:00
|
|
|
|
2015-01-22 20:26:34 +02:00
|
|
|
package akka
|
|
|
|
|
|
2019-01-15 12:23:27 +11:00
|
|
|
import com.hpe.sbt.ValidatePullRequest
|
|
|
|
|
import com.hpe.sbt.ValidatePullRequest.PathGlobFilter
|
2017-10-30 03:13:14 +02:00
|
|
|
import com.lightbend.paradox.sbt.ParadoxPlugin
|
|
|
|
|
import com.lightbend.paradox.sbt.ParadoxPlugin.autoImport.paradox
|
2016-12-02 14:23:13 +01:00
|
|
|
import com.typesafe.tools.mima.plugin.MimaKeys.mimaReportBinaryIssues
|
2016-03-10 10:45:35 +02:00
|
|
|
import com.typesafe.tools.mima.plugin.MimaPlugin
|
2017-10-30 03:13:14 +02:00
|
|
|
import sbtunidoc.BaseUnidocPlugin.autoImport.unidoc
|
2015-05-05 19:39:56 +02:00
|
|
|
import sbt.Keys._
|
|
|
|
|
import sbt._
|
|
|
|
|
|
2019-01-15 12:23:27 +11:00
|
|
|
object AkkaValidatePullRequest extends AutoPlugin {
|
2015-01-22 20:26:34 +02:00
|
|
|
|
2019-09-30 12:40:22 +02:00
|
|
|
object CliOptions {
|
|
|
|
|
val mimaEnabled = CliOption("akka.mima.enabled", true)
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-15 12:23:27 +11:00
|
|
|
import ValidatePullRequest.autoImport._
|
2015-01-22 20:26:34 +02:00
|
|
|
|
2015-05-12 16:10:27 +02:00
|
|
|
override def trigger = allRequirements
|
2019-01-15 12:23:27 +11:00
|
|
|
override def requires = ValidatePullRequest
|
2015-05-10 02:01:12 +02:00
|
|
|
|
2015-05-05 19:39:56 +02:00
|
|
|
val ValidatePR = config("pr-validation") extend Test
|
|
|
|
|
|
|
|
|
|
override lazy val projectConfigurations = Seq(ValidatePR)
|
|
|
|
|
|
2019-01-15 12:23:27 +11:00
|
|
|
val additionalTasks = settingKey[Seq[TaskKey[_]]]("Additional tasks for pull request validation")
|
2015-05-05 19:39:56 +02:00
|
|
|
|
2019-01-15 12:23:27 +11:00
|
|
|
override lazy val globalSettings = Seq(
|
|
|
|
|
credentials ++= {
|
|
|
|
|
// todo this should probably be supplied properly
|
|
|
|
|
GitHub.envTokenOrThrow.map { token =>
|
|
|
|
|
Credentials("GitHub API", "api.github.com", "", token)
|
2016-01-22 00:56:25 +01:00
|
|
|
}
|
|
|
|
|
},
|
2019-01-15 12:23:27 +11:00
|
|
|
additionalTasks := Seq.empty
|
|
|
|
|
)
|
2016-01-22 00:56:25 +01:00
|
|
|
|
2019-01-15 12:23:27 +11:00
|
|
|
override lazy val buildSettings = Seq(
|
|
|
|
|
validatePullRequest / includeFilter := PathGlobFilter("akka-*/**"),
|
|
|
|
|
validatePullRequestBuildAll / excludeFilter := PathGlobFilter("project/MiMa.scala"),
|
|
|
|
|
prValidatorGithubRepository := Some("akka/akka")
|
2017-10-30 03:13:14 +02:00
|
|
|
)
|
2015-12-01 16:53:48 +01:00
|
|
|
|
|
|
|
|
override lazy val projectSettings = inConfig(ValidatePR)(Defaults.testTasks) ++ Seq(
|
|
|
|
|
testOptions in ValidatePR += Tests.Argument(TestFrameworks.ScalaTest, "-l", "performance"),
|
|
|
|
|
testOptions in ValidatePR += Tests.Argument(TestFrameworks.ScalaTest, "-l", "long-running"),
|
|
|
|
|
testOptions in ValidatePR += Tests.Argument(TestFrameworks.ScalaTest, "-l", "timing"),
|
|
|
|
|
|
2017-10-04 14:22:25 +02:00
|
|
|
// make it fork just like regular test running
|
|
|
|
|
fork in ValidatePR := (fork in Test).value,
|
|
|
|
|
testGrouping in ValidatePR := (testGrouping in Test).value,
|
|
|
|
|
javaOptions in ValidatePR := (javaOptions in Test).value,
|
|
|
|
|
|
2019-01-15 12:23:27 +11:00
|
|
|
prValidatorTasks := Seq(test in ValidatePR) ++ additionalTasks.value,
|
|
|
|
|
prValidatorEnforcedBuildAllTasks := Seq(test in Test) ++ additionalTasks.value
|
2017-10-30 03:13:14 +02:00
|
|
|
)
|
2015-01-22 20:26:34 +02:00
|
|
|
}
|
2015-05-21 09:48:49 +03:00
|
|
|
|
|
|
|
|
/**
|
2017-10-30 03:13:14 +02:00
|
|
|
* This autoplugin adds Multi Jvm tests to validatePullRequest task.
|
|
|
|
|
* It is needed, because ValidatePullRequest autoplugin does not depend on MultiNode and
|
|
|
|
|
* therefore test:executeTests is not yet modified to include multi-jvm tests when ValidatePullRequest
|
|
|
|
|
* build strategy is being determined.
|
|
|
|
|
*
|
|
|
|
|
* Making ValidatePullRequest depend on MultiNode is impossible, as then ValidatePullRequest
|
|
|
|
|
* autoplugin would trigger only on projects which have both of these plugins enabled.
|
|
|
|
|
*/
|
2015-05-21 09:48:49 +03:00
|
|
|
object MultiNodeWithPrValidation extends AutoPlugin {
|
2019-01-15 12:23:27 +11:00
|
|
|
import AkkaValidatePullRequest._
|
2018-06-27 07:04:05 +02:00
|
|
|
import com.typesafe.sbt.MultiJvmPlugin.MultiJvmKeys.MultiJvm
|
2019-01-15 12:23:27 +11:00
|
|
|
|
2015-05-21 09:48:49 +03:00
|
|
|
override def trigger = allRequirements
|
2019-01-15 12:23:27 +11:00
|
|
|
override def requires = AkkaValidatePullRequest && MultiNode
|
2016-11-29 08:33:36 +01:00
|
|
|
override lazy val projectSettings =
|
2019-01-15 12:23:27 +11:00
|
|
|
if (MultiNode.multiNodeTestInTest) Seq(additionalTasks += MultiNode.multiTest)
|
2018-06-27 07:04:05 +02:00
|
|
|
else Seq.empty
|
2015-05-21 09:48:49 +03:00
|
|
|
}
|
|
|
|
|
|
2016-03-10 10:45:35 +02:00
|
|
|
/**
|
2017-10-30 03:13:14 +02:00
|
|
|
* This autoplugin adds MiMa binary issue reporting to validatePullRequest task,
|
|
|
|
|
* when a project has MimaPlugin autoplugin enabled.
|
|
|
|
|
*/
|
2016-03-10 10:45:35 +02:00
|
|
|
object MimaWithPrValidation extends AutoPlugin {
|
2019-01-15 12:23:27 +11:00
|
|
|
import AkkaValidatePullRequest._
|
2016-03-10 10:45:35 +02:00
|
|
|
|
|
|
|
|
override def trigger = allRequirements
|
2019-01-15 12:23:27 +11:00
|
|
|
override def requires = AkkaValidatePullRequest && MimaPlugin
|
2019-09-30 12:40:22 +02:00
|
|
|
override lazy val projectSettings =
|
|
|
|
|
CliOptions.mimaEnabled.ifTrue(additionalTasks += mimaReportBinaryIssues).toList
|
2017-10-30 03:13:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This autoplugin adds Paradox doc generation to validatePullRequest task,
|
|
|
|
|
* when a project has ParadoxPlugin autoplugin enabled.
|
|
|
|
|
*/
|
|
|
|
|
object ParadoxWithPrValidation extends AutoPlugin {
|
2019-01-15 12:23:27 +11:00
|
|
|
import AkkaValidatePullRequest._
|
2017-10-30 03:13:14 +02:00
|
|
|
|
|
|
|
|
override def trigger = allRequirements
|
2019-01-15 12:23:27 +11:00
|
|
|
override def requires = AkkaValidatePullRequest && ParadoxPlugin
|
2017-10-30 03:13:14 +02:00
|
|
|
override lazy val projectSettings = Seq(
|
2019-01-15 12:23:27 +11:00
|
|
|
additionalTasks += paradox in Compile
|
2017-10-30 03:13:14 +02:00
|
|
|
)
|
2016-03-10 10:45:35 +02:00
|
|
|
}
|
|
|
|
|
|
2015-05-21 09:48:49 +03:00
|
|
|
object UnidocWithPrValidation extends AutoPlugin {
|
2019-01-15 12:23:27 +11:00
|
|
|
import AkkaValidatePullRequest._
|
2015-05-21 09:48:49 +03:00
|
|
|
|
|
|
|
|
override def trigger = noTrigger
|
|
|
|
|
override lazy val projectSettings = Seq(
|
2019-01-15 12:23:27 +11:00
|
|
|
additionalTasks += unidoc in Compile
|
2017-10-30 03:13:14 +02:00
|
|
|
)
|
2015-05-21 09:48:49 +03:00
|
|
|
}
|