• Stars
    star
    762
  • Rank 59,625 (Top 2 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

IntelliJ plugin for Bazel projects

An IntelliJ plugin for Bazel projects

This is an early-access version of our Bazel plugins for IntelliJ, Android Studio, and CLion.

The Bazel plugin uploaded to the JetBrains Marketplace regularly from the state of this repository. See the releases tab for more information.

Please see our latest community update for Bazel IntelliJ plugin: Announcing Bazel & JetBrains co-maintenance of IntelliJ IDEA Bazel Plugin.

Community

The Bazel project is hosting a Special Interest Group (SIG) for Bazel IntelliJ IDE plug-in. Details about the SIG and how to join the discussion can be found in the SIG charter.

Support

See the documentation entry on the plugin support across JetBrains products, languages, and operating systems.

Installation

You can find our plugin in the JetBrains Marketplace or directly from the IDE by going to Settings -> Plugins -> Marketplace, and searching for Bazel.

Beta versions

Beta versions are usually uploaded to the Beta channel 2 weeks before they become full releases. Ways to install them:

  • download and install them manually from the Beta channel page on JetBrains Marketplace
  • add the Beta channel to the IDE under Settings -> Plugins -> Gear Icon -> Manage Plugin repositories and add one of the following URLs depending on your product. You can now find the latest Beta under Settings -> Plugins -> Marketplace or update the Bazel plugin to Beta if you already installed it.
    • IntelliJ IDEA -> https://plugins.jetbrains.com/plugins/beta/8609
    • CLion -> https://plugins.jetbrains.com/plugins/beta/9554
    • Android Studio -> https://plugins.jetbrains.com/plugins/beta/9185

Usage

To import an existing Bazel project, choose Import Bazel Project, and follow the instructions in the project import wizard.

Detailed docs are available here.

Building the plugin

Install Bazel, then build the target *:*_bazel_zip for your desired product:

  • bazel build //ijwb:ijwb_bazel_zip --define=ij_product=intellij-ue-oss-latest-stable
  • bazel build //clwb:clwb_bazel_zip --define=ij_product=clion-oss-latest-stable
  • bazel build //aswb:aswb_bazel_zip --define=ij_product=android-studio-oss-latest-stable

from the project root. This will create a plugin zip file at bazel-bin/<PRODUCT>/<PRODUCT>_bazel.zip, which can be installed directly from the IDE. <PRODUCT> can be one of ijwb, clwb, aswb.

If the IDE refuses to load the plugin because of version issues, specify the correct ij_product. These are in the form <IDE>-oss-<VERSION> with

  • <IDE> being one of intellij-ue, intellij, clion, android-studio,
  • <VERSION> being one of oldest-stable, latest-stable, under-dev.

Note that there is a difference between intellij and intellij-ue. ue stands for IntelliJ Ultimate Edition and contains additional features for JavaScript as well as Go.

<IDE>-oss-oldest-stable and <IDE>-oss-latest-stable are aliases for the two IDE versions that the plugin is officially compatible with at a given time. <IDE>-oss-latest-stable usually maps to the last released IDE version while <IDE>-oss-oldest-stable maps to the one right before that, e.g. <IDE>-oss-oldest-stable=2022.1 and <IDE>-oss-latest-stable=2022.2. Additionally, <IDE>-oss-under-dev represents the upcoming version of the IDE that we are working towards supporting. A complete mapping of all currently defined versions can be found in intellij_platform_sdk/build_defs.bzl.

You can import the project into IntelliJ (with the Bazel plugin) via importing the ijwb/ijwb.bazelproject file.

Compatibility with IDE Versions

You can build the plugin for different IDE versions by adjusting the ij_product option either from command line or by updating the .bazelproject file to specify the desired value for ij_product under build_flags.

We have three aliases for product versions;

  • oldest-stable is the oldest IDE version supported by the Bazel plugin released to the JetBrains stable channel.
  • latest-stable is the latest IDE version supported by the Bazel plugin released to the JetBrains stable channel.
  • under-dev is the IDE version we are currently working towards supporting.

The current corresponding IDE versions of these aliases can be found here.

Contributions

We welcome contributions to support new IDE versions. However, to make the review process faster and easier, we recommend the following:

  • We can only accept small pull requests. Smaller pull requests tend to have fewer review comments and hence can get submitted much faster. They also tend to conflict less with our internal code base, simplifying the integration for us. For example, you should have separate pull requests each focusing on a certain incompatible change rather than having a large pull request fixing multiple ones.

  • Since we continue to support a number of IDE versions while working on a new one, you need to make sure that your proposed changes do not break older versions. Our presubmit pipeline will take care of testing your changes against all the supported versions and lets you know whether it broke anything.

  • To facilitate merging your changes into upstream, we recommend following our procedure for supporting SDK backward-compatibility.

    • First consider adjusting the plugin code so that it directly works with different IDE versions. Example strategies for this would be:

      • Switching to a (possibly newer) IntelliJ platform API which is available in all relevant IDE versions. Example: pr/2623
      • Switching to a raw class by removing a generic type parameter which differs across versions. Example: pr/2631
    • For non-trivial incompatible changes, the code for maintaining SDK compatibility lives in sdkcompat and testing/testcompat directories, where testing/testcompat holds test-only SDK compatibility changes. Each of the two directories contains a sub-folder per supported IDE version with version-specific implementations. The outside API of all classes must be the same across versions, just the implementation may differ. When introducing a new file in this directory, make sure to duplicate it appropriately across all versions.
      We follow these three techniques for non-trivial incompatible changes.

      • Compat
        Preferred to Adapter and Wrapper when applicable. We add a util-class with only static methods and a private constructor and wrap the changed method by one of the static methods. If the change is small enough, you do not need to create a new util-class and should add the change to BaseSdkCompat class instead. Example: pr/2345

      • Adapter
        Used when we extend a super class and its constructor is updated. We create a new class extending the changed super class then extend this new class from the plugin code. Example: pr/2352

      • Wrapper
        Created when a new interface is used in a super class constructor. We create a wrapper class that wraps and supplies the old or the new interface based on the SDK version and use this wrapper class in the plugin code. Example: pr/2166

  • All compat changes must be commented with #api{API_VERSION}, e.g. #api203. This represents the last API version that requires the code, i.e. the one before the version you aim to support. This is needed to make it easier to find and clean up this functionality when paving old versions.

  • Compat classes must never import plugin code and we try to keep the logic and code in them as minimal as possible.

We may also be able to accept contributions to fix general issues or adding new features with some caveats:

  • Before opening a pull request, first file an issue and discuss potential changes with the devs. This will often save you time you would otherwise have invested in a patch which can't be applied.
  • Improvements for old not supported IDE versions will not be accepted. Your changes should target the currently supported IDE versions. You can find a list of these versions here.
  • We can't accept stylistic, refactoring, or "cleanup" changes.
  • We have very limited bandwidth, and applying patches upstream is a time-consuming process. Large patches generally can't be accepted unless there's clear value for all our users.

More Repositories

1

bazel

a fast, scalable, multi-language and extensible build system
Java
22,794
star
2

starlark

Starlark Language
Starlark
2,435
star
3

bazelisk

A user-friendly launcher for Bazel.
Go
2,060
star
4

rules_go

Go rules for Bazel
Go
1,356
star
5

bazel-gazelle

Gazelle is a Bazel build file generator for Bazel projects. It natively supports Go and protobuf, and it may be extended to support new languages and custom rule sets.
Go
1,156
star
6

rules_docker

Rules for building and handling Docker images with Bazel
Starlark
1,074
star
7

buildtools

A bazel BUILD file formatter and editor
Go
1,007
star
8

examples

Examples for Bazel
Starlark
831
star
9

rules_rust

Rust rules for Bazel
Starlark
660
star
10

bazel-buildfarm

Bazel remote caching and execution service
Java
650
star
11

tulsi

An Xcode Project Generator For Bazel
Swift
547
star
12

rules_python

Bazel Python Rules
Starlark
521
star
13

rules_apple

Bazel rules to build apps for Apple platforms.
Starlark
509
star
14

bazel-watcher

Tools for building Bazel targets when source files change.
Go
440
star
15

bazel-skylib

Common useful functions and rules for Bazel
Starlark
393
star
16

sandboxfs

A virtual file system for sandboxing
Rust
371
star
17

rules_scala

Scala rules for Bazel
Starlark
360
star
18

rules_kotlin

Bazel rules for Kotlin
Kotlin
331
star
19

remote-apis

An API for caching and execution of actions on a remote system.
Go
328
star
20

rules_swift

Bazel rules to build Swift on Apple and Linux platforms
Starlark
311
star
21

rules_k8s

This repository contains rules for interacting with Kubernetes configurations / clusters.
Starlark
289
star
22

rules_typescript

MOVED to https://github.com/bazelbuild/rules_nodejs/tree/3.x/third_party/github.com/bazelbuild/rules_typescript
TypeScript
275
star
23

continuous-integration

Bazel's Continuous Integration Setup
Python
258
star
24

bazel-central-registry

The central registry of Bazel modules for the Bzlmod external dependency system.
Starlark
247
star
25

rules_pkg

Bazel rules for creating packages of many types (zip, tar, deb, rpm, ...)
Starlark
225
star
26

rules_cc

C++ Rules for Bazel
Starlark
184
star
27

bazel-toolchains

Repository that hosts Bazel toolchain configs for remote execution and related support tools.
Go
183
star
28

rules_android

Android rules for Bazel
Starlark
175
star
29

rules_proto

Protocol buffer rules for Bazel
Starlark
163
star
30

rules_closure

Closure rules for Bazel
Java
153
star
31

vim-bazel

Vim support for Bazel
Vim Script
144
star
32

platforms

Constraint values for specifying platforms and toolchains
Starlark
108
star
33

stardoc

Stardoc: Starlark Documentation Generator
Java
107
star
34

proposals

Index of all Bazel proposals and design documents
106
star
35

rules_webtesting

Bazel rules to allow testing against a browser with WebDriver.
Go
96
star
36

apple_support

Apple support for Bazel rules
Starlark
83
star
37

emacs-bazel-mode

Emacs mode for Bazel
Emacs Lisp
80
star
38

rules_license

Starlark
77
star
39

rules_java

Java rules for Bazel
Starlark
72
star
40

reclient

Go
65
star
41

setup-bazelisk

Set up your GitHub Actions workflow with a specific version of Bazelisk
TypeScript
56
star
42

rules_sass

Sass rules for Bazel
Starlark
51
star
43

remote-apis-sdks

This repository contains client libraries for the Remote Execution API https://github.com/bazelbuild/remote-apis
Go
48
star
44

bazel-federation

Starlark
47
star
45

skydoc

Documentation generator for Skylark
Python
46
star
46

migration-tooling

Migration tools for Bazel
Java
44
star
47

codelabs

Shell
39
star
48

BUILD_file_generator

Generate BUILD files for your Java files
Java
39
star
49

eclipse

Eclipse For Bazel (deprecated, see https://github.com/salesforce/bazel-eclipse instead)
Java
32
star
50

bazel-integration-testing

Framework for integration tests that call Bazel
Java
32
star
51

rules_appengine

AppEngine rules for Bazel
Starlark
30
star
52

rules_android_ndk

Starlark
29
star
53

tools_remote

Java
28
star
54

bazel-bench

Benchmarking tool for bazel
Python
27
star
55

vim-ft-bzl

Vim Script
27
star
56

rules_perl

Perl rules for Bazel
Starlark
25
star
57

tools_android

Tools for use with building Android apps with Bazel
Starlark
24
star
58

homebrew-tap

This repository contains a collection of Homebrew (aka, Brew) "formulae" for Bazel
24
star
59

rules_d

D rules for Bazel
Starlark
24
star
60

bazel-blog

Content of the Bazel blog
HTML
20
star
61

bzlmod

Go
20
star
62

rules_testing

Starlark testing framework and utility libraries
Starlark
20
star
63

rules_gwt

Bazel rules for GWT
Starlark
19
star
64

bazel-website

Website for Bazel, a fast, scalable, multi-language and extensible build system
HTML
17
star
65

bazelcon

Artifacts from BazelCon
15
star
66

java_tools

Python
12
star
67

rules_groovy

Groovy rules for Bazel
Starlark
11
star
68

rules_postcss

PostCSS rules for Bazel
Starlark
10
star
69

rules_platform

Starlark
8
star
70

bazel_metrics

Python
7
star
71

community

Resources for community management efforts, such as SIGs
6
star
72

rules_angular

OBSOLETE see https://github.com/angular/angular/tree/master/packages/bazel
Python
5
star
73

gmaven_rules

This repository is deprecated. Please instead use https://github.com/bazelbuild/rules_jvm_external
Python
3
star
74

rules_utp

Starlark
2
star
75

.allstar

1
star
76

.github

1
star
77

bazel-worker-api

Java
1
star
78

build-event-stream

1
star
79

rules_sh

1
star