1

I'm trying to cross-build an sbt plugin between 0.13 and 1.1. To accomplish this I need to use different libraryDependencies for the different builds, but I can't find a way to access the current build's target sbt version.

Back when the cross compilation was in a plugin there was CrossBuilding.pluginSbtVersion but I can't find anything similar anymore.

  • sbtVersion.value always gives me 0.13.16
  • (sbtVersion in sbtPlugin) likewise
  • crossVersion always gives me Binary
  • scalaBinaryVersion always gives me 2.10

How can I do this?

tjarvstrand
  • 836
  • 9
  • 20

2 Answers2

0

you can use the following code:

libraryDependencies ++= {
  sbtBinaryVersion.value match {
    case "0.13" => Seq(...)
    case "1.0" => Seq(...)
  }
}

make sure to run your sbt commands with ^, to run command on all sbt versions, ie:

sbt "^compile"
lev
  • 3,986
  • 4
  • 33
  • 46
0

It turns out the solution was present in sbt's output all along:

[info] Setting `sbtVersion in pluginCrossBuild` to 1.1.2

I just had to use (sbtBinaryVersion in pluginCrossBuild).value

tjarvstrand
  • 836
  • 9
  • 20