-
Notifications
You must be signed in to change notification settings - Fork 333
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
Improve SemanticDB integration using Bloop's newest features #852
Improve SemanticDB integration using Bloop's newest features #852
Conversation
metals/src/main/scala/scala/meta/internal/builds/GradleBuildTool.scala
Outdated
Show resolved
Hide resolved
I wonder if we should cleanup |
260612c
to
f230cd3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preliminary comments from a few days ago, will finish review tomorrow!
1b240e8
to
feffda8
Compare
metals/src/main/scala/scala/meta/internal/builds/SbtBuildTool.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/builds/SbtBuildTool.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/metals/BuildServerConnection.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 this is wonderful news as it removes a lot of complexity from Metals!
I've left some minor comments here and there :)
build.sbt
Outdated
val gradleBloop = bloop | ||
val bloop = "1.3.2+125-2d6bf327" | ||
val sbtBloop = "1.3.2" | ||
val gradleBloop = "1.3.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reminder to re-instate the bloop
shared variable before merging
metals/src/main/scala/scala/meta/internal/builds/SbtBuildTool.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/builds/SbtBuildTool.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/builds/SbtBuildTool.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/builds/SbtBuildTool.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/builds/SbtBuildTool.scala
Outdated
Show resolved
Hide resolved
02f7eb1
to
82050fc
Compare
Had to tidy up a bit and squashed the commits, but I applied all the suggestions and added some more tests for |
82050fc
to
f9b1684
Compare
metals/src/main/scala/scala/meta/internal/builds/GradleBuildTool.scala
Outdated
Show resolved
Hide resolved
f9b1684
to
f677706
Compare
metals/src/main/scala/scala/meta/internal/builds/SbtBuildTool.scala
Outdated
Show resolved
Hide resolved
f677706
to
d90d195
Compare
Fixed some last things, but we are waiting for the newest Bloop release - @jvican wants to make sure that is all stable. When it's released I will replace the version to use the same bloop version everwhere. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR looks amazing! I can't wait for the next release of Bloop so we can merge this 👍
Great work @tgodzik cleaning up redundant code and adding test cases against the new fatal warnings implementation.
@@ -274,32 +276,6 @@ lazy val metals = project | |||
.dependsOn(mtags) | |||
.enablePlugins(BuildInfoPlugin) | |||
|
|||
lazy val `sbt-metals` = project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍
val resolvers = | ||
if (BuildInfo.metalsVersion.endsWith("-SNAPSHOT")) { | ||
"""|resolvers ++= { | ||
| if (System.getenv("METALS_ENABLED") == "true") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very excited to get rid of this here :D
"" | ||
} | ||
private def sbtPlugin(bloopSbtVersion: String): String = { | ||
val isSnapshotVersion = bloopSbtVersion.contains("+") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val isSnapshotVersion = bloopSbtVersion.contains("+") | |
val isPreReleaseVersion = bloopSbtVersion.contains("+") || bloopSbtVersion.contains("-") |
Strictly speaking, a snapshot version should end with -SNAPSHOT
. Including -
also guards us if bloop changes it's usage of +
versions. Some filesystems require weird encodings for filenames with +
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think bloop ever releases with version-SNAPSHOT
, but I can add it here, just don't think it will change much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point.
""".stripMargin | ||
) | ||
// we should still have references despite fatal warning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
|
||
private def gitignoreMetals(workspace: AbsolutePath) = { | ||
val gitignore = workspace.resolve(".gitignore") | ||
val gitIgnoreContents = "project/metals.sbt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about adding the following entries as well?
.metals/
.bloop/
These entries should ideally be in the workspace .gitignore instead of the global .gitignore because VS Code only uses the workspace gitignore in "Open file".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about it, but decided not to do in this PR, but I can for sure do it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be done as a separate PR.
Bloop v1.3.3 is out now unblocking this PR 🎉 |
…onfiguration in Gradle and sbt. Thanks to the change in Bloop, we now are able to define what semanticDB plugin we need when initializing and Bloop takes care of finding it and applying to scalaca options.
Previously, we removed fatal-warnings from scalac options in order to have everything properly compiled. Now, fatal warnings are handled by Bloop and are reported as errors while still producing compilation artifacts.
d90d195
to
ebba0ed
Compare
ebba0ed
to
21f992f
Compare
🎉 |
😍 |
🥇 |
Bloop 1.3.3 can assume the responsibility of finding the semanticdb plugin and setting the relevant options in the compiler, which means we don't have to do it ourselves anymore to accommodate metals users. See scalameta/metals#852
Bloop 1.3.3 can assume the responsibility of finding the semanticdb plugin and setting the relevant options in the compiler, which means we don't have to do it ourselves anymore to accommodate metals users. See scalameta/metals#852
Previously, adding semanticDB plugin would require a lot of fragile configuration in Gradle and sbt.
Thanks to the change in Bloop, we now are able to define what semanticDB plugin we need when initializing and Bloop takes care of finding it and applying to scalac options.
Fixes #808