-
Notifications
You must be signed in to change notification settings - Fork 936
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
Cross-build commands for plugins do not work if plugins are subprojects #3473
Comments
Here's an interesting workaround by @jroper - sbt/sbt-pgp@97180d3: // Because we're both a library and an sbt plugin, we use crossScalaVersions rather than crossSbtVersions for
// cross building. So you can use commands like +scripted.
crossScalaVersions := Seq("2.10.6", "2.12.3"),
sbtVersion in pluginCrossBuild := {
scalaBinaryVersion.value match {
case "2.10" => "0.13.16"
case "2.12" => "1.0.0"
}
}, |
The way I see it, the sbt cross building support is a convenience for when you just have one project that's an sbt plugin. I don't think there's a straight forward fix for making it work when you have a mixture of sbt plugins and regular libraries - what does it mean to cross build something that isn't an sbt plugin against multiple versions of sbt? In many situations you may want to cross build the library against Scala 2.10, 2.11 and 2.12. How do you cross build part of the project against different Scala versions, and another part against different sbt versions? How would sbt know to line up which scala versions with which sbt versions in order to make sure everything resolves correctly? I don't think there's any straight forward way. At the end of the day, both sbt and Scala cross building is a bit of a hack, and even with the improvements in Scala cross building in sbt 1.0, there are still scenarios that don't work well. So I'd be inclined to say that the resolution to this is to document the limitation, and say it's by design. The above work around will work as long as sbt versions can be differentiated by Scala versions. That assumption might not always hold, but it does hold now and there's not going to be a new major sbt version for a long time so I don't think it's something we need to worry too much about, we can tackle that problem if and when it happens in the future. |
I agree.
Right. We have the "extra" |
I'm not sure why are you talking about regular libraries. My project (and the example above) consists only of SBT plugins; there are no libraries in it. The root project is used solely for aggregation and its build results, if any, are completely ignored. It's just it is really unfeasible to split our set of plugins into multiple builds, because they are intended to work together (with some being optional), as well as to simplify the way they are built and published. |
Have you tried setting |
No, I didn't; because it is not really a plugin, it didn't even occur to me. I'll try it and report asap. |
Still does not work. |
I guess then that this can probably be fixed fairly easily (note, I didn't write the code and I've barely looked at it, I've been far more involved in the Scala cross building support, but both features are very similar in nature), but in the mean time I would recommend using the word around above. |
The workaround in #3473 (comment) is preferable to It would be great to update the documentation on cross-building sbt plugins. The top hit on Google leads to the outdated document https://www.scala-sbt.org/1.0/docs/Cross-Build-Plugins.html recommending to set |
steps
^^0.13.16
in the SBT console:pluginCrossBuild::sbtVersion
is correct):Not sure if
sbtVersion
being not set to0.13.16
is a problem, but it is not updated as well:problem
The Scala version is not changed for child projects. The compilation fails with various errors about macros being compiled for invalid version of Scala.
expectation
Scala version is changed correctly, and I'm able to cross-build all of the plugins in the build.
notes
If you go into a particular project, then it works:
sbt version: 1.0.0
The text was updated successfully, but these errors were encountered: