Skip to content
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

scala: support multiple scala versions #14425

Merged
merged 8 commits into from
Feb 10, 2022

Conversation

tdyas
Copy link
Contributor

@tdyas tdyas commented Feb 10, 2022

Implement support for multiple Scala versions in the same repository. Each resolve will be assigned a single Scala version.

Scala requires that all Scala-compiled jars on a classpath (i.e, a resolve) be "compatible" with one another (regardless of whether they are third-party jars or jars compiled from first-party sources). For Scala 2.x versions, for example, "compatibility" means that all Scala-compiled jars were compiled with the same minor version of Scala (i.e., 2.12). We can maintain this "Scala compatibility" property for a resolve by assigning the resolve a single Scala version which ensures that there is single Scala version that all of the third-party jars must be compatible with and that all first-party sources are compiled with.

Introduce the --scala-version-for-resolve option to implement the mapping from resolve to Scala version. The --scala-version option is deprecated and will be used as a fallback if the Scala version for a particular resolve is not set in --scala-version-for-resolve.

Closes #13994.

Tom Dyas added 4 commits February 9, 2022 19:03
[ci skip-rust]

[ci skip-build-wheels]
[ci skip-rust]

[ci skip-build-wheels]
[ci skip-rust]

[ci skip-build-wheels]
@tdyas tdyas requested review from stuhood and chrisjrn February 10, 2022 00:40
@tdyas
Copy link
Contributor Author

tdyas commented Feb 10, 2022

Still working on a test but this approach is ready for review at least.

I have a separate change in the works to automatically add scala-libary requirements to a resolve when the resolve is being generated.

[ci skip-rust]

[ci skip-build-wheels]
@tdyas
Copy link
Contributor Author

tdyas commented Feb 10, 2022

Added test.

Copy link
Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Thanks!

src/python/pants/backend/scala/subsystems/scala.py Outdated Show resolved Hide resolved
src/python/pants/backend/scala/subsystems/scala.py Outdated Show resolved Hide resolved
src/python/pants/jvm/classpath.py Outdated Show resolved Hide resolved
Tom Dyas added 3 commits February 10, 2022 08:25
[ci skip-rust]

[ci skip-build-wheels]
[ci skip-rust]

[ci skip-build-wheels]
[ci skip-rust]

[ci skip-build-wheels]
@tdyas
Copy link
Contributor Author

tdyas commented Feb 10, 2022

@stuhood: any comments on the updated help text wording?

@tdyas
Copy link
Contributor Author

tdyas commented Feb 10, 2022

@stuhood: any comments on the updated help text wording?

Going to land; will make any wording comments in a follow-on.

@tdyas tdyas merged commit 11fd5ee into pantsbuild:main Feb 10, 2022
@tdyas tdyas deleted the scala_multiple_versions branch February 10, 2022 17:59
@stuhood
Copy link
Member

stuhood commented Feb 10, 2022

@stuhood: any comments on the updated help text wording?

No, it looked good to me!

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

Successfully merging this pull request may close these issues.

Support for multiple Scala versions
2 participants