Validate compile in multi-jvm (#26400)

* New validateCompile task for multi jvm to run in travis
This commit is contained in:
Christopher Batey 2019-03-12 11:43:02 +00:00 committed by Patrik Nordwall
parent 6394b979bd
commit 2e247001f7
3 changed files with 12 additions and 4 deletions

View file

@ -30,7 +30,7 @@ cache:
script:
- jabba use "adopt@~1.8.202-08"
# need to override as the default is to test
- sbt -jvm-opts .jvmopts-travis ";++$TRAVIS_SCALA_VERSION update ;++$TRAVIS_SCALA_VERSION mimaReportBinaryIssues ;++$TRAVIS_SCALA_VERSION test:compile"
- sbt -jvm-opts .jvmopts-travis ";++$TRAVIS_SCALA_VERSION update ;++$TRAVIS_SCALA_VERSION mimaReportBinaryIssues ;++$TRAVIS_SCALA_VERSION test:compile ;++$TRAVIS_SCALA_VERSION validateCompile"
# make 'git branch' work again
- git branch -f "$TRAVIS_BRANCH" && git checkout "$TRAVIS_BRANCH"
# check policies, if on master also upload

View file

@ -534,7 +534,7 @@ def commandValue(p: Project, externalTest: Option[Project] = None) = {
val test = externalTest.getOrElse(p)
val optionalMima = if (p.id.endsWith("-typed")) "" else s";${p.id}/mimaReportBinaryIssues"
val optionalExternalTestFormat = externalTest.map(t => s";${t.id}/scalafmtAll").getOrElse("")
s";${p.id}/scalafmtAll$optionalExternalTestFormat;${test.id}/test:compile$optionalMima;${docs.id}/paradox"
s";${p.id}/scalafmtAll$optionalExternalTestFormat;${test.id}/test:compile$optionalMima;${docs.id}/paradox;${test.id}:validateCompile"
}
addCommandAlias("allActor", commandValue(actor, Some(actorTests)))
addCommandAlias("allRemote", commandValue(remote, Some(remoteTests)))

View file

@ -15,6 +15,11 @@ import org.scalafmt.sbt.ScalafmtPlugin.scalafmtConfigSettings
object MultiNode extends AutoPlugin {
object autoImport {
val validateCompile = taskKey[Unit]("Validates compile for any project it is enabled")
}
import autoImport._
// MultiJvm tests can be excluded from normal test target an validatePullRequest
// with -Dakka.test.multi-in-test=false
val multiNodeTestInTest: Boolean =
@ -55,6 +60,10 @@ object MultiNode extends AutoPlugin {
"-Xmx256m" :: akkaProperties ::: CliOptions.sbtLogNoFormat.ifTrue("-Dakka.test.nocolor=true").toList
}
private val anyConfigsInThisProject = ScopeFilter(
configurations = inAnyConfiguration
)
private val multiJvmSettings =
SbtMultiJvm.multiJvmSettings ++
inConfig(MultiJvm)(scalafmtConfigSettings) ++
@ -99,8 +108,7 @@ object MultiNode extends AutoPlugin {
(headerCreate in MultiJvm).value
(compile in MultiJvm).value
}) ++ headerSettings(MultiJvm) ++ Seq(
// only works if I put it here ¯\_()_/¯
compile in MultiJvm := ((compile in MultiJvm).triggeredBy(compile in Test)).value
validateCompile := compile.?.all(anyConfigsInThisProject).value
)