Skip to content

Latest commit

 

History

History

server

JetBrains team project TeamCity build status Bazel Steward badge

Bazel BSP

An implementation of the Build Server Protocol for Bazel.

Supported languages

  • Java
  • Kotlin
  • Scala
  • Python
  • Thrift
  • Rust

Installation

Easy way (coursier)

  1. Have coursier installed

  2. Run in the directory where Bazel BSP should be installed:

    cs launch org.jetbrains.bsp:bazel-bsp:<version> -M org.jetbrains.bsp.bazel.install.Install -- --targets //...

    We currently publish only Nightly releases to Maven. Please check Maven Central to find the newest available version.

  3. Add bsp generated folders to your .gitignore: .bsp and .bazelbsp

The more difficult way (from sources)

Might be useful during development.

Using the install script

  1. Be inside this project
  2. Run bazel run //server/install:install -- <installer flags> (--help is available)

Using coursier

  1. Have coursier installed
  2. Be inside this project
  3. Change the project version - maven_coordinates attribute in the server/src/main/kotlin/org/jetbrains/bsp/bazel/BUILD file
  4. Publish a new version:
    bazel run --stamp --define "maven_repo=file://$HOME/.m2/repository" //server/src/main/kotlin/org/jetbrains/bsp/bazel:bsp.publish
  5. Enter the directory where Bazel BSP should be installed
  6. Install your version:
    cs launch -r m2Local org.jetbrains.bsp:bazel-bsp:<your version> -M org.jetbrains.bsp.bazel.install.Install

Project Views

To work on huge monorepos, you might want to specify directories and targets to work on. To address this issue, Bazel BSP supports (partly) the Project Views introduced by Google.

Check project view readme for more info.

Tests

Unit tests

Run bazel test //... to execute all the unit tests.

End-to-end tests

e2e directory contains end-2-end tests that check various scenarios of server usage.

Tests are marked as manual so they won't be executed on bazel test //... but you can run all of them using: bazel test //e2e:all_tests

In order to run a specific test with specific bazel version you can use: bazel test //e2e:<test name>_bazel_<bazel version_major>_x (bazel test //e2e:<test name>_bazel_current to use bazel version defined in .bazelversion file) or bazel test //e2e:<test name>_bazel_<bazel version>

e.g. bazel test //e2e:sample_repo_test_bazel_6_x or bazel test //e2e:sample_repo_test_bazel_current or bazel test //e2e:sample_repo_test_bazel_6_4_0

In order to run a specific test with all bazel versions you can use: bazel test //e2e:<test name>

e.g. bazel test //e2e:sample_repo_test

Contributing

Want to contribute? Great! Follow these rules.