Merge pull request #8 from sbt/wip/scalaVersion

move Scala version into row definition
This commit is contained in:
eugene yokota 2019-05-09 09:19:55 -04:00 committed by GitHub
commit 0ccc8b84e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 27 deletions

View File

@ -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"))

View File

@ -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)

View File

@ -9,24 +9,23 @@ ThisBuild / ivyPaths := {
publish / skip := true
lazy val core = (projectMatrix in file("core"))
.scalaVersions("2.12.6", "2.11.12")
.settings(
name := "core",
ivyPaths := (ThisBuild / ivyPaths).value
)
.custom(
idSuffix = "config1_2_",
idSuffix = "Config1_2",
directorySuffix = "-config1.2",
scalaVersions = Nil,
scalaVersions = Seq("2.12.8", "2.11.12"),
_.settings(
moduleName := name.value + "_config1.2",
libraryDependencies += "com.typesafe" % "config" % "1.2.1"
)
)
.custom(
idSuffix = "config1_3_",
idSuffix = "Config1_3",
directorySuffix = "-config1.3",
scalaVersions = Nil,
scalaVersions = Seq("2.12.8", "2.11.12"),
_.settings(
moduleName := name.value + "_config1.3",
libraryDependencies += "com.typesafe" % "config" % "1.3.3"

View File

@ -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"))

View File

@ -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"))