Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

[feature] Resolve Scala SDK independently for each target #552

Merged
merged 6 commits into from
Apr 18, 2024

Conversation

aszady
Copy link
Contributor

@aszady aszady commented Apr 8, 2024

This prepares us for changes in rules_scala that will allow customizing the Scala version for each target.
In order to achieve that, we can no longer resolve the Scala SDK globally as the maximal version used. We need to use per-target info.
Scala SDK will be still discovered based on the compiler class path.
Now though we will look into an implicit dependency of each target, the _scalac.

This change is backward-compatible, as the mentioned data is already available.
It is also forward-compatible with the anticipated cross-build feature of rules_scala.
(see: bazelbuild/rules_scala#1290)

The aspect will produce additional data – namely few compiler classpath jars per Scala target.
Perhaps we could review this change in the future to normalize the data back. Now it's not possible, as the data about alternative configurations (here: of scalac) is discarded in the server.

@aszady aszady force-pushed the independent branch 4 times, most recently from b5f47c0 to 42964ad Compare April 10, 2024 09:55
@aszady aszady marked this pull request as ready for review April 10, 2024 10:42
@abrams27 abrams27 self-requested a review April 12, 2024 13:18
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.

thanks a lot for the pr! one thing in the comments

aspects/rules/scala/scala_info.bzl Show resolved Hide resolved
@aszady aszady force-pushed the independent branch 2 times, most recently from 6ce8e91 to 8a69c95 Compare April 12, 2024 20:15
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.

thanks! do you have any specific scala project on which i should test it?

This prepares us for changes in `rules_scala` that will allow customizing the Scala version for each target.
In order to achieve that, we can no longer resolve the Scala SDK globally as the maximal version used. We need to use per-target info.
Scala SDK will be still discovered based on the compiler class path.
Now though we will look into an implicit dependency of each target, the `_scalac`.

This change is backward-compatible, as the mentioned data is already available.
It is also forward-compatible with the anticipated cross-build feature of `rules_scala`.
(see: bazelbuild/rules_scala#1290)

The aspect will produce additional data – namely few compiler classpath jars per Scala target.
Perhaps we could review this change in the future to normalize the data back. Now it's not possible, as the data about alternative configurations (here: of scalac) is discarded in the server.
@aszady
Copy link
Contributor Author

aszady commented Apr 17, 2024

thanks! do you have any specific scala project on which i should test it?

I prepared a small test/example here: aszady/bazel-bsp@independent...aszady:bazel-bsp:independent-test
Let me know if you need something more complex.

@abrams27
Copy link
Member

ohh perfect! seems to work for me as well, can i ask you to add this test to e2e tests as well? looks like a useful scenario to keep there, once it's done i think we will be ready to merge

@aszady
Copy link
Contributor Author

aszady commented Apr 17, 2024

The problem is, the feature is not yet fully merged into rules_scala and this test depends now on my private fork with the desired implementation. Do you think we could add this e2e scenario later?

@abrams27
Copy link
Member

oh yea sure

@abrams27
Copy link
Member

is it ready to merge?

@aszady
Copy link
Contributor Author

aszady commented Apr 18, 2024

Yes, I believe so.

@abrams27 abrams27 merged commit dc332df into JetBrains:master Apr 18, 2024
12 checks passed
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