Skip to content
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

Project with multiple scala versions #393

Open
arjantop opened this issue Jan 16, 2018 · 6 comments
Open

Project with multiple scala versions #393

arjantop opened this issue Jan 16, 2018 · 6 comments

Comments

@arjantop
Copy link

It it currently possible to have a single project with multiple scala versions? Spark (for example) is one of the projects that lags behind in supported scala versions. So that one team could be using scala 2.12 and the other 2.11 with spark.

@johnynek
Copy link
Member

There is no support for this now, and it would be non-trivial.

What we do at Stripe is have separate repositories for scala 2.11 and 2.12 code. There is a 2.12 branch of these rules:
https://github.com/bazelbuild/rules_scala/tree/scala2_12

@arjantop
Copy link
Author

Thanks, just researching and evaluating bazel. We had such multiple scala versions mess in the past.

@pauldraper
Copy link

pauldraper commented Sep 7, 2018

FYI, brief description of how https://github.com/andyscott/rules_scala_annex decided to implement multiple Scala versions in a single workspace:

A ScalaConfiguration provider.

ScalaConfiguration = provider(
    fields = {
        "compiler_classpath": "the compiler classpath",
        "runtime_classpath": "the minimal runtime classpath",
    },
)

And an easy way for users to define Scala versions.

# define @scala
scala_repository("scala", ("org.scala-lang", "2.12.4"), "@compiler_bridge_2_12//:src")

And all scala_* rules have a scala attribute that requires a ScalaConfiguration. The attribute defaults to @scala, but you could specify @scala_2_11, @scala_2_12, @scala_dotty, @scala_lightbend, etc. explicitly for each target. Nothing real fancy....there's no checks for matching Scala versions, or any cross-compilation help.

Actually, an example of use is rules_scala_annex's own runners (scalac, scalafmt, proto). They have deps and certain Scala version requirements, and so they use a Scala version (@scala_annex_scala_2_12) isolated from the user's choice of Scala version.

@arjantop
Copy link
Author

arjantop commented Oct 3, 2018

@pauldraper Are there plans to eventually merge the two efforts?

@pauldraper
Copy link

No clear plan as of this time; I just wanted to share a possible approach for this project.

@ittaiz
Copy link
Member

ittaiz commented Oct 3, 2018 via email

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

No branches or pull requests

4 participants