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

Use BuildInfo.scalaCompilerVersion over Properties.versionNumberString #876

Merged
merged 4 commits into from Aug 25, 2019

Conversation

@olafurpg
Copy link
Member

commented Aug 25, 2019

Previously, we used scala.util.Properties.versionNumberString
to find the current Scala version of the running classloader. This
approach had the problem where we would pick up a more recent Scala
version than expected. For example, the Metals server depended on an
mtags_2.12.8.jar and scala-library_2.12.jar (compiled by 2.12.9)
causing Properties.versionNumberString to return "2.12.9" instead of
the expected "2.12.8".

Now, we use a BuildInfo.scalaCompilerVersion that is generated by the
build to ensure we get "2.12.8" even if scala-library.jar on the
classpath comes from 2.12.9.

Fixes #868.

olafurpg added 2 commits Aug 25, 2019
Previously, we used `scala.util.Properties.versionNumberString`
to find the current Scala version of the running classloader. This
approach had the problem where we would pick up a more recent Scala
version than expected. For example, the Metals server depended on an
`mtags_2.12.8.jar` and `scala-library_2.12.jar` (compiled by 2.12.9)
causing `Properties.versionNumberString` to return "2.12.9" instead of
the expected "2.12.8".

Now, we use a `BuildInfo.scalaCompilerVersion` that is generated by the
build to ensure we get "2.12.8" even if scala-library.jar on the
classpath comes from 2.12.9.

Fixes #868.
@olafurpg olafurpg requested a review from gabro Aug 25, 2019
@gabro
gabro approved these changes Aug 25, 2019
Copy link
Member

left a comment

Looks great, this fix finally makes sense 🎉 Code LGTM, I'll also give it a try locally to confirm

olafurpg added 2 commits Aug 25, 2019
Use correct Scala version for `scalaCompilerVersion` in non-2.12
projects.
@olafurpg olafurpg merged commit 0039eb7 into scalameta:master Aug 25, 2019
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
scalameta.metals Build #20190825.12 succeeded
Details
@olafurpg olafurpg deleted the olafurpg:mystery branch Aug 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.