How to Build with Bazel#

Configure registries#

Every S-CORE module repository configures two Bazel registries in .bazelrc:

common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/
common --registry=https://bcr.bazel.build

The first line resolves S-CORE internal modules. The second line falls back to the public Bazel Central Registry for everything else.

Add a dependency#

Declare dependencies in MODULE.bazel:

bazel_dep(name = "my_dependency", version = "1.2.3")

Use the Registry UI to discover available modules and their versions.

Find available modules#

The Registry UI lists all modules published to the S-CORE registry. Each registry entry corresponds to a GitHub Release in the module’s repository.

Configure toolchains#

Build-side toolchains and policy modules are separate concerns:

Repository

Role

bazel_cpp_toolchains

How to compile C++ (Linux, QNX)

toolchains_rust

How to compile Rust (incl. Ferrocene)

score_cpp_policies

Which rules to enforce for C++

score_rust_policies

Which rules to enforce for Rust

Toolchains define compilers and linkers. Policies define warning baselines, lint rules, and sanitizer selections. They evolve independently.

Refresh lock files#

MODULE.bazel.lock and uv.lock should be committed. When dependency declarations change, refresh lock files:

pre-commit run --all-files

Start a new module#

Use module_template as a starting point. It provides the standard directory layout, .bazelrc, devcontainer configuration, and CI workflows. See Tutorial: Creating a New Module for a step-by-step walkthrough.