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

run scripted tests against entire build matrix #8

Merged
merged 4 commits into from
Nov 4, 2023
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
62 changes: 39 additions & 23 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,47 +1,63 @@
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(pluginTests.projectRefs: _*)
.aggregate(runner.projectRefs: _*)
.aggregate(testPlugin)
.settings(
name := "sbt-swagger-play",
publish / skip := true
)

lazy val plugin = (project in file("sbt-plugin"))
.enablePlugins(BuildInfoPlugin)
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",
)
)

lazy val pluginTests = plugin
.enablePlugins(ScriptedPlugin)
.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",
compile / skip := true,
publish / skip := true,
ideSkipProject.withRank(KeyRanks.Invisible) := true,
scriptedLaunchOpts ++= Seq(
"-Xmx1024M",
s"-Dplugin.version=${version.value}",
"-Dplay.version=2.8.8",
"-Dscala.version=2.13.3"
s"-Dplugin.version=${version.value}"
),
scriptedDependencies := {
def use(@deprecated("unused", "") x: Any*): Unit = () // avoid unused warnings
use(
scriptedDependencies.value,
(testPlugin / publishLocal).value,
runner.projectRefs.map(_ / publishLocal).join.value
)
},
scriptedBufferLog := true,
scriptedDependencies := Def.task(())
.dependsOn(plugin.jvm(false) / publishLocal)
.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.

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

case class PlayAxis(version: String) extends VirtualAxis.WeakAxis {
val directorySuffix: String = "-play" + version
val idSuffix: String = directorySuffix.replace('.', '_')
}

object PlayAxis {
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),
_.settings(
scriptedLaunchOpts ++= Seq(
s"-Dscala.version=$scalaVersion",
s"-Dplay.version=${playAxis.version}"
)
)
)
}
}
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
Loading