From 06f82e45f4af2ef1dc568f0bc01ee46b4922ee3c Mon Sep 17 00:00:00 2001 From: rahulsasingh Date: Wed, 24 Jun 2026 13:49:43 +0000 Subject: [PATCH] Add integration example workspace to verify module consumability --- .github/workflows/build.yml | 5 +++++ .gitignore | 2 ++ MODULE.bazel | 17 +++++++++-------- examples/.bazelrc | 37 +++++++++++++++++++++++++++++++++++++ examples/.bazelversion | 1 + examples/BUILD | 9 +++++++++ examples/MODULE.bazel | 29 +++++++++++++++++++++++++++++ examples/main.cpp | 32 ++++++++++++++++++++++++++++++++ 8 files changed, 124 insertions(+), 8 deletions(-) create mode 100644 examples/.bazelrc create mode 100644 examples/.bazelversion create mode 100644 examples/MODULE.bazel create mode 100644 examples/main.cpp diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6bcbf65..2d681d88 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,3 +75,8 @@ jobs: bazel test --lockfile_mode=error --config x86_64-linux \ --test_tag_filters=-no_ci \ -- //score/... -//score/test/component/... + + - name: Bazel test integration as module + run: | + # for the beginning, we do this only with the default configuration + cd examples && bazel build //... && bazel mod deps --lockfile_mode=update diff --git a/.gitignore b/.gitignore index 575777ce..e4b3af90 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,8 @@ # Bazel bazel-* +examples/bazel-* +examples/MODULE.bazel.lock user.bazelrc # Compilation databases for code completion in IDEs diff --git a/MODULE.bazel b/MODULE.bazel index 2a5be57d..cb31e8c3 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -17,12 +17,13 @@ module( ) # Bazel global rules -bazel_dep(name = "rules_python", version = "1.8.5") +bazel_dep(name = "rules_python", version = "1.8.5", dev_dependency = True) + bazel_dep(name = "bazel_skylib", version = "1.9.0") bazel_dep(name = "rules_rust", version = "0.68.1-score") bazel_dep(name = "rules_cc", version = "0.2.17") -bazel_dep(name = "aspect_rules_lint", version = "2.5.0") +bazel_dep(name = "aspect_rules_lint", version = "2.5.0", dev_dependency = True) bazel_dep(name = "score_cpp_policies", version = "0.0.0", dev_dependency = True) git_override( module_name = "score_cpp_policies", @@ -31,26 +32,26 @@ git_override( ) bazel_dep(name = "toolchains_llvm", version = "1.7.0", dev_dependency = True) +bazel_dep(name = "buildifier_prebuilt", version = "8.5.1", dev_dependency = True) -bazel_dep(name = "buildifier_prebuilt", version = "8.5.1") bazel_dep(name = "platforms", version = "1.0.0") # S-CORE process rules bazel_dep(name = "score_bazel_platforms", version = "0.1.2") -bazel_dep(name = "score_docs_as_code", version = "4.0.1") + +bazel_dep(name = "score_docs_as_code", version = "4.0.1", dev_dependency = True) single_version_override( module_name = "score_docs_as_code", version = "4.0.1", ) -bazel_dep(name = "score_tooling", version = "1.2.0") +bazel_dep(name = "score_tooling", version = "1.2.0", dev_dependency = True) single_version_override( module_name = "score_tooling", version = "1.1.2", ) -bazel_dep(name = "score_rust_policies", version = "0.0.5") - +bazel_dep(name = "score_rust_policies", version = "0.0.5", dev_dependency = True) bazel_dep(name = "score_process", version = "1.5.4", dev_dependency = True) bazel_dep(name = "score_platform", version = "0.5.5", dev_dependency = True) bazel_dep(name = "score_itf", version = "0.4.0", dev_dependency = True) @@ -153,7 +154,7 @@ python.toolchain( # C++ dependencies -bazel_dep(name = "googletest", version = "1.17.0.bcr.2") +bazel_dep(name = "googletest", version = "1.17.0.bcr.2", dev_dependency = True) bazel_dep(name = "rapidjson", version = "1.1.0.bcr.20241007") bazel_dep(name = "score_baselibs", version = "0.2.7") bazel_dep(name = "score_communication", version = "0.2.1") diff --git a/examples/.bazelrc b/examples/.bazelrc new file mode 100644 index 00000000..d2713b62 --- /dev/null +++ b/examples/.bazelrc @@ -0,0 +1,37 @@ +# ******************************************************************************* +# Copyright (c) 2026 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ +common --registry=https://bcr.bazel.build + +# Required score_baselibs configuration settings +common --@score_baselibs//score/json:base_library=nlohmann +common --@score_baselibs//score/memory/shared/flags:use_typedshmd=False +common --@score_baselibs//score/mw/log/flags:KRemote_Logging=False + +# Required score_logging configuration settings +common --@score_logging//score/datarouter/build_configuration_flags:persistent_logging=False +common --@score_logging//score/datarouter/build_configuration_flags:persistent_config_feature_enabled=False +common --@score_logging//score/datarouter/build_configuration_flags:enable_nonverbose_dlt=False +common --@score_logging//score/datarouter/build_configuration_flags:enable_dynamic_configuration=False +common --@score_logging//score/datarouter/build_configuration_flags:file_transfer=False +common --@score_logging//score/datarouter/build_configuration_flags:use_local_vlan=True + +# Java toolchain required by transitive grpc/flatbuffers chain +build --java_language_version=17 +build --tool_java_language_version=17 +build --java_runtime_version=remotejdk_17 +build --tool_java_runtime_version=remotejdk_17 + +build --copt=-Wno-error=deprecated-declarations +build --copt=-Wno-error=unused-but-set-variable diff --git a/examples/.bazelversion b/examples/.bazelversion new file mode 100644 index 00000000..2bf50aaf --- /dev/null +++ b/examples/.bazelversion @@ -0,0 +1 @@ +8.3.0 diff --git a/examples/BUILD b/examples/BUILD index d1031a1d..48ad391e 100644 --- a/examples/BUILD +++ b/examples/BUILD @@ -10,6 +10,15 @@ # # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* +load("@rules_cc//cc:defs.bzl", "cc_binary") + +cc_binary( + name = "example", + srcs = ["main.cpp"], + deps = [ + "@score_logging//score/mw/log", + ], +) # Needed for Dash tool to check python dependency licenses. filegroup( diff --git a/examples/MODULE.bazel b/examples/MODULE.bazel new file mode 100644 index 00000000..93c8f358 --- /dev/null +++ b/examples/MODULE.bazel @@ -0,0 +1,29 @@ +# ******************************************************************************* +# Copyright (c) 2026 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +bazel_dep(name = "score_logging", version = "0.0.0") +local_path_override( + module_name = "score_logging", + path = "..", +) + +bazel_dep(name = "score_baselibs", version = "0.2.8") +bazel_dep(name = "rules_cc", version = "0.2.17") +bazel_dep(name = "score_communication", version = "0.2.1") + +# Due to incoming transitive deps from baselibs flatbuffers module. +# FIXME: To be removed after https://github.com/eclipse-score/baselibs/issues/266 is resolved +single_version_override( + module_name = "grpc-java", + version = "1.70.0", +) diff --git a/examples/main.cpp b/examples/main.cpp new file mode 100644 index 00000000..e951b1c0 --- /dev/null +++ b/examples/main.cpp @@ -0,0 +1,32 @@ +/******************************************************************************** + * Copyright (c) 2026 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ +// ******************************************************************************* +// Copyright (c) 2026 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// This program and the accompanying materials are made available under the +// terms of the Apache License Version 2.0 which is available at +// https://www.apache.org/licenses/LICENSE-2.0 +// +// SPDX-License-Identifier: Apache-2.0 +// ******************************************************************************* + +#include "score/mw/log/logging.h" + +int main(int, char**) +{ + score::mw::log::LogInfo() << "score_logging integration example"; + return 0; +}