From 2faf8c6a68400eb18e296ac3ac34bdb35f05c483 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 9 May 2019 08:46:02 -0400 Subject: [PATCH] move Scala version into row definition --- build.sbt | 2 +- src/main/scala/sbt/ProjectMatrix.scala | 26 ++++++++++++------------ src/sbt-test/projectMatrix/js/build.sbt | 6 ++---- src/sbt-test/projectMatrix/jvm/build.sbt | 6 ++---- 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/build.sbt b/build.sbt index 5252f3387..bc7908c69 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,5 @@ ThisBuild / organization := "com.eed3si9n" -ThisBuild / version := "0.1.0-SNAPSHOT" +ThisBuild / version := "0.2.0-SNAPSHOT" ThisBuild / description := "sbt plugin to define project matrix for cross building" ThisBuild / licenses := Seq("MIT License" -> url("https://github.com/sbt/sbt-projectmatrix/blob/master/LICENSE")) diff --git a/src/main/scala/sbt/ProjectMatrix.scala b/src/main/scala/sbt/ProjectMatrix.scala index 9ae8fa8cd..1008eb25a 100644 --- a/src/main/scala/sbt/ProjectMatrix.scala +++ b/src/main/scala/sbt/ProjectMatrix.scala @@ -12,16 +12,13 @@ import sbt.librarymanagement.CrossVersion.partialVersion * * {{{ * lazy val core = (projectMatrix in file("core")) - * .scalaVersions("2.12.6", "2.11.12") * .settings( * name := "core" * ) - * .jvmPlatform() + * .jvmPlatform(Seq("2.12.6", "2.11.12")) * }}} */ sealed trait ProjectMatrix extends CompositeProject { - def scalaVersions(sv: String*): ProjectMatrix - def id: String /** The base directory for the project matrix.*/ @@ -63,11 +60,13 @@ sealed trait ProjectMatrix extends CompositeProject { process: Project => Project ): ProjectMatrix - def jvmPlatform(settings: Setting[_]*): ProjectMatrix + def jvmPlatform(scalaVersions: Seq[String]): ProjectMatrix + def jvmPlatform(scalaVersions: Seq[String], settings: Seq[Setting[_]]): ProjectMatrix def jvm: ProjectFinder - def jsPlatform(settings: Setting[_]*): ProjectMatrix + def jsPlatform(scalaVersions: Seq[String]): ProjectMatrix + def jsPlatform(scalaVersions: Seq[String], settings: Seq[Setting[_]]): ProjectMatrix def js: ProjectFinder @@ -181,9 +180,6 @@ object ProjectMatrix { override def configs(cs: Configuration*): ProjectMatrix = copy(configurations = configurations ++ cs) - override def scalaVersions(sv: String*): ProjectMatrix = - copy(scalaVersions = sv) - override def aggregate(refs: ProjectMatrixReference*): ProjectMatrix = copy(aggregate = (aggregate: Seq[ProjectMatrixReference]) ++ refs) @@ -202,11 +198,15 @@ object ProjectMatrix { def setPlugins(ns: Plugins): ProjectMatrix = copy(plugins = ns) - override def jvmPlatform(settings: Setting[_]*): ProjectMatrix = - custom(jvmIdSuffix, jvmDirectorySuffix, Nil, { _.settings(settings) }) + override def jvmPlatform(scalaVersions: Seq[String]): ProjectMatrix = + jvmPlatform(scalaVersions, Nil) + override def jvmPlatform(scalaVersions: Seq[String], settings: Seq[Setting[_]]): ProjectMatrix = + custom(jvmIdSuffix, jvmDirectorySuffix, scalaVersions, { _.settings(settings) }) - override def jsPlatform(settings: Setting[_]*): ProjectMatrix = - custom(jsIdSuffix, jsDirectorySuffix, Nil, { _.settings(settings) }) + override def jsPlatform(scalaVersions: Seq[String]): ProjectMatrix = + jsPlatform(scalaVersions, Nil) + override def jsPlatform(scalaVersions: Seq[String], settings: Seq[Setting[_]]): ProjectMatrix = + custom(jsIdSuffix, jsDirectorySuffix, scalaVersions, { _.settings(settings) }) override def jvm: ProjectFinder = new SuffixBaseProjectFinder(jvmIdSuffix) diff --git a/src/sbt-test/projectMatrix/js/build.sbt b/src/sbt-test/projectMatrix/js/build.sbt index 4263f054a..9300a02ef 100644 --- a/src/sbt-test/projectMatrix/js/build.sbt +++ b/src/sbt-test/projectMatrix/js/build.sbt @@ -4,16 +4,14 @@ // ) lazy val core = (projectMatrix in file("core")) - .scalaVersions("2.12.6", "2.11.12") .settings( name := "core" ) - .jsPlatform() + .jsPlatform(scalaVersions = Seq("2.12.8", "2.11.12")) lazy val app = (projectMatrix in file("app")) .dependsOn(core) - .scalaVersions("2.12.6") .settings( name := "app" ) - .jsPlatform() + .jsPlatform(scalaVersions = Seq("2.12.8")) diff --git a/src/sbt-test/projectMatrix/jvm/build.sbt b/src/sbt-test/projectMatrix/jvm/build.sbt index 19a0b6165..7cf2133f6 100644 --- a/src/sbt-test/projectMatrix/jvm/build.sbt +++ b/src/sbt-test/projectMatrix/jvm/build.sbt @@ -4,16 +4,14 @@ // ) lazy val core = (projectMatrix in file("core")) - .scalaVersions("2.12.6", "2.11.12") .settings( name := "core" ) - .jvmPlatform() + .jvmPlatform(scalaVersions = Seq("2.12.8", "2.11.12")) lazy val app = (projectMatrix in file("app")) .dependsOn(core) - .scalaVersions("2.12.6") .settings( name := "app" ) - .jvmPlatform() + .jvmPlatform(scalaVersions = Seq("2.12.8"))