bazel-eclipse Contribution Guide
March 10, 2025 ยท View on GitHub
We welcome any contributions. Please review our code of conduct.
Eclipse Plug-In Development
The Bazel Eclipse Feature as well as the Bazel Java Language Server are developed as a set of Eclipse plug-ins. We recommend you to learn about Eclipse feature and plug-in development in general. Start with something simple before trying to tackle BEF or BJLS.
Recommended resources
Prerequisites
You need:
- latest version of Eclipse IDE for Eclipse Committers
- JDK 21
- Bazelisk available as
bazelbinary inPATHenvironment
Additional Plug-Ins from the Eclipse Marketplace:
- AnyEdit Tools
- Yaml Editor
- Bash Editor
- MoreUnit
- Eclipse Zip Editor
- Target Platform Definition Generator
- Optional: macOS Eclipse Launcher
Setup Workspace & Import Projects
You must always import all projects for both BEF and BJLS. Most code is in a core plug-in shared by both. As a result, modifications in the core plug-in may need adaption in BEF as well as BJLS.
After cloning the repository, follow these steps:
- Launch the Eclipse IDE for Committers with a new workspace
- Ensure JDK 21 is configured (Preferences > Java > Installed JREs)
- Click File > Import > General > Existing Projects into Workspace
- Select the
bazel-eclipsefolder as the root directory - Select Search for nested projects (critical step)
- Eclipse should detect that the projects are there, and offer to import them all (checked by default).
- Click Finish and wait
There will be errors. This is expected at this point. You need to setup the target platform next.
- Open file
bazel-eclipse/releng/target-platform/target-platform-dev.target - Click the Set as Active Target Platform link in the upper right (or Reload Target Platform)
This will run for a long time and download any necessary plug-ins/jars. Once done everything should build.
:fire: If you see errors at this point, please search/see discussions for help.
Import IntelliJ Aspects
- In Eclipse main meny select to Run > External Tools > Import InteliJ Aspects
This will download the IntelliJ Aspects and puts them into a ZIP file for use.
We don't distribute them in our source control.
Note, the shell script requires a working Git and Bazel binary in the PATH.
On MacOS, GNU Tar (gtar) is needed as well (brew install gnu-tar).
Debugging
A common development task is debugging the Bazel Eclipse Feature code. In Eclipse this is done using Debug configurations. For creating a new Debug configuration use the following steps.
- Go to Run > Debug Configurations... (top level menu or toolbar icon)
- Right click on Eclipse Application and select New Configuration
- Give it a name: Bazel Eclipse
- Leave everything as default and click Debug
This should open a second window of Eclipse. Use the second instance to import a Bazel workspace and test the Bazel Eclipse Feature. Continue using the first instance with the Bazel Eclipse Feature code for setting breakpoints, etc. This is called self-hosting.
CI
We use GitHub Actions for our CI system.
How the Build Works
This is explained in more detail in the build guide.
Command Line Build
To build on the command line quickly, run the following commands:
- Import IJ Aspects
pushd ./bundles/com.salesforce.bazel.sdk/aspects/import
./import-and-build.sh
popd
- Run Maven build
./mvnw clean verify