diff options
| author | Leitwolf11 | 2026-11-15 23:08:05 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-11-15 23:08:05 +0300 |
| commit | 67c3ef401b34716f7214374ff0d6c24b3c50a149 (patch) | |
| tree | c4c97fb09f6e1364d8b44f74fca32f18065588b0 /tests/Progmasoft/BazelModule | |
| parent | 2fbb5585e35078cb2490c8ae988860aa6dc0399d (diff) | |
| download | catch3-67c3ef401b34716f7214374ff0d6c24b3c50a149.tar.gz | |
Prepare the Bazel Central Registry entry as progmasoft_catch3
- MODULE.bazel names the module progmasoft_catch3, the name it has in
the registry, with bazel_compatibility >=8.0.0; //tools:version finds
the version under the new name.
- .bcr/ holds the templates publish-to-bcr fills: metadata, source (the
GitHub archive of the catch3-* tag) and the presubmit, which runs the
test module on Debian, Ubuntu, macOS (x86-64 and arm64) and Windows
with Bazel 8.x and 9.x.
- tests/Progmasoft/BazelModule is a module that depends on Catch3 as a
user's does, through //:catch3_main and through //:catch3 with its
own main. The root ignores it; Bazel Builds tests it with Bazel 8.x
and 9.x on Ubuntu and Windows.
- Publish to BCR runs when a catch3-* release is published, or by hand
for a tag, and opens the registry pull request from the fork of the
maintainer, without attestations.
- The integration guide says how a module depends on progmasoft_catch3.
Claude-Session: https://claude.ai/code/session_01Ji7xZMYjc4zankoc7hGBE1
Diffstat (limited to 'tests/Progmasoft/BazelModule')
| -rw-r--r-- | tests/Progmasoft/BazelModule/.bazelrc | 12 | ||||
| -rw-r--r-- | tests/Progmasoft/BazelModule/BUILD.bazel | 16 | ||||
| -rw-r--r-- | tests/Progmasoft/BazelModule/MODULE.bazel | 14 | ||||
| -rw-r--r-- | tests/Progmasoft/BazelModule/OwnMain.tests.cpp | 18 | ||||
| -rw-r--r-- | tests/Progmasoft/BazelModule/WithMain.tests.cpp | 13 | ||||
| l--------- | tests/Progmasoft/BazelModule/bazel-BazelModule | 1 | ||||
| l--------- | tests/Progmasoft/BazelModule/bazel-bin | 1 | ||||
| l--------- | tests/Progmasoft/BazelModule/bazel-out | 1 | ||||
| l--------- | tests/Progmasoft/BazelModule/bazel-testlogs | 1 |
9 files changed, 77 insertions, 0 deletions
diff --git a/tests/Progmasoft/BazelModule/.bazelrc b/tests/Progmasoft/BazelModule/.bazelrc new file mode 100644 index 00000000..b99caaba --- /dev/null +++ b/tests/Progmasoft/BazelModule/.bazelrc @@ -0,0 +1,12 @@ +# Copyright (c) 2026 Progmasoft. +# SPDX-License-Identifier: LGPL-3.0-or-later + +# Code that includes the headers of Catch3 is C++17 or later, as it must be in +# a user's module; MSVC defaults to C++14. +common --enable_platform_specific_config +build:linux --cxxopt=-std=c++17 +build:macos --cxxopt=-std=c++17 +build:windows --cxxopt=/std:c++17 + +# The lockfile is the user's; this module keeps none. +common --lockfile_mode=off diff --git a/tests/Progmasoft/BazelModule/BUILD.bazel b/tests/Progmasoft/BazelModule/BUILD.bazel new file mode 100644 index 00000000..c95b5ddf --- /dev/null +++ b/tests/Progmasoft/BazelModule/BUILD.bazel @@ -0,0 +1,16 @@ +# Copyright (c) 2026 Progmasoft. +# SPDX-License-Identifier: LGPL-3.0-or-later +load("@rules_cc//cc:defs.bzl", "cc_test") + +# Each public name of the module, as a user links it. +cc_test( + name = "with_main", + srcs = ["WithMain.tests.cpp"], + deps = ["@progmasoft_catch3//:catch3_main"], +) + +cc_test( + name = "own_main", + srcs = ["OwnMain.tests.cpp"], + deps = ["@progmasoft_catch3//:catch3"], +) diff --git a/tests/Progmasoft/BazelModule/MODULE.bazel b/tests/Progmasoft/BazelModule/MODULE.bazel new file mode 100644 index 00000000..fa0d4bdb --- /dev/null +++ b/tests/Progmasoft/BazelModule/MODULE.bazel @@ -0,0 +1,14 @@ +# Copyright (c) 2026 Progmasoft. +# SPDX-License-Identifier: LGPL-3.0-or-later + +# A module that uses progmasoft_catch3 as a user's does. CI builds it from this +# checkout; the Bazel Central Registry builds it from the published version. +module(name = "progmasoft_catch3_test_module") + +bazel_dep(name = "progmasoft_catch3") +local_path_override( + module_name = "progmasoft_catch3", + path = "../../..", +) + +bazel_dep(name = "rules_cc", version = "0.2.17") diff --git a/tests/Progmasoft/BazelModule/OwnMain.tests.cpp b/tests/Progmasoft/BazelModule/OwnMain.tests.cpp new file mode 100644 index 00000000..e544bf4d --- /dev/null +++ b/tests/Progmasoft/BazelModule/OwnMain.tests.cpp @@ -0,0 +1,18 @@ +// Copyright (c) 2026 Progmasoft. +// SPDX-License-Identifier: LGPL-3.0-or-later + +// Tests linked with @progmasoft_catch3//:catch3, with a main of their own. +#include <Progmasoft/Catch3/Session.hpp> +#include <Progmasoft/Catch3/TestMacros.hpp> + +TEST_CASE("A test runs under its own main", "[module]") +{ + REQUIRE(1 + 1 == 2); +} + +int +main(int argc, char **argv) +{ + Catch::Session session; + return session.run(argc, argv); +} diff --git a/tests/Progmasoft/BazelModule/WithMain.tests.cpp b/tests/Progmasoft/BazelModule/WithMain.tests.cpp new file mode 100644 index 00000000..b3843f9f --- /dev/null +++ b/tests/Progmasoft/BazelModule/WithMain.tests.cpp @@ -0,0 +1,13 @@ +// Copyright (c) 2026 Progmasoft. +// SPDX-License-Identifier: LGPL-3.0-or-later + +// Tests linked with @progmasoft_catch3//:catch3_main, which brings main. +#include <Progmasoft/Catch3/TestMacros.hpp> +#include <string> + +TEST_CASE("A test runs from the published module", "[module]") +{ + const std::string name = "progmasoft_catch3"; + REQUIRE(name.size() == 17); + CHECK(name.rfind("progmasoft_", 0) == 0); +} diff --git a/tests/Progmasoft/BazelModule/bazel-BazelModule b/tests/Progmasoft/BazelModule/bazel-BazelModule new file mode 120000 index 00000000..8b7ed736 --- /dev/null +++ b/tests/Progmasoft/BazelModule/bazel-BazelModule @@ -0,0 +1 @@ +/home/hasan/.cache/bazel/_bazel_hasan/b6ce1a3de09042ac9ccba46273ffbf3b/execroot/_main
\ No newline at end of file diff --git a/tests/Progmasoft/BazelModule/bazel-bin b/tests/Progmasoft/BazelModule/bazel-bin new file mode 120000 index 00000000..c9e95b4d --- /dev/null +++ b/tests/Progmasoft/BazelModule/bazel-bin @@ -0,0 +1 @@ +/home/hasan/.cache/bazel/_bazel_hasan/b6ce1a3de09042ac9ccba46273ffbf3b/execroot/_main/bazel-out/k8-fastbuild/bin
\ No newline at end of file diff --git a/tests/Progmasoft/BazelModule/bazel-out b/tests/Progmasoft/BazelModule/bazel-out new file mode 120000 index 00000000..c24863da --- /dev/null +++ b/tests/Progmasoft/BazelModule/bazel-out @@ -0,0 +1 @@ +/home/hasan/.cache/bazel/_bazel_hasan/b6ce1a3de09042ac9ccba46273ffbf3b/execroot/_main/bazel-out
\ No newline at end of file diff --git a/tests/Progmasoft/BazelModule/bazel-testlogs b/tests/Progmasoft/BazelModule/bazel-testlogs new file mode 120000 index 00000000..eb25c4bc --- /dev/null +++ b/tests/Progmasoft/BazelModule/bazel-testlogs @@ -0,0 +1 @@ +/home/hasan/.cache/bazel/_bazel_hasan/b6ce1a3de09042ac9ccba46273ffbf3b/execroot/_main/bazel-out/k8-fastbuild/testlogs
\ No newline at end of file |