agluszak / bazel-bsp

An implementation of the Build Server Protocol for Bazel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JetBrains team project Format Integration tests Unit tests

Bazel BSP

An implementation of the Build Server Protocol for Bazel.

Status

Below is a list of languages supported over Bazel BSP and their implementation status.

  • Language: name of the Language
  • Import: Ability to import a project's targets, sources, dependencies, and resources.
  • Compilation: Ability to compile
  • Run: Ability to run
  • Test: Ability to test
  • Prerequisites: Any prerequisites needed to properly run the server to its full capabilities
Language Import Compilation Run Test Diagnostics Prerequisites Notes
Scala Toolchain Registration N/A
Java N/A N/A
Kotlin Requires this version of rules_kotlin KotlinJS support is minimal and not advised without further setting changes. Java source files in a kotlin rule will not possess diagnostics.

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:1.1.1 -M org.jetbrains.bsp.bazel.install.Install
  1. Add bsp generated folders to your .gitignore: .bsp and .bazelbsp

More difficult way (from sources)

Might be useful during development

Using install script

  1. Be inside this project
  2. Run ./install.sh if you want to install Bazel BSP in this project or ./install.sh <path to the directory> if you want to install it in a different directory

Using coursier

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

Project Views

In order 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

End-to-end tests

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

  • bazel run //e2e:all - to run all tests
  • bazel run //e2e:<specific test> - to run a specific test (to see all possible tests, check the e2e/BUILD file)

Unit tests

Most modules also have unit tests that can be run using bazel test //<module>/... or just bazel test //... to run all tests in the project.

Contributing

Want to contribute? Great! Follow these rules.

About

An implementation of the Build Server Protocol for Bazel

License:Apache License 2.0


Languages

Language:Java 87.3%Language:Starlark 11.7%Language:Shell 0.7%Language:Scala 0.3%Language:C++ 0.0%