Skip to content

Commit 185cf85

Browse files
nradakovicAlexanderLanin
authored andcommitted
Fix: README.md and directory
The current proposal doesn't work with provided instructions.
1 parent 32b5df3 commit 185cf85

File tree

11 files changed

+118
-89
lines changed

11 files changed

+118
-89
lines changed

BUILD

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
113
load("@score_cr_checker//:cr_checker.bzl", "copyright_checker")
214

315
copyright_checker(
4-
name = "copyright_check",
5-
srcs = ["src"],
16+
name = "copyright",
17+
srcs = [
18+
"src",
19+
"tests",
20+
"//:BUILD",
21+
"//:MODULE.bazel",
22+
],
623
template = "@score_cr_checker//resources:templates",
724
config = "@score_cr_checker//resources:config",
825
visibility = ["//visibility:public"],

MODULE.bazel

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,38 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
113
module(name = "cpp_rust_template_repository", version = "1.0")
214

3-
415
# Add GoogleTest dependency
516
bazel_dep(name = "googletest", version = "1.14.0")
617

718
# Rust rules for Bazel
819
bazel_dep(name = "rules_rust", version = "0.56.0")
920

10-
11-
# Add your custom module from the bazel_registry
21+
# Checker rule for CopyRight checks/fixs
1222
bazel_dep(name = "score_cr_checker", version = "0.2.0")
23+
24+
# C/C++ rules for Bazel
25+
bazel_dep(name = "rules_cc", version = "0.1.1")
26+
27+
# LLVM Toolchains Rules - host configuration
28+
bazel_dep(name = "toolchains_llvm", version = "1.2.0")
29+
30+
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
31+
llvm.toolchain(
32+
cxx_standard = {"": "c++17"},
33+
llvm_version = "19.1.0",
34+
)
35+
use_repo(llvm, "llvm_toolchain")
36+
use_repo(llvm, "llvm_toolchain_llvm")
37+
38+
register_toolchains("@llvm_toolchain//:all")

README.md

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,67 @@
22

33
This repository serves as a **template** for setting up **C++ and Rust projects** using **Bazel**.
44
It provides a **standardized project structure**, ensuring best practices for:
5+
56
- **Build configuration** with Bazel.
67
- **Testing** (unit and integration tests).
78
- **Documentation** setup.
89
- **CI/CD workflows**.
910
- **Development environment** configuration.
1011

11-
The template includes a **basic "Hello World" example** for both **C++ and Rust**, making it **buildable out of the box**.
12-
1312
---
1413

1514
## 📂 Project Structure
1615

17-
| File/Folder | Description |
18-
|-----------------------|-------------|
19-
| `README.md` | Short description & build instructions |
20-
| `src/` | Source files for the module |
21-
| `tests/` | Unit tests (UT) and integration tests (IT) |
22-
| `docs/` | Documentation (Doxygen for C++ / mdBook for Rust) |
23-
| `.github/workflows/` | CI/CD pipelines |
24-
| `.vscode/` | Recommended VS Code settings |
25-
| `.bazelrc`, `MODULE.bazel`, `BUILD` | Bazel configuration & settings |
26-
| `LICENSE.md` | Licensing information |
27-
| `CONTRIBUTION.md` | Contribution guidelines |
16+
| File/Folder | Description |
17+
| ----------------------------------- | ------------------------------------------------- |
18+
| `README.md` | Short description & build instructions |
19+
| `src/` | Source files for the module |
20+
| `tests/` | Unit tests (UT) and integration tests (IT) |
21+
| `docs/` | Documentation (Doxygen for C++ / mdBook for Rust) |
22+
| `.github/workflows/` | CI/CD pipelines |
23+
| `.vscode/` | Recommended VS Code settings |
24+
| `.bazelrc`, `MODULE.bazel`, `BUILD` | Bazel configuration & settings |
25+
| `LICENSE.md` | Licensing information |
26+
| `CONTRIBUTION.md` | Contribution guidelines |
2827

2928
---
3029

3130
## 🚀 Getting Started
3231

3332
### 1️⃣ Clone the Repository
33+
3434
```sh
3535
git clone https://github.com/eclipse-score/YOUR_PROJECT.git
3636
cd YOUR_PROJECT
3737
```
3838

39-
### 2️⃣ Build the Project
40-
#### C++
41-
```sh
42-
bazel build //...
43-
```
44-
#### Rust
45-
```sh
46-
bazel build //rust/...
47-
```
39+
### 2️⃣ Build the Examples of module
40+
41+
> DISCLAMER: Depending what module implements, it's possible that different
42+
> configuration flags needs to be set on command line.
43+
44+
To build all targets of the module the following command can be used:
4845

49-
### 3️⃣ Run the Example
50-
#### C++
5146
```sh
52-
bazel run //src:main
47+
bazel build //src/...
5348
```
54-
#### Rust
49+
50+
This command will instruct Bazel to build all targets that are under Bazel
51+
package `src/`. The ideal solution is to provide single target that builds
52+
artifacts, for example:
53+
5554
```sh
56-
bazel run //rust:main
55+
bazel build //src/<module_name>:release_artifacts
5756
```
5857

59-
### 4️⃣ Run Tests
58+
where `:release_artifacts` is filegroup target that collects all release
59+
artifacts of the module.
60+
61+
> NOTE: This is just proposal, the final decision is on module maintainer how
62+
> the module code needs to be built.
63+
64+
### 3️⃣ Run Tests
65+
6066
```sh
6167
bazel test //tests/...
6268
```

src/BUILD

Whitespace-only changes.

src/cpp/BUILD

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

src/cpp/main.cpp

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

src/rust/BUILD

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

src/rust/main.rs

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

tests/cpp/BUILD

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
113
cc_test(
214
name = "cpp_test_main",
315
srcs = ["test_main.cpp"],

tests/cpp/test_main.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/********************************************************************************
2+
* Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
*
4+
* See the NOTICE file(s) distributed with this work for additional
5+
* information regarding copyright ownership.
6+
*
7+
* This program and the accompanying materials are made available under the
8+
* terms of the Apache License Version 2.0 which is available at
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* SPDX-License-Identifier: Apache-2.0
12+
********************************************************************************/
113
#include <gtest/gtest.h>
214

315
// Function to be tested

0 commit comments

Comments
 (0)