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

Persist sbt metadata in project model #538

Merged
merged 3 commits into from Jun 13, 2018
Merged

Conversation

jvican
Copy link
Contributor

@jvican jvican commented Jun 12, 2018

Add the sbt metadata field in the project configuration file so that we
can present it to IDEs via BSP. A nice property of the approach taken in
this PR is that we automatically create a project file for the build
under the meta build .bloop directory. This is helpful for two
reasons:

  1. Bloop can compile your build just as it can compile your project.
  2. Bloop knows immediately any change that happens to your build.

The implementation here proposed is quite tricky because of some sbt
implementation details. We cannot get the autoImports from the build
of the build, so we need to roll out our own piece of code to do so with
the pluginData of the meta build. This repeats some work because it
needs to classload the build data for our project's build, but it's
negligible in terms of time spent (<500 ms in the cases I've tested).
And it does reuse the parent classloader from the meta build.

Aside from implementing this feature, this commit also removes any cross
published module and instead creates a static module for it. This helps
development because we can compile the projects for 0.13 and 1.0
immediately without needing to use + and ^, which are completely
broken in our build.

@jvican jvican force-pushed the topic/sbt-build-extraction branch 2 times, most recently from 05f37e2 to b33640d Compare June 12, 2018 17:47
@jvican jvican requested a review from Duhemm June 12, 2018 17:48
@jvican jvican force-pushed the topic/sbt-build-extraction branch from b33640d to aa3374b Compare June 12, 2018 18:08
Add the sbt metadata field in the project configuration file so that we
can present it to IDEs via BSP. A nice property of the approach taken in
this PR is that we automatically create a project file for the build
under the meta build `.bloop` directory. This is helpful for two
reasons:

1. Bloop can compile your build just as it can compile your project.
2. Bloop knows immediately any change that happens to your build.

The implementation here proposed is quite tricky because of some sbt
implementation details. We cannot get the `autoImports` from the build
of the build, so we need to roll out our own piece of code to do so with
the `pluginData` of the meta build. This repeats some work because it
needs to classload the build data for our project's build, but it's
negligible in terms of time spent (<500 ms in the cases I've tested).

Aside from implementing this feature, this commit also removes any cross
published module and instead creates a static module for it. This helps
development because we can compile the projects for 0.13 and 1.0
immediately without needing to use `+` and `^`, which are completely
broken in our build.
@jvican jvican force-pushed the topic/sbt-build-extraction branch from aa3374b to ecd5a8b Compare June 12, 2018 18:12
@jvican
Copy link
Contributor Author

jvican commented Jun 12, 2018

The last commit adds a fancier discoveredSbtPlugins @Duhemm. Importing our build now takes 11 seconds (which is quite an achievement considering there are 38 modules).

Adds support to elide `discoveredSbtPlugins` for all sbt versions if
either `bloopInstall` or `bloopGenerate` are under execution.

This makes the process faster (exporting the bloop build takes now 11
seconds!).
@jvican jvican force-pushed the topic/sbt-build-extraction branch from 58e69e6 to cad72a1 Compare June 12, 2018 21:13
Copy link
Collaborator

@Duhemm Duhemm left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -1,5 +1,6 @@
import java.nio.file.{Files, Path}

val BloopClassifiers = Set("sources", "javadoc")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this used somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, just removed it.

@jvican jvican merged commit ae427bf into master Jun 13, 2018
@tgodzik tgodzik deleted the topic/sbt-build-extraction branch September 7, 2021 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants