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

Improve SemanticDB integration using Bloop's newest features #852

Merged
merged 4 commits into from Oct 3, 2019

Conversation

@tgodzik
Copy link
Collaborator

tgodzik commented Aug 5, 2019

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

@megri megri mentioned this pull request Aug 6, 2019
@tgodzik

This comment has been minimized.

Copy link
Collaborator Author

tgodzik commented Aug 8, 2019

I wonder if we should cleanup project/metals.sbt file after running the command, any opinions?

@tgodzik tgodzik force-pushed the tgodzik:update-semanticDB-integration branch from 260612c to f230cd3 Aug 8, 2019
Copy link
Collaborator

jvican left a comment

Preliminary comments from a few days ago, will finish review tomorrow!

@tgodzik tgodzik force-pushed the tgodzik:update-semanticDB-integration branch 3 times, most recently from 1b240e8 to feffda8 Aug 9, 2019
@tgodzik tgodzik changed the title WiP Update SemanticDb integration Improve SemanticDB integration using Bloop's newest features Aug 12, 2019
@tgodzik tgodzik requested review from jvican and marek1840 Aug 12, 2019
@gabro
gabro approved these changes Aug 12, 2019
Copy link
Member

gabro left a comment

🎉 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"

This comment has been minimized.

Copy link
@gabro

gabro Aug 12, 2019

Member

reminder to re-instate the bloop shared variable before merging

docs/build-tools/gradle.md Outdated Show resolved Hide resolved
@tgodzik tgodzik force-pushed the tgodzik:update-semanticDB-integration branch from 02f7eb1 to 82050fc Aug 12, 2019
@tgodzik

This comment has been minimized.

Copy link
Collaborator Author

tgodzik commented Aug 12, 2019

Had to tidy up a bit and squashed the commits, but I applied all the suggestions and added some more tests for .gitignore modification

@tgodzik tgodzik requested a review from marek1840 Aug 12, 2019
@tgodzik tgodzik force-pushed the tgodzik:update-semanticDB-integration branch from 82050fc to f9b1684 Aug 12, 2019
@tgodzik tgodzik force-pushed the tgodzik:update-semanticDB-integration branch from f9b1684 to f677706 Aug 12, 2019
@tgodzik tgodzik force-pushed the tgodzik:update-semanticDB-integration branch from f677706 to d90d195 Aug 13, 2019
@tgodzik

This comment has been minimized.

Copy link
Collaborator Author

tgodzik commented Aug 13, 2019

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.

Copy link
Member

olafurpg left a comment

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

This comment has been minimized.

Copy link
@olafurpg

olafurpg Aug 25, 2019

Member

😍

val resolvers =
if (BuildInfo.metalsVersion.endsWith("-SNAPSHOT")) {
"""|resolvers ++= {
| if (System.getenv("METALS_ENABLED") == "true") {

This comment has been minimized.

Copy link
@olafurpg

olafurpg Aug 25, 2019

Member

I'm very excited to get rid of this here :D

""
}
private def sbtPlugin(bloopSbtVersion: String): String = {
val isSnapshotVersion = bloopSbtVersion.contains("+")

This comment has been minimized.

Copy link
@olafurpg

olafurpg Aug 25, 2019

Member
Suggested change
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 +.

This comment has been minimized.

Copy link
@tgodzik

tgodzik Aug 28, 2019

Author Collaborator

I don't think bloop ever releases with version-SNAPSHOT, but I can add it here, just don't think it will change much.

This comment has been minimized.

Copy link
@olafurpg

olafurpg Aug 28, 2019

Member

Fair point.

""".stripMargin
)
// we should still have references despite fatal warning

This comment has been minimized.

Copy link
@olafurpg

private def gitignoreMetals(workspace: AbsolutePath) = {
val gitignore = workspace.resolve(".gitignore")
val gitIgnoreContents = "project/metals.sbt"

This comment has been minimized.

Copy link
@olafurpg

olafurpg Aug 25, 2019

Member

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".

This comment has been minimized.

Copy link
@tgodzik

tgodzik Aug 28, 2019

Author Collaborator

I was thinking about it, but decided not to do in this PR, but I can for sure do it here.

This comment has been minimized.

Copy link
@olafurpg

olafurpg Aug 28, 2019

Member

It can be done as a separate PR.

@olafurpg

This comment has been minimized.

Copy link
Member

olafurpg commented Oct 2, 2019

Bloop v1.3.3 is out now unblocking this PR 🎉

tgodzik added 3 commits Jun 25, 2019
…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.
@tgodzik tgodzik force-pushed the tgodzik:update-semanticDB-integration branch from d90d195 to ebba0ed Oct 2, 2019
@tgodzik tgodzik force-pushed the tgodzik:update-semanticDB-integration branch from ebba0ed to 21f992f Oct 2, 2019
@tgodzik tgodzik merged commit 3b04294 into scalameta:master Oct 3, 2019
2 checks passed
2 checks passed
build
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@tgodzik tgodzik deleted the tgodzik:update-semanticDB-integration branch Oct 3, 2019
@olafurpg

This comment has been minimized.

Copy link
Member

olafurpg commented Oct 3, 2019

🎉

@gabro

This comment has been minimized.

Copy link
Member

gabro commented Oct 3, 2019

😍

@Baccata

This comment has been minimized.

Copy link

Baccata commented Oct 3, 2019

🥇

Baccata added a commit to Baccata/mill that referenced this pull request Oct 3, 2019
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
lefou added a commit to lihaoyi/mill that referenced this pull request Oct 3, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.