Skip to content

Commit 501963b

Browse files
committed
bazel: post-review fixes
- Reorganize repository. - Remove placeholders. - Remove unnecessary deps. - Improve docs. - Remove `.cargo/`. - Remove `cargo.from_cargo` usage.
1 parent d4327ee commit 501963b

File tree

20 files changed

+55
-242
lines changed

20 files changed

+55
-242
lines changed

.cargo/config.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.

Cargo.lock

Lines changed: 1 addition & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22
resolver = "2"
33
# Split to default members without tests and examples.
44
# Used when executing cargo from project root.
5-
default-members = ["src/mw/_placeholder"]
5+
default-members = ["src/log"]
66
# Include tests and examples as a member for IDE support and Bazel builds.
7-
members = [
8-
"src/mw/_placeholder",
9-
"examples/mw/_placeholder_example",
10-
"tests/mw/_placeholder",
11-
]
7+
members = ["src/log"]
128

139

1410
[workspace.package]
@@ -19,7 +15,6 @@ authors = ["S-CORE Contributors"]
1915

2016

2117
[workspace.dependencies]
22-
_placeholder = { path = "src/mw/_placeholder" }
2318

2419

2520
[workspace.lints.clippy]

MODULE.bazel

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ bazel_dep(name = "score_toolchains_qnx", version = "0.0.3", dev_dependency = Tru
4040
bazel_dep(name = "rust_qnx8_toolchain", version = "1.2.0", dev_dependency = True)
4141
bazel_dep(name = "score_toolchains_rust", version = "0.1.1", dev_dependency = True)
4242

43-
# Others
44-
bazel_dep(name = "custom_qemu", version = "1.0.0", dev_dependency = True)
45-
46-
bazel_dep(name = "googletest", version = "1.17.0")
43+
# S-CORE crates
44+
bazel_dep(name = "score_crates")
4745

4846
# Overrides
4947
git_override(
@@ -58,6 +56,13 @@ git_override(
5856
remote = "https://github.com/qorix-group/score_virtualization.git",
5957
)
6058

59+
git_override(
60+
module_name = "score_crates",
61+
# TODO: 'commit' and 'remote' shall be updated after the qorix score-crates changes merged to eclipse score-crates
62+
commit = "f0bf4bdf98d8a8ad548256ab24dc08f9ba8f04aa",
63+
remote = "https://github.com/qorix-group/score-crates.git",
64+
)
65+
6166
archive_override(
6267
module_name = "rust_qnx8_toolchain",
6368
strip_prefix = "qnx8",
@@ -66,15 +71,6 @@ archive_override(
6671
],
6772
)
6873

69-
archive_override(
70-
module_name = "custom_qemu",
71-
integrity = "sha256-3V2d+p7nP0tsbrVWOPYUSJogLNal43CIAHEto6Vjdfg=",
72-
strip_prefix = "third_party", # matches top-level dir in the tar
73-
urls = [
74-
"https://github.com/qorix-group/custom-qemu/releases/download/1.0.0/custom_qemu.tar.gz",
75-
],
76-
)
77-
7874
# Extensions
7975

8076
gcc = use_extension("@score_toolchains_gcc//extentions:gcc.bzl", "gcc", dev_dependency = True)
@@ -119,26 +115,16 @@ register_toolchains(
119115
dev_dependency = True,
120116
)
121117

122-
# Module deps
123-
124-
# Crate configs
125118
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
126-
crate.from_cargo(
127-
name = "score_baselibs_rust_crates",
128-
cargo_lockfile = "//:Cargo.lock",
129-
manifests = [
130-
"//:Cargo.toml",
131-
"//:src/mw/_placeholder/Cargo.toml",
132-
"//:examples/mw/_placeholder_example/Cargo.toml",
133-
"//:tests/mw/_placeholder/Cargo.toml",
134-
],
135119

136-
# This shall not be here but rules_rust 0.61.0 or even 0.67.0 does not correct finds out that when we use out platform it shall append
120+
crate.from_specs(
121+
name = "baselibs_rust_crates",
122+
# This shall not be here but rules_rust 0.61.0 or even 0.67.0 does not correctly finds out that when we use our platform it shall append
137123
# aarch64-unknown-nto-qnx710 or best aarch64-unknown-nto-qnx800 which is not fully supported in any rust_rules version for now (even if rustc 1.86.0 already supports it)
138124
supported_platform_triples = [
139125
"aarch64-unknown-nto-qnx710", # This enables also QNX8 because OS and CPU for platform matches....
140126
"x86_64-unknown-linux-gnu",
141127
"x86_64-unknown-none",
142128
],
143129
)
144-
use_repo(crate, "score_baselibs_rust_crates")
130+
use_repo(crate, "baselibs_rust_crates")

README.md

Lines changed: 18 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,25 @@
22

33
Foundational Rust libraries providing common functionality for S-CORE modules.
44

5-
This repository serves as a **template** for setting up **C++ and Rust projects** using **Bazel**.
6-
It provides a **standardized project structure**, ensuring best practices for:
7-
8-
- **Build configuration** with Bazel.
9-
- **Testing** (unit and integration tests).
10-
- **Documentation** setup.
11-
- **CI/CD workflows**.
12-
- **Development environment** configuration.
13-
145
---
156

167
## 📂 Project Structure
178

18-
| File/Folder | Description |
19-
| ----------------------------------- | ------------------------------------------------- |
20-
| `README.md` | Short description & build instructions |
21-
| `src/` | Source files for the module |
22-
| `tests/` | Unit tests (UT) and integration tests (IT) |
23-
| `examples/` | Example files used for guidance |
24-
| `docs/` | Documentation (Doxygen for C++ / mdBook for Rust) |
25-
| `.github/workflows/` | CI/CD pipelines |
26-
| `.vscode/` | Recommended VS Code settings |
27-
| `.bazelrc`, `MODULE.bazel`, `BUILD` | Bazel configuration & settings |
28-
| `project_config.bzl` | Project-specific metadata for Bazel macros |
29-
| `LICENSE.md` | Licensing information |
30-
| `CONTRIBUTION.md` | Contribution guidelines |
9+
| File/Folder | Description |
10+
| ---------------------------------------------------- | ------------------------------------------ |
11+
| `README.md` | Short description and build instructions |
12+
| `src/` | Source files |
13+
| `tests/` | Unit tests (UT) and integration tests (IT) |
14+
| `examples/` | Usage examples |
15+
| `docs/` | Documentation using `docs-as-code` |
16+
| `.github/workflows/` | CI/CD pipelines |
17+
| `.vscode` | Recommended VS Code settings |
18+
| `.bazelrc`, `.bazelversion`, `MODULE.bazel`, `BUILD` | Bazel configuration and settings |
19+
| `Cargo.toml`, `rust-toolchain.toml`, `rustfmt.toml` | Cargo configuration and settings |
20+
| `project_config.bzl` | Project-specific metadata for Bazel macros |
21+
| `LICENSE`, `LICENSE.md` | Licensing information |
22+
| `CONTRIBUTION.md` | Contribution guidelines |
23+
| `NOTICE` | Notices for Eclipse Safe Open Vehicle Core |
3124

3225
---
3326

@@ -36,8 +29,8 @@ It provides a **standardized project structure**, ensuring best practices for:
3629
### 1️⃣ Clone the Repository
3730

3831
```sh
39-
git clone https://github.com/eclipse-score/YOUR_PROJECT.git
40-
cd YOUR_PROJECT
32+
git clone https://github.com/eclipse-score/baselibs_rust.git
33+
cd baselibs_rust
4134
```
4235

4336
### 2️⃣ Build the Examples of module
@@ -75,9 +68,8 @@ bazel test //tests/...
7568

7669
## 🛠 Tools & Linters
7770

78-
The template integrates **tools and linters** from **centralized repositories** to ensure consistency across projects.
71+
**Tools and linters** from **centralized repositories** are integrated to ensure consistency across projects.
7972

80-
- **C++:** `clang-tidy`, `cppcheck`, `Google Test`
8173
- **Rust:** `clippy`, `rustfmt`, `Rust Unit Tests`
8274
- **CI/CD:** GitHub Actions for automated builds and tests
8375

@@ -86,30 +78,3 @@ The template integrates **tools and linters** from **centralized repositories**
8678
## 📖 Documentation
8779

8880
- A **centralized docs structure** is planned.
89-
90-
---
91-
92-
## ⚙️ `project_config.bzl`
93-
94-
This file defines project-specific metadata used by Bazel macros, such as `dash_license_checker`.
95-
96-
### 📌 Purpose
97-
98-
It provides structured configuration that helps determine behavior such as:
99-
100-
- Source language type (used to determine license check file format)
101-
- Safety level or other compliance info (e.g. ASIL level)
102-
103-
### 📄 Example Content
104-
105-
```python
106-
PROJECT_CONFIG = {
107-
"asil_level": "QM", # or "ASIL-A", "ASIL-B", etc.
108-
"source_code": ["cpp", "rust"] # Languages used in the module
109-
}
110-
```
111-
112-
### 🔧 Use Case
113-
114-
When used with macros like `dash_license_checker`, it allows dynamic selection of file types
115-
(e.g., `cargo`, `requirements`) based on the languages declared in `source_code`.

docs/index.rst

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ This documentation describes the Rust base libraries.
2424
Overview
2525
--------
2626

27-
This repository provides a standardized setup for projects using **C++** or **Rust** and **Bazel** as a build system.
28-
It integrates best practices for build, test, CI/CD and documentation.
27+
Foundational Rust libraries providing common functionality for S-CORE modules.
2928

3029
Requirements
3130
------------
@@ -35,13 +34,21 @@ Requirements
3534
Project Layout
3635
--------------
3736

38-
The module template includes the following top-level structure:
37+
Project is structured in following manner:
3938

40-
- `src/`: Main C++/Rust sources
41-
- `tests/`: Unit and integration tests
39+
- `README.md`: Short description and build instructions
40+
- `src/`: Source files
41+
- `tests/`: Unit tests (UT) and integration tests (IT)
4242
- `examples/`: Usage examples
4343
- `docs/`: Documentation using `docs-as-code`
4444
- `.github/workflows/`: CI/CD pipelines
45+
- `.vscode`: Recommended VS Code settings
46+
- `.bazelrc`, `.bazelversion`, `MODULE.bazel`, `BUILD`: Bazel configuration and settings
47+
- `Cargo.toml`, `rust-toolchain.toml`, `rustfmt.toml`: Cargo configuration and settings
48+
- `project_config.bzl`: Project-specific metadata for Bazel macros
49+
- `LICENSE`, `LICENSE.md`: Licensing information
50+
- `CONTRIBUTION.md`: Contribution guidelines
51+
- `NOTICE`: Notices for Eclipse Safe Open Vehicle Core
4552

4653
Quick Start
4754
-----------
@@ -57,19 +64,3 @@ To run tests:
5764
.. code-block:: bash
5865
5966
bazel test //tests/...
60-
61-
Configuration
62-
-------------
63-
64-
The `project_config.bzl` file defines metadata used by Bazel macros.
65-
66-
Example:
67-
68-
.. code-block:: python
69-
70-
PROJECT_CONFIG = {
71-
"asil_level": "QM",
72-
"source_code": ["cpp", "rust"]
73-
}
74-
75-
This enables conditional behavior (e.g., choosing `clang-tidy` for C++ or `clippy` for Rust).
File renamed without changes.

examples/BUILD

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/Cargo.lock

Lines changed: 0 additions & 18 deletions
This file was deleted.

examples/mw/_placeholder_example/BUILD

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)