Skip to content

Insulate toolchain options from breaking rules_scala bootstrap code #432

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

Open
andyscott opened this issue Mar 1, 2018 · 9 comments
Open

Comments

@andyscott
Copy link
Contributor

andyscott commented Mar 1, 2018

Downstream workspaces using a custom Scala toolchain can't use the scala_test rule with certain Scala compiler flags enabled.

It seems custom Scala toolchains will be used to compile the bootstrapping Scala code in rules_scala for running scala tests. In particular, flags to enable fatal warnings and warnings on unused imports cause scala_test to be unusable.

A short term fix is to clean up these bootstrapping files so that they work under strict Scala compiler flags. I took a look at a more thorough solution but I couldn't come up with anything quickly.

@andyscott andyscott changed the title Toolchain isolation for scalac optoins Toolchain isolation for scalac options Mar 1, 2018
@andyscott andyscott changed the title Toolchain isolation for scalac options Toolchain per-workspace isolation for scalac options Mar 1, 2018
@ittaiz
Copy link
Contributor

ittaiz commented Mar 1, 2018 via email

@johnynek
Copy link
Contributor

johnynek commented Mar 1, 2018

+1 for more strictness by default.

@andyscott andyscott changed the title Toolchain per-workspace isolation for scalac options Insulate toolchain options from breaking rules_scala bootstrap code Mar 1, 2018
@andyscott
Copy link
Contributor Author

andyscott commented Mar 1, 2018

@ittaiz I've adjusted the title a bit to hopefully be less misleading.

AFAIK in my recent adventures with Bazel, toolchains operate globally. Seems we need a way to insulate toolchain options for Scala from breaking the use of rules_scala in a workspace.

@ittaiz
Copy link
Contributor

ittaiz commented Mar 2, 2018 via email

@ittaiz
Copy link
Contributor

ittaiz commented Jan 17, 2020

@andyscott I think we should either close this issue in favor of a bazel one or rename it to clarify this issue is solely about making rules_scala work with wfatal and the rest. WDYT?

@andyscott
Copy link
Contributor Author

We could perhaps close this in favor of a more general toolchain issue.

Toolchains strike me as the standard way to get tools off the host environment. For Scala, this isn't needed, so I'd like to discuss the removal of toolchains for boostrapping Scala compilation.

@ittaiz
Copy link
Contributor

ittaiz commented Jan 19, 2020

More general in what sense?
Getting tools off of the host environment is one use case but toolchains in general belong to the world of configurability.
Configuring then scala SDK as well as the scalacopts are classic toolchain use cases.

Why should we remove toolchains from our scala code?

@dsilvasc
Copy link

You might be able to isolate settings for rules_scala with platform constraints: you could define a platform @rules_scala//:bootstrap-platform and set restricted_to to that platform in the targets defined in the rules_scala repo.

The consumers could have one scala toolchain for their application code (maybe stricter, maybe plus-one deps) and another scala toolchain to compile rules_scala (with whichever settings rules_scala requires).

@ittaiz
Copy link
Contributor

ittaiz commented Jul 1, 2020

interesting, doesn't that require support for using multi platform in a single invocation in bazel?
Bazel is very oriented towards everything being one mono repo together, the above scenario doesn't sound like it will work to be honest

@ittaiz ittaiz mentioned this issue Oct 23, 2020
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