Skip to content

Commit

Permalink
run scripted tests against entire build matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
dwickern committed Apr 18, 2021
1 parent c0a2e65 commit 9f83875
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 30 deletions.
57 changes: 30 additions & 27 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
import PlayAxis.RichProjectMatrix

ThisBuild / organization := "com.github.dwickern"

lazy val play27 = ConfigAxis("play27", "play2.7")
lazy val play28 = ConfigAxis("play28", "play2.8")
lazy val play288 = ConfigAxis("play288", "play2.8.8")
lazy val play27 = PlayAxis("2.7.9")
lazy val play28 = PlayAxis("2.8.7")
lazy val play288 = PlayAxis("2.8.8")

lazy val scala212 = "2.12.13"
lazy val scala213 = "2.13.4"

lazy val swaggerPlayVersion = "3.1.0"

lazy val root = (project in file("."))
.aggregate(plugin, testPlugin)
.aggregate(plugin.projectRefs: _*)
.aggregate(runner.projectRefs: _*)
.aggregate(testPlugin)
.settings(
name := "sbt-swagger-play",
publish / skip := true
)

lazy val plugin = (project in file("sbt-plugin"))
.enablePlugins(BuildInfoPlugin)
.enablePlugins(ScriptedPlugin)
lazy val plugin = (projectMatrix in file("sbt-plugin"))
.customRow(
autoScalaLibrary = false,
axisValues = Seq(VirtualAxis.jvm),
_.enablePlugins(BuildInfoPlugin).settings(
publishSettings,
name := "sbt-swagger-play",
sbtPlugin := true,
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.9" % Provided),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "com.github.dwickern.sbt",
)
)
.settings(
publishSettings,
name := "sbt-swagger-play",
sbtPlugin := true,
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.9" % Provided),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "com.github.dwickern.sbt",
scriptedLaunchOpts ++= Seq(
"-Xmx1024M",
s"-Dplugin.version=${version.value}",
"-Dplay.version=2.8.8",
"-Dscala.version=2.13.3"
),
scriptedDependencies := {
def use(@deprecated("unused", "") x: Any*): Unit = () // avoid unused warnings
use(
scriptedDependencies.value,
(testPlugin / publishLocal).value,
runner.projectRefs.map(_ / publishLocal).join.value
)
},
scriptedDependencies := Def.task(())
.dependsOn(testPlugin / publishLocal)
.dependsOn(runner.projectRefs.map(_ / publishLocal).join)
.value
)
.scriptedTests(play288, scala213)
.scriptedTests(play288, scala212)
.scriptedTests(play28, scala213)
.scriptedTests(play28, scala212)
.scriptedTests(play27, scala213)
.scriptedTests(play27, scala212)

lazy val testPlugin = (project in file("test-plugin"))
.settings(
Expand Down
3 changes: 0 additions & 3 deletions project/ConfigAxis.scala

This file was deleted.

32 changes: 32 additions & 0 deletions project/PlayAxis.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import sbtide.Keys.ideSkipProject
import sbt.Keys._
import sbt.ScriptedPlugin.autoImport._
import sbt._
import sbt.internal.ProjectMatrix

case class PlayAxis(version: String, idSuffix: String, directorySuffix: String) extends VirtualAxis.WeakAxis

object PlayAxis {
def apply(version: String): PlayAxis =
PlayAxis(version, "-play" + version.replace('.', '_'), "-play" + version)

implicit class RichProjectMatrix(val matrix: ProjectMatrix) extends AnyVal {
def scriptedTests(playAxis: PlayAxis, scalaVersion: String): ProjectMatrix = matrix.customRow(
autoScalaLibrary = false,
axisValues = Seq(playAxis, VirtualAxis.scalaPartialVersion(scalaVersion), VirtualAxis.jvm),
_.enablePlugins(ScriptedPlugin).settings(
compile / skip := true,
publish / skip := true,
ideSkipProject := true,
moduleName := s"${moduleName.value}-test-${playAxis.version}-$scalaVersion",
scriptedLaunchOpts ++= Seq(
"-Xmx1024M",
s"-Dplugin.version=${version.value}",
s"-Dscala.version=$scalaVersion",
s"-Dplay.version=${playAxis.version}"
),
scriptedBufferLog := true
)
)
}
}
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.2")
addSbtPlugin("org.jetbrains" % "sbt-ide-settings" % "1.1.0")

libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value

0 comments on commit 9f83875

Please sign in to comment.