This repository serves as a template for setting up C++ and Rust projects using Bazel. It provides a standardized project structure, ensuring best practices for:
- Build configuration with Bazel.
- Testing (unit and integration tests).
- Documentation setup.
- CI/CD workflows.
- Development environment configuration.
| File/Folder | Description |
|---|---|
README.md |
Short description & build instructions |
src/ |
Source files for the module |
tests/ |
Unit tests (UT) and integration tests (IT) |
examples/ |
Example files used for guidance |
docs/ |
Documentation (Doxygen for C++ / mdBook for Rust) |
.github/workflows/ |
CI/CD pipelines |
.vscode/ |
Recommended VS Code settings |
.bazelrc, MODULE.bazel, BUILD |
Bazel configuration & settings |
project_config.bzl |
Project-specific metadata for Bazel macros |
LICENSE.md |
Licensing information |
CONTRIBUTION.md |
Contribution guidelines |
git clone https://github.com/eclipse-score/YOUR_PROJECT.git
cd YOUR_PROJECTDISCLAIMER: Depending what module implements, it's possible that different configuration flags needs to be set on command line.
To build all targets of the module the following command can be used:
bazel build //src/...This command will instruct Bazel to build all targets that are under Bazel
package src/. The ideal solution is to provide single target that builds
artifacts, for example:
bazel build //src/<module_name>:release_artifactswhere :release_artifacts is filegroup target that collects all release
artifacts of the module.
NOTE: This is just proposal, the final decision is on module maintainer how the module code needs to be built.
bazel test //tests/...The template integrates tools and linters from centralized repositories to ensure consistency across projects.
- C++:
clang-tidy,cppcheck,Google Test - Rust:
clippy,rustfmt,Rust Unit Tests - CI/CD: GitHub Actions for automated builds and tests
- A centralized docs structure is planned.
This file defines project-specific metadata used by Bazel macros, such as dash_license_checker.
It provides structured configuration that helps determine behavior such as:
- Source language type (used to determine license check file format)
- Safety level or other compliance info (e.g. ASIL level)
PROJECT_CONFIG = {
"asil_level": "QM", # or "ASIL-A", "ASIL-B", etc.
"source_code": ["cpp", "rust"] # Languages used in the module
}When used with macros like dash_license_checker, it allows dynamic selection of file types
(e.g., cargo, requirements) based on the languages declared in source_code.