Skip to content
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
merged 2 commits into from
Jun 16, 2023

Conversation

lukaszwawrzyk
Copy link
Contributor

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.

@lukaszwawrzyk lukaszwawrzyk force-pushed the scalac-opts-from-toolchain branch from 672c5d6 to 66f66d4 Compare June 16, 2023 08:35
@abrams27
Copy link
Member

please update changelog and we will merge it

Copy link
Member

@abrams27 abrams27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx

@abrams27 abrams27 changed the title Collect scalac options from toolchain [fix] collect scalac options from toolchain Jun 16, 2023
@abrams27 abrams27 merged commit 22b7951 into JetBrains:master Jun 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants