sbt / sbt-projectmatrix

MIT License
124 stars 14 forks source link

jvmPlatform not a member of sbt.Project #46

Closed BoopBoopBeepBoop closed 3 years ago

BoopBoopBeepBoop commented 3 years ago

Hi Eugene,

Thanks for all your work on sbt! I'm trying to get this plugin integrated into some of our projects & seeing failures resolving the .jvmPlatform function. Was wondering if there is something that we need to import, or if I've missed a step somewhere.

project/plugins.sbt
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.7.0")
build.sbt

name := "tmpproj"
version := "0.1"
scalaVersion := "2.13.5"

val scalaVersions = Seq("2.12.10", "2.13.5")

lazy val projectRefs = Seq("core", "ext").map(LocalProject)

lazy val root = project
  .in(file("."))
  .settings(
    skip in publish := true
  ).aggregate(projectRefs:_*)

lazy val core = (project in file("core"))
  .jvmPlatform(scalaVersions)

lazy val ext = (project in file("ext"))
  .jvmPlatform(scalaVersions)

SBT output:

[info] welcome to sbt 1.4.7 (N/A Java 15.0.1)
[info] loading global plugins from /Users/slink/.sbt/1.0/plugins
[info] loading settings for project tmpproj-build from plugins.sbt ...
[info] loading project definition from /Users/slink/projects/tmpproj/project
/Users/slink/projects/tmpproj/build.sbt:18: error: value jvmPlatform is not a member of sbt.Project
possible cause: maybe a semicolon is missing before `value jvmPlatform'?
  .jvmPlatform(scalaVersions)
   ^
/Users/slink/projects/tmpproj/build.sbt:21: error: value jvmPlatform is not a member of sbt.Project
possible cause: maybe a semicolon is missing before `value jvmPlatform'?
  .jvmPlatform(scalaVersions)
   ^
sbt.compiler.EvalException: Type error in expression
[error] sbt.compiler.EvalException: Type error in expression
[error] Use 'last' for the full log.
keynmol commented 3 years ago

Hi!

The important bit is that this plugin doesn't add methods on the Project - it defines its own ProjectMatrix:

lazy val core = (projectMatrix in file("core"))
  .settings(
    name := "core"
  )
  .jvmPlatform(scalaVersions = Seq("2.13.3", "2.12.12"))

The important bit is here:

projectMatrix in file("core")

using that instead of project

BoopBoopBeepBoop commented 3 years ago

Ahhhh that explains it. Thanks, that fixed it