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

Continue the bsp implementation #431

Merged
merged 24 commits into from
Apr 12, 2018
Merged

Conversation

jvican
Copy link
Contributor

@jvican jvican commented Apr 10, 2018

This pull request adds several compilation tests that check the correct
compilation of a target, as well as the potential errors showing up from an
invalid URI format.

It also improves the logging internals of BSP: now, logback is not used
anymore, and Bloop has its own slf4j logger adapter to wrap with scalalogging
and passes it in the lsp4s internals.

This pull request also fixes the handling of the root URI: before, it had to be
configuration directory .bloop, but that was wrong since the root URI must be
the base directory of the workspace. Now the detection of the configuration
directory is done automatically by Bloop.

/cc @jastice

@jvican jvican added integrations build server Any issue or pull request that has to do with hot compilers or BSP. priority / high Any change that has a high priority to be fixed because of its immediate consequences. labels Apr 10, 2018
@jvican jvican force-pushed the topic/prepare-bsp-for-intellij branch from c3a73b1 to 49b40dc Compare April 10, 2018 17:03
@jvican
Copy link
Contributor Author

jvican commented Apr 10, 2018

The latest additions to this PR also implement buildTarget/dependencySources and buildTarget/scalacOptions, which are added in this PR on scalacenter/bsp build-server-protocol/build-server-protocol#5. It also adds tests for both new entrypoints.

In Windows, the order was different than in Linux and was picking up
`root`, which has no sources and therefore can never compile and output
'Done compiling'.
@jvican jvican changed the title Add bsp compilation tests and improve BSP internals Continue the bsp implementation Apr 11, 2018
(including the failed ones).

This is what this commit does:

1. `ResultsCache` no longer stores the successful previous results. Now
it also stores the `Compiler.Result`s, so that a state that has been
compiled allows us to derive summaries and now how the compilation was.
This includes being able to tell the user why a given project was not
compiled (because it was blocked by other ones). This is important to
return a `CompileReport` in bsp-land, but that's implemented in another
PR.

2. The `Result` ADT is moved to backend, `Success` now takes the
reporter too (to check how many error or warnings were outputted to the
user's log), and a reporter is derived from the source infos of previous
Zinc results.

3. The `Result` ADT no longer takes the project as a paramter, instead
we get the project from the `toCompileTask` in `Tasks.scala`.
@jvican jvican force-pushed the topic/prepare-bsp-for-intellij branch from ddc363d to 76968fe Compare April 11, 2018 15:06
Frontend is becoming bloated and reporter utils have no specific
dependency in frontend, therefore we're moving them to backend.
@jvican jvican force-pushed the topic/prepare-bsp-for-intellij branch from cbb66db to 0d5ffd5 Compare April 11, 2018 17:19
BSP clients needed to escape the ansii color codes manually. In order to
avoid this unnecessary work, we default to no ansii color codes for now.
In the future, we will enrich the spec with a flag to toggle ansii color
codes.
@jvican jvican force-pushed the topic/prepare-bsp-for-intellij branch from d2fc438 to decd99b Compare April 11, 2018 20:33
@@ -30,4 +32,8 @@ object AbsolutePath {
def apply(path: String)(implicit cwd: AbsolutePath): AbsolutePath = apply(NioPaths.get(path))(cwd)
def apply(path: Path)(implicit cwd: AbsolutePath): AbsolutePath =
if (path.isAbsolute) new AbsolutePath(path) else cwd.resolve(path.toString)

// Necessary to test wrong paths in tests...
private[bloop] def completelyUnsafe(path: String): AbsolutePath =
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't unsafe or toUnsafe sound a bit less scary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's meant to be super scary, so that anyone but me uses it 😛 This makes an absolute path out of something it's not an absolute path.

Copy link
Contributor

Choose a reason for hiding this comment

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

Haha got it, didn't think it was that scary

Right(CompileReport(items))
def compile(params: CompileParams): BspResponse[CompileReport] = {
def compile(projects: Seq[ProjectMapping]): BspResponse[CompileReport] = {
// TODO(jvican): Naive approach, we need to implement batching here.
Copy link
Contributor

Choose a reason for hiding this comment

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

Batching in what sense? Isn't this fold kind of, going through a batch? Or am I misunderstanding the Run-thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Batching in the sense that bloop needs to find out the smallest group of disjoint DAGs that includes a given list of nodes. This is for performance reasons, a very simple example is described in #217.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see. The problem somehow sounds familiar...

@jvican jvican merged commit 9a7053e into master Apr 12, 2018
@tgodzik tgodzik deleted the topic/prepare-bsp-for-intellij branch September 7, 2021 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build server Any issue or pull request that has to do with hot compilers or BSP. integrations priority / high Any change that has a high priority to be fixed because of its immediate consequences.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants