|
2 | 2 |
|
3 | 3 | This repository serves as a template for setting up tools and toolchains used in Score, providing small examples that demonstrate how these tools work in practice. |
4 | 4 |
|
5 | | -## Available Toolchains |
| 5 | +> NOTE: The example directory only exist to show how configurations work and it's not mandatory to keep it in derivative repositories. |
6 | 6 |
|
7 | | -Currently, the repository includes: |
| 7 | +## Available Tools & Toolchains |
8 | 8 |
|
9 | | -- LLVM from the Bazel community |
| 9 | +The repository includes: |
10 | 10 |
|
11 | | -## Setting Up Toolchains in Your Module |
| 11 | +- LLVM from the Bazel community - Host C++ toolchain which is by default registered for host platform. |
| 12 | +- CopyRight checker tool `cr_checker` - Small utility tool which will check presence of copyright header in selected source files. |
12 | 13 |
|
13 | | -To integrate a toolchain into your Bazel module, follow these steps: |
| 14 | +## Setting Up Your Module |
14 | 15 |
|
15 | | -- Copy the relevant content from MODULE.bazel in this repository. |
16 | | -- Add the necessary bazel_dep() entries to your module’s MODULE.bazel file. |
17 | | -- Ensure your build configurations align with the toolchain requirements. |
| 16 | +To integrate default tools & toolchain into your Bazel module, the best practise is to follow these steps: |
| 17 | + |
| 18 | +- Setup module name in `MODULE.bazel` file, that needs to be in the root of new module. Assuming that the new module name is `score_guidelines`, the first lines of `MODULE.bazel` file are: |
| 19 | + |
| 20 | + ```python |
| 21 | + module( |
| 22 | + name = "score_guidelines", # the module name |
| 23 | + version = "0.1", # the version of module |
| 24 | + compatibility_level = 0, # the compatibility level of the module. |
| 25 | + ) |
| 26 | + ``` |
| 27 | + |
| 28 | + > NOTE: To see all available attributes of `module` function, visit [MODULE.bazel](https://bazel.build/rules/lib/globals/module#module) on Bazel documentation webpage. |
| 29 | +
|
| 30 | +- The next step is to copy the relevant content from [MODULE.bazel](https://github.com/eclipse-score/examples/blob/main/MODULE.bazel#L20-L49) (everything except the `examples` module name) in new module `MODULE.bazel` file. If `cr_checker` is the only tool that needs to be integrated in new module (repo) from all tools available in `examples` repo, we only need to copy following line: |
| 31 | + |
| 32 | + ```python |
| 33 | + bazel_dep(name = "score_cr_checker", version = "0.2.0") |
| 34 | + ``` |
| 35 | + |
| 36 | + The same approuch needs to be done with any other tool that is in `examples/MODULE.bazel` file or, as already said, |
| 37 | + |
| 38 | +- Copy the `.bazelrc` file as is since it holds essential configuration for setting up [SBR](https://github.com/eclipse-score/bazel_registry) (S-CORE Bazel registry). |
| 39 | + |
| 40 | + ```ini |
| 41 | + common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ |
| 42 | + common --registry=https://bcr.bazel.build |
| 43 | + ``` |
| 44 | + |
| 45 | +- Copy the .gitignore file. |
18 | 46 |
|
19 | 47 | This approach allows developers to quickly set up and reuse toolchains in their own projects with minimal effort. |
0 commit comments