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

docs: Update docs after recent changes #2419

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs-gen/src/main/scala/bloop/docs/ReleasesModifier.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ReleasesModifier extends StringModifier {
}

class LauncherReleasesModifier extends StringModifier {
override val name: String = "launcher-releases"
override val name: String = "rifle-releases"
override def process(info: String, code: Input, reporter: Reporter): String = {
val xml = {
try {
Expand All @@ -44,8 +44,8 @@ class LauncherReleasesModifier extends StringModifier {
</thead>
<tbody>
<tr>
<td>{Sonatype.releaseLauncher.version}</td>
<td>{Sonatype.releaseLauncher.date}</td>
<td>{Sonatype.releaseRifle.version}</td>
<td>{Sonatype.releaseRifle.date}</td>
<td><code>-r sonatype:releases</code></td>
</tr>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion docs-gen/src/main/scala/bloop/docs/Sonatype.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ case class Release(version: String, lastModified: Date) {
object Sonatype {
lazy val releaseBloop = fetchLatest("bloop-frontend_2.12")
lazy val releaseBloopMaven = fetchLatest("bloop-maven-plugin")
lazy val releaseLauncher = fetchLatest("bloop-launcher_2.12")
lazy val releaseRifle = fetchLatest("bloop-rifle_2.13")
lazy val releaseBloopGradle = fetchLatest("gradle-bloop_2.13")

/** Returns the latest published snapshot release, or the current release if. */
Expand Down
6 changes: 0 additions & 6 deletions docs/build-tools/gradle.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ Learn how to get set up by following the instructions below.

## Install the plugin

Here is a list of the latest Bloop stable and development versions.

```scala mdoc:releases
I am going to be replaced by the docs infrastructure.
```

adpi2 marked this conversation as resolved.
Show resolved Hide resolved
Add bloop to your `build.gradle` with:

```gradle
Expand Down
16 changes: 8 additions & 8 deletions docs/contributing-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ tooling infrastructure.
1. `buildpress` is an application that given a list of `(project-name, vcs-uri)` will export a build to bloop.
1. `docs` and `docs-gen` define our docs infrastructure.
1. `benchmark-bridge` and `benchmarks` define our compiler benchmark infrastructure.
1. `launcher` is an application to spawn a bloop server and establish a
1. `bloop-rifle` is a module to start a bloop server and establish a
bsp/cli connection to it.
1. `nailgun` is a git submodule of `scalacenter/nailgun`, a fork of `facebook/nailgun`.
1. `sockets` is a library to use Unix Domain sockets and Named Pipes in Windows.
1. `website` contains the [Docusaurus](https://docusaurus.io/) code of our website.

## Set the repository up
Expand Down Expand Up @@ -111,7 +109,7 @@ them to your project. For example, to depend on the latest SNAPSHOT of bloop
launcher in sbt, add the following to your project:

```scala
libraryDependencies += "ch.epfl.scala" % "bloop-launcher" % "$VERSION"
libraryDependencies += "ch.epfl.scala" % "bloop-rifle" % "$VERSION"
```

### Install a SNAPSHOT release in your machine
Expand Down Expand Up @@ -184,11 +182,13 @@ local installation by comparing the SNAPSHOT version you wanted to install
with the version of the running server.

```bash
➜ bloop about
bloop v1.2.5+264-3441652d
➜ bloop v2.0.0

Using Scala v2.12.19 and Zinc v1.10.1
Running on Java JDK v21 (/usr/lib/jvm/openjdk21)
-> Supports debugging user code, Java Debug Interface (JDI) is available.
Maintained by the Scala Center and the community.

Running on Scala v2.12.8 and Zinc v1.2.1+110-85b9a03c
Maintained by the Scala Center (Martin Duhem, Jorge Vicente Cantero)
```

Note the bloop version number in the first line of the above logs.
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/first-step.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Bloop is a JVM-based build server that applications such as IDEs (e.g.
[Metals](https://scalameta.org/metals)) or build tools (e.g.
[seed](https://github.com/tindzk/seed)) can depend on. Typically, these
applications use the [Bloop Launcher](docs/launcher-reference) to run bloop
applications use the [Bloop Launcher](docs/bloop-rifle) to run bloop
in the background of your machine. This means, you might be already using
Bloop without knowing it.

Expand Down
96 changes: 0 additions & 96 deletions docs/launcher.md

This file was deleted.

96 changes: 96 additions & 0 deletions docs/rifle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
id: bloop-rifle
title: Launcher Reference
sidebar_label: Built-in Launcher
---

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][server-discovery]
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](https://github.com/scalacenter/bloop/tree/main/cli) and
[Metals](https://github.com/scalameta/metals/blob/main/metals/src/main/scala/scala/meta/internal/metals/BloopServers.scala)

## Description

Using Bloop rifle directly is more complex than using the CLI.

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

```scala
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:

```scala
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 binaries
- `workingDir` - the working directory of the server

2. With config available users can use `BloopRifle.check` to check if Bloop is
running or `BloopRifle.start` to start the server.
3. Lastly, `BloopRifle.bsp` can be used to establish a connection to the server.
It will return a `BspConnection` class, which will have a `openSocket` method
available.

#### Install Bloop Rifle

```scala mdoc:rifle-releases
I am going to be replaced by the docs infrastructure.
```

Bloop Rifle is independent from Bloop but it's released with the same cadence
than the Bloop build server. Therefore, you can expect a build server version to
have an accompanying rifle version.

### Open a BSP connection

To open a BSP connection with Bloop's build server you need to follow the
[Build Server Discovery protocol][server-discovery]. 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.

[server-discovery]:
https://github.com/build-server-protocol/build-server-protocol/blob/master/docs/overview/server-discovery.md
Loading
Loading