Building with Bazel

Registry Configuration

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.

Adding 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.

Finding 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.

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.

Remote Cache

A remote cache is available in CI pipelines. It reduces rebuild time across runs by sharing build artifacts between jobs.

Lock Files

MODULE.bazel.lock and uv.lock should be committed to the repository. When dependency declarations change, refresh lock files via pre-commit:

pre-commit run --all-files

Starting a New Module

Use module_template as a starting point for new Bazel module repositories. It provides the standard directory layout, .bazelrc, devcontainer configuration, and CI workflows.