This repository has been archived by the owner on Aug 5, 2024. It is now read-only.
[fix] collect scalac options from toolchain #433
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this PR, scalac options were only loaded from the rule attributes. Options in the toolchain are then merged in one of rules_scala phases with these options for rules and then target is compiled.
In short, when global opts are set in toolchain, we don't pick them up.
They are only available in toolchain, but there is no way to get to it (
_scala_toolchain
attribute is not actually the toolchain, but some compiler jars). Only way to get to it is to add it to the toolchains attribute of the aspect, which breaks on workspaces without rules_scala.Until preprocessor for aspect file or a plugin system is developed, we can't properly implement it.
I've put the proper implementation in the comment for someone migrating this in the future.
I found a workaround to inspect the compile action of a target. The argv of the commanad that builds it is running a scala worker that takes --ScalacOpts as a parameter. We can borrow it from there.