|
| 1 | +.. |
| 2 | + # ******************************************************************************* |
| 3 | + # Copyright (c) 2024 Contributors to the Eclipse Foundation |
| 4 | + # |
| 5 | + # See the NOTICE file(s) distributed with this work for additional |
| 6 | + # information regarding copyright ownership. |
| 7 | + # |
| 8 | + # This program and the accompanying materials are made available under the |
| 9 | + # terms of the Apache License Version 2.0 which is available at |
| 10 | + # https://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + # |
| 12 | + # SPDX-License-Identifier: Apache-2.0 |
| 13 | + # ******************************************************************************* |
| 14 | +
|
| 15 | +Module Template Documentation |
| 16 | +============================= |
| 17 | + |
| 18 | +This documentation describes the structure, usage and configuration of the Bazel-based C++/Rust module template. |
| 19 | + |
| 20 | +.. contents:: Table of Contents |
| 21 | + :depth: 2 |
| 22 | + :local: |
| 23 | + |
| 24 | +Overview |
| 25 | +-------- |
| 26 | + |
| 27 | +This repository provides a standardized setup for projects using **C++** or **Rust** and **Bazel** as a buidl system. |
| 28 | +It integrates best practices for build, test, CI/CD and documentation. |
| 29 | + |
| 30 | +Requirements |
| 31 | +------------ |
| 32 | + |
| 33 | +.. stkh_req:: Example Functional Requirement |
| 34 | + :id: stkh_req__docgen_enabled |
| 35 | + :status: valid |
| 36 | + :safety: QM |
| 37 | + :reqtype: Functional |
| 38 | + :rationale: Ensure documentation builds are possible for all modules |
| 39 | + |
| 40 | + |
| 41 | +Project Layout |
| 42 | +-------------- |
| 43 | + |
| 44 | +The module template includes the following top-level structure: |
| 45 | + |
| 46 | +- `src/`: Main C++/Rust sources |
| 47 | +- `tests/`: Unit and integration tests |
| 48 | +- `examples/`: Usage examples |
| 49 | +- `docs/`: Documentation using `docs-as-code` |
| 50 | +- `.github/workflows/`: CI/CD pipelines |
| 51 | + |
| 52 | +Quick Start |
| 53 | +----------- |
| 54 | + |
| 55 | +To build the module: |
| 56 | + |
| 57 | +.. code-block:: bash |
| 58 | +
|
| 59 | + bazel build //src/... |
| 60 | +
|
| 61 | +To run tests: |
| 62 | + |
| 63 | +.. code-block:: bash |
| 64 | +
|
| 65 | + bazel test //tests/... |
| 66 | +
|
| 67 | +Configuration |
| 68 | +------------- |
| 69 | + |
| 70 | +The `project_config.bzl` file defines metadata used by Bazel macros. |
| 71 | + |
| 72 | +Example: |
| 73 | + |
| 74 | +.. code-block:: python |
| 75 | +
|
| 76 | + PROJECT_CONFIG = { |
| 77 | + "asil_level": "QM", |
| 78 | + "source_code": ["cpp", "rust"] |
| 79 | + } |
| 80 | +
|
| 81 | +This enables conditional behavior (e.g., choosing `clang-tidy` for C++ or `clippy` for Rust). |
0 commit comments