Launcher Reference
Bloop rifle is a lightweight artifact that installs and configures bloop. The goal of Bloop rifle is to relieve clients of the burden of installing and managing the lifetime of background build servers.
Bloop rifle implements the Build Server Discovery protocol which allows clients to establish a BSP connection and communicate with the server via stdin and stdout.
For an example of using Bloop rifle, see the Bloop CLI module and Metals
Description
Using Bloop rifle directly is more complex than using the CLI.
- Clients that want to start Bloop need to use
BloopRifleConfig
, which has some default values, but it needs a way to download Bloop binaries provided via classpath options.
final case class BloopRifleConfig(
address: BloopRifleConfig.Address,
javaPath: String,
javaOpts: Seq[String],
classPath: String => Either[Throwable, Seq[File]],
workingDir: File,
bspSocketOrPort: Option[() => BspConnectionAddress],
bspStdin: Option[InputStream],
bspStdout: Option[OutputStream],
bspStderr: Option[OutputStream],
period: FiniteDuration,
timeout: FiniteDuration,
startCheckPeriod: FiniteDuration,
startCheckTimeout: FiniteDuration,
initTimeout: FiniteDuration,
minimumBloopJvm: Int,
retainedBloopVersion: BloopRifleConfig.BloopVersionConstraint
)
At a minimum users need 3 arguments:
def default(
address: Address,
bloopClassPath: String => Either[Throwable, Seq[File]],
workingDir: File
): BloopRifleConfig =
- `address| - the address of the server, either TCP or via a domain socket path
bloopClassPath
- a function that takes a string and returns a sequence of files, needed to download bloop binariesworkingDir
- the working directory of the server
- With config available users can use
BloopRifle.check
to check if Bloop is running orBloopRifle.start
to start the server. - Lastly,
BloopRifle.bsp
can be used to establish a connection to the server. It will return aBspConnection
class, which will have aopenSocket
method available.
Install Bloop Rifle
Version | Published | Resolver |
---|---|---|
2.0.5 | 07 Nov 2024 16:03 | -r sonatype:releases |
2.0.5-39-a004214a-SNAPSHOT | 05 Dec 2024 18:03 |
Open a BSP connection
To open a BSP connection with Bloop's build server you need to follow the
Build Server Discovery protocol. BSP allow clients to
connect to a BSP server in a build-tool-independent way through BSP connection
files, a JSON file with build server metadata and an argv
field that, if
shelled out, will establish a bsp connection with a server.
The bloop BSP connection file is created automatically by any of the supported
bloop installation methods (in the global .bsp
directory) or by any of its
build plugins (in the .bsp
workspace directory). If you do not depend on a
build plugin or require the installation of bloop, you are required to create a
bloop BSP connection file to allow you and other servers follow the Build Server
Protocol.