-
Notifications
You must be signed in to change notification settings - Fork 277
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
multiscala configuration #964
Conversation
I am generally very much in favor of this functionality. That being said, I believe providers [0]-- not toolchains-- are the right long term approach for supporting this and my fear is that merging this complicates some of the existing cleanup and feature work that's already underway. I haven't had a chance to lay out my arguments for ditching toolchains in favor of providers, so perhaps we need to finally kick off that discussion. WDYT @ittaiz? [0] I've explored the provider approach in https://github.com/higherkindness/rules_scala. I believe this approach can be improved and simplified. |
Turns out I made some mistakes on the native toolchain name vs. the implementtion name. Not for the first time. Also had to add TemplateVariableInfo to the core scala_toolchain as required when using the standard toolchains attr. Simply initialized it with an empty map (not really familiar with this provider ...)
A few thoughts: You can think of this whole effort as a couple of big pieces. One is the tool/provider construction, execution and dependency management. The other is the configuration and use issue, independent of how the tools are structured and managed. Things like do I have to explicitly ask for every target in every version I care about? I started with a POC where I just copied and hard-coded the versions I wanted. I moved on to explicit starlark loops for every target. That's feasible but that's when I determined that IMNSHO that would be too big a barrier: it's just too much to ask every build file to become a shim to a starlark file with a loop. I would hate that. It'd be one thing if that was the only choice but we can automate that away, so most people don't have to learn much starlark and also removes a lot of boilerplate. I'm working on a simple example of that to show soon. The configuration and use stuff is, to a great extent, independent of how the tools are structured and managed. It has to be implemented against that stuff but that's moderately easily changeable and the API to the user doesn't need to change. I had seen the Looking at it now, it's not clear to me how different it is from a standard toolchain. If I think pretty much everything that can be done without toolchains can be done with toolchains in the areas we're talking about. IIUC, the primary difference is the extra behavior for toolchains built in to bazel, in particular toolchain resolution, e.g., So it really comes down to factoring of dependencies and configurations, and I'm looking at that. For example, it took a bit of work to factor things so that the various tools in One thing I'm not particularly comfortable/familiar with is the host/execution/target stuff. AFAICT, we're somewhat isolated from that because everything is on the JVM. Looking forward to more/others thoughts. |
smparkes#2 is a pull request against this PR that shows early work on the |
This moves the scalac attr to the toolchain so it can be overriden by different toolchain implementations. It also adds a `ScalaInfo` provider level for scala_toolchain to follow the pattern in the scala docs (rather than flattening into the ToolchainInfo).
…nto factor-toolchains
At this point, there's not enough need/support for this (including myself) to continue forward. |
Please look at #962 and consider earlier uncommitted PRs first. This PR is based on those PRs and will give you smaller PRs to review.
Description
This is the first PR for #962 . It creates/uses the configuration structure necessary to configure multiple scala toolchains but at this point only uses the default toolchain.
Changes to
multiscala
unstable/multiscala
@io_bazel_rules_scala_configuration
repomaven_install
rules_scala
dependencies based on@io_bazel_rules_scala_configuration
bind
aliases forrules_scala
dependencies when there is a default scala versionscala_toolchain
for configured versionsscala_toolchain
if there is a configured default versionunstable/multiscala/private/example
which can be run withbazel build :all && bazel run :all
Changes to stable code
scala_toolchain
. Required when used as the value for the standardtoolchains
attrbind
ings so that they can also be configured inmultiscala
. Although I think long term we may want to remove all bindings, for now they're key to makingmultiscala
opt-in.Motivation
First step in being able to configure multiple toolchains based on a configuration with multiple scala versions.
This creates the toolchains but doesn't, at this point, use them. That will come in a subsequent PR.