Skip to content

Introduce new scalaVersionsByJvm setting #18

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

Merged
merged 3 commits into from
Apr 20, 2017
Merged

Conversation

lrytz
Copy link
Member

@lrytz lrytz commented Apr 20, 2017

Make it easier for modules to use multiple Scala versions depending on the JVM version. Example config in a module:

// Map[JvmVersion, List[(ScalaVersion, UseForPublishing)]]
scalaVersionsByJvm := {
  val v211 = "2.11.8"
  val v212 = "2.12.2"

  Map(
    6 -> List(v211 -> true),
    7 -> List(v211 -> false),
    8 -> List(v212 -> true, v211 -> false),
    9 -> List(v212 -> false, v211 -> false)
  )
}

This will set crossScalaVersions according to the JVM version. If the TRAVIS_TAG environment variable is defined and we're publishing a release, the selection of Scala versions is filtered accordingly.

@lrytz
Copy link
Member Author

lrytz commented Apr 20, 2017

CC @gourlaysama, suggestions welcome.

@SethTisue
Copy link
Member

SethTisue commented Apr 20, 2017

cc our other module maintainers: @benhutchison @danslapman @ashawley @biswanaths (it would be good if y'all watched this repo if you aren't already — it's low-noise)

@danslapman
Copy link

Looks nice, I like the concept!

@lrytz
Copy link
Member Author

lrytz commented Apr 20, 2017

I've tested this with scala-continuations and scala-swing, seems to work fine. I'll merge and publish a new release of this plugin.

@lrytz lrytz merged commit ab80996 into scala:master Apr 20, 2017
@ashawley
Copy link
Member

Will this change be compatible with the scalajs plugin?

@lrytz
Copy link
Member Author

lrytz commented Apr 21, 2017

That's also a good question!

I'll look at the scala-xml repo and see what needs to be done to make sure it works fine in scala-xml.

@lrytz
Copy link
Member Author

lrytz commented Apr 21, 2017

Another problem is in the https://github.com/scala/scala-parallel-collections build which only sets scalaModuleSettings for one of its sub-projects. So setting scalaVersionsByJvm (leaving scalaVersion / crossScalaVersions undefined) leads to this:

> scalaVersion
[info] testmacros/*:scalaVersion
[info] 	2.10.6
[info] scalacheck/*:scalaVersion
[info] 	2.10.6
[info] junit/*:scalaVersion
[info] 	2.10.6
[info] core/*:scalaVersion
[info] 	2.13.0-M1
[info] scala-parallel-collections/*:scalaVersion
[info] 	2.10.6

Maybe instead of making it a setting, I better define a method that the module builds can invoke when setting crossScalaVersions.

@ashawley
Copy link
Member

ashawley commented Apr 21, 2017

I'll look at the scala-xml repo and see what needs to be done to make sure it works fine in scala-xml.

So far I have

scalaVersionsByJvm := {
  val v213 = "2.13.0-M1"
  val v212 = "2.12.2"
  val v211 = "2.11.11"
  val vs = List(v213, v212, v211)
  // Map[JvmMajorVersion, List[(ScalaVersion, UseForPublishing)]]
  Map(
    6 -> List(v211 -> true),
    7 -> List(v211 -> false),
    8 -> List(v213 -> true, v212 -> true, v211 -> false),
    9 -> vs.map(_ -> false)
  )
}

But I get

[error] No Scala version for Java major version 8. Adjust `scalaVersionsByJvm` in build.sbt

ashawley added a commit to ashawley/scala-xml that referenced this pull request Apr 21, 2017
- Update scala-module-plugin to 1.0.6
- Use scalaVersionsByJvm to set crossScalaVersions and scalaVersion
- Based on scala/scala-swing#60
- Motivated by scala/sbt-scala-module#18
ashawley added a commit to ashawley/scala-xml that referenced this pull request Apr 21, 2017
- Update scala-module-plugin to 1.0.6
- Use scalaVersionsByJvm to set crossScalaVersions and scalaVersion
- Based on scala/scala-swing#60
- Motivated by scala/sbt-scala-module#18
ashawley added a commit to ashawley/scala-xml that referenced this pull request Apr 21, 2017
- Update scala-module-plugin to 1.0.6
- Use scalaVersionsByJvm to set crossScalaVersions and scalaVersion
- Based on scala/scala-swing#60
- Motivated by scala/sbt-scala-module#18
@sjrd
Copy link
Member

sjrd commented Apr 22, 2017

I don't see anything in here that would interfere with sbt-scalajs. I could be overlooking something, of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants