-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docs for bloop interaction (#2608)
* Add headers to java properties docs * Add document about interactions with Bloop * Move bloop.md file to commands/misc/ * Update link to bloop docs, split paragraph into two * Fix broken links * Editorial fix
- Loading branch information
1 parent
d675651
commit 59532ed
Showing
6 changed files
with
73 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
title: Bloop ⚡️ | ||
sidebar_position: 10 | ||
--- | ||
|
||
Scala CLI by default uses Bloop as a build server for compiling code. This approach has its advantages over the `scalac` compiler such as advanced caching and fast compile times, but the process is more complex. | ||
Fortunately for the users, Scala CLI fully manages the Bloop build server. This includes its whole lifecycle, which starts with fetching the artifacts. | ||
This document showcases the `bloop` subcommand that allows you manually manage the Bloop server. | ||
It also goes through the server's lifecycle and the interactions that Scala CLI has with it. | ||
|
||
:::caution | ||
The `bloop` sub-command is restricted and requires setting the `--power` option to be used. | ||
You can pass it explicitly or set it globally by running: | ||
|
||
scala-cli config power true | ||
::: | ||
|
||
### Starting the server | ||
|
||
Whenever the code is compiled using Bloop, the first step is checking if the server is online, as it is launched as a daemon thread there's a chance it may have been launched during a past compilation. | ||
However, if the server is offline then Scala CLI needs to start and configure it. | ||
|
||
The configuration file for Bloop is created after analyzing the options collected from command line flags and using directives. | ||
The default location of the file is `.scala-build/bloop/project_name.json`. | ||
|
||
The last thing before launching the server is downloading its artifacts from Maven Central via Coursier if they are not already present in the local cache. | ||
:::tip | ||
When working in an environment with restricted access to the web, using Bloop can be disabled with the `--server=false` flag. Also, see the [section about the Offline mode](../../guides/offline.md). | ||
::: | ||
|
||
Bloop is started as a separate JVM process, parameters of this process can be configured using arguments passed to the invoked subcommand ([see compilation server options](../../reference/cli-options.md#compilation-server-options)). | ||
They also depend on the JVM version chosen for building the project, it cannot be higher than the version of the JVM running Bloop. If such a case is detected, the build server has to be restarted with a sufficiently high JVM. | ||
Note that the default version of the JVM for Bloop is 17, so if your `JAVA_HOME` refers to an older version of Java, Scala CLI will fetch the one you need. You can also override the JVM version Bloop runs on with the `--bloop-jvm` option. | ||
To start the Bloop server manually you can use the `bloop start` subcommand: | ||
```bash | ||
scala-cli --power bloop start | ||
``` | ||
|
||
### Communicating with the server | ||
|
||
During the communication process, Scala CLI acts mostly as an intermediary between Bloop and the build client. | ||
The build client can be either the user invoking the tool from the command line or the IDE seeing Scala CLI as a build server. | ||
The behavior is mostly the same in both cases and is based on forwarding the messages. The messages being forwarded need to sometimes be edited as a result of preprocessing Scala CLI does, e.g. generating script sources. | ||
|
||
The main difference between running on the command line and serving an IDE is the information that gets through to the client. | ||
While an IDE receives all the messages that Bloop sends, the user only receives the relevant information, like warnings and errors coming from the compilation process. | ||
|
||
### Killing the server | ||
|
||
In general, the Bloop server is started as a daemon process that sticks around even after Scala CLI exits. | ||
The server can sometimes be automatically killed and restarted if a configuration change requires that, e.g. JVM version requested by the build is too high. | ||
|
||
However, sometimes it is needed to restart the Bloop server manually, for that the `bloop exit` subcommand can be used: | ||
```bash | ||
scala-cli --power bloop exit | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: Default File ⚡️ | ||
sidebar_position: 2 | ||
sidebar_position: 20 | ||
--- | ||
|
||
:::caution | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: PGP ⚡️ | ||
sidebar_position: 18 | ||
sidebar_position: 30 | ||
--- | ||
|
||
:::caution | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters