diff --git a/README.md b/README.md index 5ec671b..7784c9b 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ Instead: - Easy addition of new compilers or versions -## Using Toolchains in a Bazel Module +## Using Toolchains in a different Bazel Module ### GCC Example (Linux x86_64) @@ -88,7 +88,6 @@ gcc.use( use_default_package = True, ) use_repo("score_gcc_toolchain", "score_gcc_toolchain_pkg") -registry_toolchains("x86_64-linux-gcc-12.2.0") ``` ### QCC Example (QNX ARM64) @@ -96,15 +95,24 @@ registry_toolchains("x86_64-linux-gcc-12.2.0") ```starlark bazel_dep(name = "score_cpp_toolchains", version = "0.1.0") use_extension("@score_cpp_toolchains//bazel/extentions:gcc.bzl", "qcc") -gcc.use( +qcc.use( target_cpu = "arm64", sdp_version = "8.0.0", use_default_package = True, ) use_repo("score_qcc_toolchain", "score_qcc_toolchain_pkg") -registry_toolchains("x86_64-linux-qcc-12.2.0") ``` +The registration of toolchains is done by adding command line option `--extra_toolchains=@//:toolchain_name` +In case above this would be: +```bash +--extra_toolchains=@score_gcc_toolchain//:x86_64-linux-gcc-12.2.0 +--extra_toolchains=@score_qcc_toolchain//:x86_64-linux-qcc-12.2.0 +``` + +> NOTE: In case that more than one toolchain needs to be defined, the registration must be protected via config flags otherwise
+the first toolchain that matches constraints will be selected by toolchain resolutions. + ## Configuration Flags Shared flag sets live under: @@ -137,24 +145,15 @@ These templates simplify adding: ## Testing and Validation -Every toolchain must pass mandatory tests under `tests/`. - -### Test Types - -| Test Type | Purpose | -|-----------|---------| -| Smoke tests | Validate tool presence | -| Feature tests | Verify compiler/linker capabilities | -| Integration tests | Validate Bazel builds using the toolchain | - -Tests cover: +Testing is part of the **integration gate pipeline**. -- Simple compilation (`main.cpp`) -- pthread linking (`main_pthread.cpp`) -- Toolchain registration behavior +## Examples -Testing is part of the **integration gate pipeline**. +Example cover: +- Simple compilation ( [examples/main.cpp](./examples/main.cpp)) +- pthread linking ([examples/main_pthread.cpp](./examples/main_pthread.cpp)) +- Toolchain registration behavior ([examples/.bazelrc](./examples/.bazelrc)) # Documentation @@ -166,8 +165,7 @@ Documentation uses **Sphinx** and lives in `docs/`. 2. Add a package descriptor (e.g., `packages/linux/x86_64/gcc/13.1.0`) 3. Generate configuration from templates 4. Update flags if needed -5. Run tests: `bazel test //tests/...` -6. Submit through integration gate +5. Submit through integration gate --- diff --git a/tests/.bazelrc b/examples/.bazelrc similarity index 89% rename from tests/.bazelrc rename to examples/.bazelrc index d0c2f87..c26866b 100644 --- a/tests/.bazelrc +++ b/examples/.bazelrc @@ -11,11 +11,15 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* +# ------------------------------------------------------------------------------- # Link to S-CORE Bazel Registry +# ------------------------------------------------------------------------------- common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ common --registry=https://bcr.bazel.build -# Shared configuration for simple test execution +# ------------------------------------------------------------------------------- +# Shared configuration for simple example execution +# ------------------------------------------------------------------------------- build:shared --incompatible_strict_action_env build:shared --sandbox_writable_path=/var/tmp build:shared --host_platform=@score_bazel_platforms//:x86_64-linux diff --git a/tests/.bazelversion b/examples/.bazelversion similarity index 100% rename from tests/.bazelversion rename to examples/.bazelversion diff --git a/tests/BUILD b/examples/BUILD similarity index 100% rename from tests/BUILD rename to examples/BUILD diff --git a/tests/MODULE.bazel b/examples/MODULE.bazel similarity index 100% rename from tests/MODULE.bazel rename to examples/MODULE.bazel diff --git a/tests/main.cpp b/examples/main.cpp similarity index 100% rename from tests/main.cpp rename to examples/main.cpp diff --git a/tests/main_pthread.cpp b/examples/main_pthread.cpp similarity index 100% rename from tests/main_pthread.cpp rename to examples/main_pthread.cpp