Skip to content

Commit

Permalink
[breaking change] bloop support dropped (#437)
Browse files Browse the repository at this point in the history
* bloop out from the installer

* bloop out from the server

* readme update

* changelog
  • Loading branch information
abrams27 committed Jun 27, 2023
1 parent 0bd5b03 commit 3d23205
Show file tree
Hide file tree
Showing 27 changed files with 4 additions and 1,350 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,10 @@

## [Unreleased]

### Breaking changes 🚨

- Bloop support has been dropped.


## [2.7.2]

Expand Down
39 changes: 0 additions & 39 deletions README.md
Expand Up @@ -66,45 +66,6 @@ bazel run --stamp --define "maven_repo=file://$HOME/.m2/repository" //server/src
cs launch -r m2Local org.jetbrains.bsp:bazel-bsp:<your version> -M org.jetbrains.bsp.bazel.install.Install
```

### Using Bloop (_deprecated!_)

By default Bazel BSP runs as a BSP server and invokes Bazel to compile, test and run targets.
This provides the most accurate build results at the expense of
compile/test/run latency. Bazel BSP can optionally be configured to use [Bloop](https://scalacenter.github.io/bloop/)
as the BSP server instead. Bloop provides a much lower latency with the trade-off that the Bloop model
may not perfectly represent the Bazel configuration.

#### Installing with Bloop

The instructions above will work in Bloop mode as well, simply pass ``--use_bloop`` as an installation option.
However, when using Bloop mode Bazel BSP can also install itself outside the source root directory. This can
be useful in large shared repositories where it's undesirable to keep the Bazel BSP projects inside the
repository itself.

In the examples below, we'll use ``~/src/my-repo`` as the "repository root" and ``~/bazel-bsp-projects`` as the
"Bazel BSP project root", however both can be any directory.

To install Bazel BSP outside the repository root:

1) Change directories into the repository root: ``cd ~/src/my-repo``
2) Invoke the Bazel BSP installer as described above (via Coursier or run the installer JAR directly), passing in:
1) ``--use-bloop``
2) ``-d ~/bazel-bsp-projects/my-repo-project``

For example, using Coursier:

```shell
cd ~/src/my-repository
cs launch org.jetbrains.bsp:bazel-bsp:2.7.2 -M org.jetbrains.bsp.bazel.install.Install \
-- \
--use-bloop \
-t //my-targets/... \
-d ~/bazel-bsp-projects/my-targets-project
```

This will create a set of BSP and Bloop projects in ``~/bazel-bsp-projects/my-targets-project`` which can then be opened
in IntelliJ or any other IDE that supports BSP.

## Project Views

In order to work on huge monorepos you might want to specify directories and targets to work on. To address this issue,
Expand Down
2 changes: 0 additions & 2 deletions WORKSPACE
Expand Up @@ -187,8 +187,6 @@ maven_install(
"org.junit.jupiter:junit-jupiter:5.9.3",
"com.fasterxml.jackson.core:jackson-databind:2.15.2",
"com.fasterxml.jackson.module:jackson-module-kotlin:2.15.2",
"ch.epfl.scala:bloop-config_2.13:1.5.0",
"org.scala-lang:scala-library:2.13.11",
"com.google.protobuf:protobuf-java:3.23.3",
"io.grpc:grpc-stub:1.56.0",
"io.grpc:grpc-netty:1.56.0",
Expand Down
Expand Up @@ -22,9 +22,6 @@ public class Constants {
public static final String DOT_BSP_DIR_NAME = ".bsp";
public static final String BAZELBSP_JSON_FILE_NAME = "bazelbsp.json";
public static final String SERVER_CLASS_NAME = "org.jetbrains.bsp.bazel.server.ServerInitializer";
public static final String BLOOP_BOOTSTRAP_CLASS_NAME =
"org.jetbrains.bsp.bazel.server.bloop.BloopExporterInitializer";
public static final String BLOOP_SETTINGS_JSON_FILE_NAME = "bloop.settings.json";
public static final String CLASSPATH_FLAG = "-classpath";
public static final String BAZELBSP_TRACE_JSON_FILE_NAME = "bazelbsp.trace.json";
}

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions install/src/main/java/org/jetbrains/bsp/bazel/install/Install.kt
Expand Up @@ -17,27 +17,13 @@ object Install {

if (cliOptions.helpCliOptions.isHelpOptionUsed) {
cliOptions.helpCliOptions.printHelp()
} else if (cliOptions.bloopCliOptions.useBloop) {
createBloopEnvironmentAndInstallBloopBspServer(cliOptions)
.onSuccess { printInCaseOfSuccess(cliOptions) }
.onFailure(::printFailureReasonAndExit1)
} else {
createEnvironmentAndInstallBazelBspServer(cliOptions)
.onSuccess { printInCaseOfSuccess(cliOptions) }
.onFailure(::printFailureReasonAndExit1)
}
}

private fun createBloopEnvironmentAndInstallBloopBspServer(cliOptions: CliOptions): Try<Void> =
InstallationContextProvider.parseProjectViewOrGenerateAndSaveAndCreateInstallationContext(cliOptions)
.flatMap { createBloopEnvironment(it, cliOptions) }

private fun createBloopEnvironment(installationContext: InstallationContext, cliOptions: CliOptions): Try<Void> {
val environmentCreator = BloopEnvironmentCreator(cliOptions, installationContext)

return environmentCreator.create()
}

private fun createEnvironmentAndInstallBazelBspServer(cliOptions: CliOptions): Try<Void> =
InstallationContextProvider.parseProjectViewOrGenerateAndSaveAndCreateInstallationContext(cliOptions)
.flatMap(::createBspConnectionDetails)
Expand Down
Expand Up @@ -22,15 +22,10 @@ data class ProjectViewCliOptions internal constructor(
val produceTraceLog: Boolean?,
)

data class BloopCliOptions internal constructor(
val useBloop: Boolean
)

data class CliOptions internal constructor(
val helpCliOptions: HelpCliOptions,
val workspaceRootDir: Path,
val projectViewFilePath: Path?,
val projectViewCliOptions: ProjectViewCliOptions?,
val bloopCliOptions: BloopCliOptions,
val bazelWorkspaceRootDir: Path,
)
Expand Up @@ -160,12 +160,6 @@ class CliOptionsProvider(private val args: Array<String>) {
.build()
cliParserOptions.addOption(importDepthOption)

val useBloopOption = Option.builder(USE_BLOOP_SHORT_OPT)
.longOpt("use-bloop")
.desc("Use bloop as the BSP server rather than bazel-bsp.")
.build()
cliParserOptions.addOption(useBloopOption)

val bazelWorkspaceRootDirOption = Option.builder(BAZEL_WORKSPACE_ROOT_DIR_OPT)
.longOpt("bazel-workspace")
.hasArg()
Expand Down Expand Up @@ -195,7 +189,6 @@ class CliOptionsProvider(private val args: Array<String>) {
workspaceRootDir = workspaceRootDir(cmd),
projectViewFilePath = projectViewFilePath(cmd),
projectViewCliOptions = createProjectViewCliOptions(cmd),
bloopCliOptions = createBloopCliOptions(cmd),
bazelWorkspaceRootDir = bazelWorkspaceRootDir(cmd),
)

Expand All @@ -216,8 +209,6 @@ class CliOptionsProvider(private val args: Array<String>) {

private fun isHelpOptionUsed(cmd: CommandLine): Boolean = cmd.hasOption(HELP_SHORT_OPT)

private fun useBloop(cmd: CommandLine): Boolean = cmd.hasOption(USE_BLOOP_SHORT_OPT)

private fun printHelp() {
val formatter = HelpFormatter()
formatter.width = 160
Expand All @@ -234,9 +225,6 @@ class CliOptionsProvider(private val args: Array<String>) {
)
}

private fun createBloopCliOptions(cmd: CommandLine): BloopCliOptions =
BloopCliOptions(useBloop = useBloop(cmd))

private fun createProjectViewCliOptions(cmd: CommandLine): ProjectViewCliOptions? =
if (isAnyGenerationFlagSet(cmd))
ProjectViewCliOptions(
Expand Down Expand Up @@ -316,7 +304,6 @@ class CliOptionsProvider(private val args: Array<String>) {
private const val EXCLUDED_DIRECTORIES_LONG_OPT = "excluded-directories"
private const val DERIVE_TARGETS_FLAG_SHORT_OPT = "v"
private const val IMPORT_DEPTH_SHORT_OPT = "i"
private const val USE_BLOOP_SHORT_OPT = "u"
private const val BAZEL_WORKSPACE_ROOT_DIR_OPT ="w"
private const val PRODUCE_TRACE_LOG_OPT ="l"

Expand Down
2 changes: 0 additions & 2 deletions server/src/main/java/org/jetbrains/bsp/bazel/server/BUILD
Expand Up @@ -16,15 +16,13 @@ kt_jvm_library(
"//executioncontext/workspacecontext",
"//logger",
"//server/src/main/java/org/jetbrains/bsp/bazel/server/bep",
"//server/src/main/java/org/jetbrains/bsp/bazel/server/bloop",
"//server/src/main/java/org/jetbrains/bsp/bazel/server/bsp",
"//server/src/main/java/org/jetbrains/bsp/bazel/server/bsp/info",
"//server/src/main/java/org/jetbrains/bsp/bazel/server/bsp/managers",
"//server/src/main/java/org/jetbrains/bsp/bazel/server/bsp/utils",
"//server/src/main/java/org/jetbrains/bsp/bazel/server/common",
"//server/src/main/java/org/jetbrains/bsp/bazel/server/diagnostics",
"//server/src/main/java/org/jetbrains/bsp/bazel/server/sync",
"@maven//:ch_epfl_scala_bloop_config_2_13",
"@maven//:ch_epfl_scala_bsp4j",
"@maven//:org_eclipse_lsp4j_org_eclipse_lsp4j_jsonrpc",
],
Expand Down
25 changes: 0 additions & 25 deletions server/src/main/java/org/jetbrains/bsp/bazel/server/bloop/BUILD

This file was deleted.

0 comments on commit 3d23205

Please sign in to comment.