From 35007ecb187c35a1c61e8605228b3d1ba095d7e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurenz=20Altenm=C3=BCller?= Date: Fri, 5 Jan 2024 14:36:01 +0100 Subject: [PATCH] squashed all previous commits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit try 3.11 ... disable bzlmod ci for examples for now fix ci fail-fast: false --keep_going remove module extension duplication fix example WORKSPACE setup calculate correct name of numpy repo fix WORKSPACE build also in examples WORKSPACE wip. trying to export repos show bzlmod issues in example rebase, update packages cleanup fix pre-commit more repos drop boost (rebased onto `drop-boost` branch) bzlmodify googletest bzlmodify nlohmann_json bzlmodify fmt bzlmodify spdlog (needs downgrade) upgrade fmt to be compatible with spdlog from bcr bzlmodify tinyxml. needs downgrade readerwriterqueue sqlite zstd lz4 (upgrade) yaml_cpp (upgrade) eigen fix yaml-cpp name fix sqlite3 name fix sqlite3 visibility Fix aggregator_node runfiles path re-add WORKSPACE.bzlmod 🤷 fix pre-commit asio (upgrade) zlib (upgrade) pybind11 fix accidental rename fix undefined symbol SSL_ctrl in foxglove_bridge_base (no ssl dep in bzlmod asio) python_interpreter_target pre-commit run python_configure.toolchain missing comma go back to WORKSPACE version of pybind11 check zstd include fix is actually solved on ci change WORKSPACE asio to header-only implementation used in bzlmod --- .bazelrc | 11 +- .github/workflows/main.yml | 8 +- .pre-commit-config.yaml | 1 - MODULE.bazel | 107 +++++++++++ WORKSPACE.bzlmod | 0 examples/MODULE.bazel | 66 +++++++ extensions.bzl | 8 + repositories/asio.BUILD.bazel | 13 +- repositories/foxglove_bridge.BUILD.bazel | 1 + repositories/pip_annotations.bzl | 1 + repositories/repositories.bzl | 234 ++++++++++------------- ros2/interfaces.bzl | 3 +- 12 files changed, 304 insertions(+), 149 deletions(-) create mode 100644 MODULE.bazel create mode 100644 WORKSPACE.bzlmod create mode 100644 examples/MODULE.bazel create mode 100644 extensions.bzl diff --git a/.bazelrc b/.bazelrc index 9e1354c3..b749130a 100644 --- a/.bazelrc +++ b/.bazelrc @@ -4,14 +4,6 @@ # Mandatory at the moment for Bazel 7.0.0. build --noincompatible_sandbox_hermetic_tmp -# This is mandatory if your build env doesn't have a proper Python 3 exe -# -- like the CI build image for this repo. -# The build image is using a fake python exe, see -# https://github.com/mvukov/bazel_builder/blob/main/Dockerfile. -# If blzmod is enabled, but not used as in this repo at the moment), -# then bazel for some reason tries to auto-detect a Python exe. -build --noenable_bzlmod - # Fix the wrong default to generate __init__.py to delimit a Python package. # This is a mandatory flag. build --incompatible_default_to_explicit_init_py @@ -37,6 +29,9 @@ build --noexperimental_check_output_files # Don't bother building targets which aren't dependencies of the tests. test --build_tests_only +# Show all the problems in CI +test --keep_going + # To use a clang compiler, invoke Bazel with `--config=clang`. build:clang --repo_env=CC=clang build:clang --repo_env=CXX=clang++ diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 02a91895..05388e12 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -53,7 +53,11 @@ jobs: # Run bazel test with gcc and clang in each workspace strategy: + fail-fast: false matrix: + bzlmod: + - "--enable_bzlmod" + - "--noenable_bzlmod" folder: - "." - "examples" @@ -91,11 +95,11 @@ jobs: ~/.cache/bazel-repo key: v3-bazel-repo-cache-${{ matrix.toolchain }}-${{ hashFiles('.bazelversion', 'examples/WORKSPACE', 'repositories/**', 'requirements_lock.txt', 'WORKSPACE') }} restore-keys: v3-bazel-repo-cache-${{ matrix.toolchain }}- - - name: bazel test ${{ matrix.config_option }} //... + - name: bazel test ${{ matrix.config_option }} ${{ matrix.bzlmod}} //... env: # Bazelisk will download bazel to here, ensure it is cached between runs. XDG_CACHE_HOME: ~/.cache/bazel-repo BUILDBUDDY_ORG_API_KEY: ${{ secrets.BUILDBUDDY_ORG_API_KEY }} USER: ${{ needs.configure.outputs.user_name }} working-directory: ${{ matrix.folder }} - run: ${GITHUB_WORKSPACE}/.github/workflows/test.sh ${{ matrix.config_option }} + run: ${GITHUB_WORKSPACE}/.github/workflows/test.sh ${{ matrix.config_option }} ${{ matrix.bzlmod}} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6e4e1920..974f793f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,4 @@ default_language_version: - python: python3.10 node: 18.16.0 default_stages: [commit] diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 00000000..9b20fe40 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,107 @@ +module(name = "com_github_mvukov_rules_ros2") + +bazel_dep(name = "asio", version = "1.28.2") +bazel_dep(name = "bazel_skylib", version = "1.5.0") +bazel_dep(name = "eigen", version = "3.4.0") +bazel_dep(name = "fmt", version = "10.2.1") +bazel_dep(name = "googletest", version = "1.14.0.bcr.1") +bazel_dep(name = "lz4", version = "1.9.4") +bazel_dep(name = "nlohmann_json", version = "3.11.3") +bazel_dep(name = "platforms", version = "0.0.8") +bazel_dep(name = "readerwriterqueue", version = "1.0.6") +bazel_dep(name = "rules_cc", version = "0.0.9") +bazel_dep(name = "rules_foreign_cc", version = "0.10.1") +bazel_dep(name = "rules_python", version = "0.29.0") +bazel_dep(name = "spdlog", version = "1.12.0") +bazel_dep(name = "sqlite3", version = "3.42.0.bcr.1") +bazel_dep(name = "tinyxml2", version = "9.0.0") +bazel_dep(name = "yaml-cpp", version = "0.8.0") +bazel_dep(name = "zlib", version = "1.3") +bazel_dep(name = "zstd", version = "1.5.5.bcr.1") + +python = use_extension("@rules_python//python:extensions.bzl", "python") +python.toolchain( + is_default = True, + python_version = "3.11", +) +use_repo(python, "python_versions") + +pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") +pip.whl_mods( + # Keep this in sync with repositories/pip_annotations.bzl + additive_build_content = """\ +cc_library( + name = "headers", + hdrs = glob(["site-packages/numpy/core/include/numpy/**/*.h"]), + includes = ["site-packages/numpy/core/include"], + deps = ["@rules_python//python/cc:current_py_cc_headers"], +) +""", + hub_name = "whl_mods_hub", + whl_name = "numpy", +) +use_repo(pip, "whl_mods_hub") +pip.parse( + hub_name = "rules_ros2_pip_deps", + python_version = "3.11", + requirements_lock = "//:requirements_lock.txt", + whl_modifications = {"@whl_mods_hub//:numpy.json": "numpy"}, +) +use_repo(pip, "rules_ros2_pip_deps") +use_repo(pip, "rules_ros2_pip_deps_311_numpy") +pip.parse( + hub_name = "rules_ros2_resolver_deps", + python_version = "3.11", + requirements_lock = "//repositories/private:resolver_requirements_lock.txt", +) +use_repo(pip, "rules_ros2_resolver_deps") + +non_module_deps = use_extension("@com_github_mvukov_rules_ros2//:extensions.bzl", "non_module_deps") +use_repo( + non_module_deps, + "cyclonedds", + "foxglove_bridge", + "iceoryx", + "osrf_pycommon", + "pybind11", + "ros2_ament_cmake_ros", + "ros2_ament_index", + "ros2_class_loader", + "ros2_common_interfaces", + "ros2_diagnostics", + "ros2_geometry2", + "ros2_image_common", + "ros2_kdl_parser", + "ros2_keyboard_handler", + "ros2_launch", + "ros2_launch_ros", + "ros2_libstatistics_collector", + "ros2_message_filters", + "ros2_pluginlib", + "ros2_rcl", + "ros2_rcl_interfaces", + "ros2_rcl_logging", + "ros2_rclcpp", + "ros2_rclpy", + "ros2_rcpputils", + "ros2_rcutils", + "ros2_resource_retriever", + "ros2_rmw", + "ros2_rmw_cyclonedds", + "ros2_rmw_dds_common", + "ros2_rmw_implementation", + "ros2_robot_state_publisher", + "ros2_ros_testing", + "ros2_rosbag2", + "ros2_rosidl", + "ros2_rosidl_python", + "ros2_rosidl_runtime_py", + "ros2_rosidl_typesupport", + "ros2_rpyutils", + "ros2_tracing", + "ros2_unique_identifier_msgs", + "ros2_urdfdom", + "ros2_urdfdom_headers", + "ros2_xacro", + "ros2cli", +) diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod new file mode 100644 index 00000000..e69de29b diff --git a/examples/MODULE.bazel b/examples/MODULE.bazel new file mode 100644 index 00000000..09412cd6 --- /dev/null +++ b/examples/MODULE.bazel @@ -0,0 +1,66 @@ +module(name = "rules_ros2_examples") + +bazel_dep(name = "com_github_mvukov_rules_ros2") +local_path_override( + module_name = "com_github_mvukov_rules_ros2", + path = "..", +) + +non_module_deps = use_extension("@com_github_mvukov_rules_ros2//:extensions.bzl", "non_module_deps") +use_repo( + non_module_deps, + "cyclonedds", + "foxglove_bridge", + "iceoryx", + "osrf_pycommon", + "ros2_ament_cmake_ros", + "ros2_ament_index", + "ros2_class_loader", + "ros2_common_interfaces", + "ros2_diagnostics", + "ros2_geometry2", + "ros2_image_common", + "ros2_kdl_parser", + "ros2_keyboard_handler", + "ros2_launch", + "ros2_launch_ros", + "ros2_libstatistics_collector", + "ros2_message_filters", + "ros2_pluginlib", + "ros2_rcl", + "ros2_rcl_interfaces", + "ros2_rcl_logging", + "ros2_rclcpp", + "ros2_rclpy", + "ros2_rcpputils", + "ros2_rcutils", + "ros2_resource_retriever", + "ros2_rmw", + "ros2_rmw_cyclonedds", + "ros2_rmw_dds_common", + "ros2_rmw_implementation", + "ros2_robot_state_publisher", + "ros2_ros_testing", + "ros2_rosbag2", + "ros2_rosidl", + "ros2_rosidl_python", + "ros2_rosidl_runtime_py", + "ros2_rosidl_typesupport", + "ros2_rpyutils", + "ros2_tracing", + "ros2_unique_identifier_msgs", + "ros2_urdfdom", + "ros2_urdfdom_headers", + "ros2_xacro", + "ros2cli", +) + +bazel_dep(name = "rules_cc", version = "0.0.9") +bazel_dep(name = "rules_python", version = "0.29.0") + +python = use_extension("@rules_python//python:extensions.bzl", "python") +python.toolchain( + is_default = True, + python_version = "3.11", +) +use_repo(python, "python_versions") diff --git a/extensions.bzl b/extensions.bzl new file mode 100644 index 00000000..4466f393 --- /dev/null +++ b/extensions.bzl @@ -0,0 +1,8 @@ +load("@com_github_mvukov_rules_ros2//repositories:repositories.bzl", "ros2_repositories") + +def _non_module_deps_impl(mctx): + ros2_repositories() + +non_module_deps = module_extension( + implementation = _non_module_deps_impl, +) diff --git a/repositories/asio.BUILD.bazel b/repositories/asio.BUILD.bazel index e7745b34..9e273d70 100644 --- a/repositories/asio.BUILD.bazel +++ b/repositories/asio.BUILD.bazel @@ -5,15 +5,10 @@ load("@rules_cc//cc:defs.bzl", "cc_library") cc_library( name = "asio", - srcs = glob(["src/*.cpp"]), - hdrs = glob([ - "include/**/*.hpp", - "include/**/*.ipp", + srcs = glob([ + "**/*.hpp", + "**/*.ipp", ]), - defines = [ - "ASIO_SEPARATE_COMPILATION", - ], - includes = ["include"], + includes = ["."], visibility = ["//visibility:public"], - deps = ["@openssl//:ssl"], ) diff --git a/repositories/foxglove_bridge.BUILD.bazel b/repositories/foxglove_bridge.BUILD.bazel index cf20f3e2..c7fe4426 100644 --- a/repositories/foxglove_bridge.BUILD.bazel +++ b/repositories/foxglove_bridge.BUILD.bazel @@ -26,6 +26,7 @@ cc_library( includes = ["foxglove_bridge_base/include"], deps = [ "@nlohmann_json//:json", + "@openssl//:ssl", "@websocketpp", ], ) diff --git a/repositories/pip_annotations.bzl b/repositories/pip_annotations.bzl index 980a3b1b..2691d95a 100644 --- a/repositories/pip_annotations.bzl +++ b/repositories/pip_annotations.bzl @@ -1,5 +1,6 @@ load("@rules_python//python:pip.bzl", "package_annotation") +# Keep this in sync with MODULE.bazel PIP_ANNOTATIONS = { "numpy": package_annotation( additive_build_content = """\ diff --git a/repositories/repositories.bzl b/repositories/repositories.bzl index a5822bbb..527a9e3a 100644 --- a/repositories/repositories.bzl +++ b/repositories/repositories.bzl @@ -10,6 +10,15 @@ load( def rules_ros2_workspace_deps(): """Import http_archive dependencies for the WORKSPACE version of rules_ros2.""" + maybe( + http_archive, + name = "asio", + build_file = "@com_github_mvukov_rules_ros2//repositories:asio.BUILD.bazel", + sha256 = "5705a0e403017eba276625107160498518838064a6dd7fd8b00b2e30c0ffbdee", + strip_prefix = "asio-asio-1-28-2/asio/include", + urls = ["https://github.com/chriskohlhoff/asio/archive/refs/tags/asio-1-28-2.tar.gz"], + ) + maybe( http_archive, name = "rules_python", @@ -27,74 +36,70 @@ def rules_ros2_workspace_deps(): maybe( http_archive, - name = "fmt", - build_file = "@com_github_mvukov_rules_ros2//repositories:fmt.BUILD.bazel", - sha256 = "5dea48d1fcddc3ec571ce2058e13910a0d4a6bab4cc09a809d8b1dd1c88ae6f2", - strip_prefix = "fmt-9.1.0", - url = "https://github.com/fmtlib/fmt/archive/9.1.0.tar.gz", + name = "rules_foreign_cc", + sha256 = "476303bd0f1b04cc311fc258f1708a5f6ef82d3091e53fd1977fa20383425a6a", + strip_prefix = "rules_foreign_cc-0.10.1", + url = "https://github.com/bazelbuild/rules_foreign_cc/archive/refs/tags/0.10.1.tar.gz", ) maybe( http_archive, - name = "spdlog", - build_file = "@com_github_mvukov_rules_ros2//repositories:spdlog.BUILD.bazel", - sha256 = "534f2ee1a4dcbeb22249856edfb2be76a1cf4f708a20b0ac2ed090ee24cfdbc9", - strip_prefix = "spdlog-1.13.0", - url = "https://github.com/gabime/spdlog/archive/v1.13.0.tar.gz", + name = "eigen", + build_file = "@com_github_mvukov_rules_ros2//repositories:eigen.BUILD.bazel", + sha256 = "8586084f71f9bde545ee7fa6d00288b264a2b7ac3607b974e54d13e7162c1c72", + strip_prefix = "eigen-3.4.0", + urls = ["https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz"], ) maybe( http_archive, - name = "libyaml", - build_file = "@com_github_mvukov_rules_ros2//repositories:libyaml.BUILD.bazel", - sha256 = "2c103fc473e904c6fe7580277f1fa16b6d716e54d5e3f32a8913c4850ae03b3f", - strip_prefix = "libyaml-acd6f6f014c25e46363e718381e0b35205df2d83", - urls = ["https://github.com/yaml/libyaml/archive/acd6f6f014c25e46363e718381e0b35205df2d83.tar.gz"], + name = "googletest", + sha256 = "8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7", + strip_prefix = "googletest-1.14.0", + url = "https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz", ) + _googletest_deps() maybe( http_archive, - name = "pybind11", - build_file = "@com_github_mvukov_rules_ros2//repositories:pybind11.BUILD.bazel", - sha256 = "d475978da0cdc2d43b73f30910786759d593a9d8ee05b1b6846d1eb16c6d2e0c", - strip_prefix = "pybind11-2.11.1", - urls = ["https://github.com/pybind/pybind11/archive/refs/tags/v2.11.1.tar.gz"], + name = "lz4", + build_file = "@com_github_mvukov_rules_ros2//repositories:lz4.BUILD.bazel", + sha256 = "0b0e3aa07c8c063ddf40b082bdf7e37a1562bda40a0ff5272957f3e987e0e54b", + strip_prefix = "lz4-1.9.4", + urls = ["https://github.com/lz4/lz4/archive/refs/tags/v1.9.4.tar.gz"], ) maybe( http_archive, - name = "rules_foreign_cc", - sha256 = "476303bd0f1b04cc311fc258f1708a5f6ef82d3091e53fd1977fa20383425a6a", - strip_prefix = "rules_foreign_cc-0.10.1", - url = "https://github.com/bazelbuild/rules_foreign_cc/archive/refs/tags/0.10.1.tar.gz", + name = "nlohmann_json", + sha256 = "a22461d13119ac5c78f205d3df1db13403e58ce1bb1794edc9313677313f4a9d", + urls = ["https://github.com/nlohmann/json/releases/download/v3.11.3/include.zip"], ) maybe( http_archive, - name = "googletest", - sha256 = "8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7", - strip_prefix = "googletest-1.14.0", - url = "https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz", + name = "fmt", + build_file = "@com_github_mvukov_rules_ros2//repositories:fmt.BUILD.bazel", + sha256 = "1250e4cc58bf06ee631567523f48848dc4596133e163f02615c97f78bab6c811", + strip_prefix = "fmt-10.2.1", + url = "https://github.com/fmtlib/fmt/archive/10.2.1.tar.gz", ) - - _googletest_deps() - maybe( http_archive, - name = "tinyxml2", - build_file = "@com_github_mvukov_rules_ros2//repositories:tinyxml2.BUILD.bazel", - sha256 = "3bdf15128ba16686e69bce256cc468e76c7b94ff2c7f391cc5ec09e40bff3839", - strip_prefix = "tinyxml2-10.0.0", - urls = ["https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.0.tar.gz"], + name = "spdlog", + build_file = "@com_github_mvukov_rules_ros2//repositories:spdlog.BUILD.bazel", + sha256 = "4dccf2d10f410c1e2feaff89966bfc49a1abb29ef6f08246335b110e001e09a9", + strip_prefix = "spdlog-1.12.0", + url = "https://github.com/gabime/spdlog/archive/v1.12.0.tar.gz", ) maybe( http_archive, - name = "console_bridge", - build_file = "@com_github_mvukov_rules_ros2//repositories:console_bridge.BUILD.bazel", - sha256 = "303a619c01a9e14a3c82eb9762b8a428ef5311a6d46353872ab9a904358be4a4", - strip_prefix = "console_bridge-1.0.2", - urls = ["https://github.com/ros/console_bridge/archive/1.0.2.tar.gz"], + name = "tinyxml2", + build_file = "@com_github_mvukov_rules_ros2//repositories:tinyxml2.BUILD.bazel", + sha256 = "cc2f1417c308b1f6acc54f88eb70771a0bf65f76282ce5c40e54cfe52952702c", + strip_prefix = "tinyxml2-9.0.0", + urls = ["https://github.com/leethomason/tinyxml2/archive/refs/tags/9.0.0.tar.gz"], ) maybe( @@ -115,6 +120,24 @@ def rules_ros2_workspace_deps(): urls = ["https://www.sqlite.org/2018/sqlite-amalgamation-3240000.zip"], ) + maybe( + http_archive, + name = "yaml-cpp", + build_file = "@com_github_mvukov_rules_ros2//repositories:yaml-cpp.BUILD.bazel", + sha256 = "fbe74bbdcee21d656715688706da3c8becfd946d92cd44705cc6098bb23b3a16", + strip_prefix = "yaml-cpp-0.8.0", + urls = ["https://github.com/jbeder/yaml-cpp/archive/refs/tags/0.8.0.tar.gz"], + ) + + maybe( + http_archive, + name = "zlib", + build_file = "@com_github_mvukov_rules_ros2//repositories:zlib.BUILD.bazel", + sha256 = "8a9ba2898e1d0d774eca6ba5b4627a11e5588ba85c8851336eb38de4683050a7", + strip_prefix = "zlib-1.3", + urls = ["https://github.com/madler/zlib/releases/download/v1.3/zlib-1.3.tar.xz"], + ) + maybe( http_archive, name = "zstd", @@ -124,13 +147,36 @@ def rules_ros2_workspace_deps(): urls = ["https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-1.5.5.tar.gz"], ) +def ros2_repositories(): + """Import external/third-party build http_archive dependencies.""" + + # Move pybind stuff to rules_ros2_workspace_deps() and configure in MODULE.bazel + # once https://github.com/pybind/pybind11_bazel/issues/66 is resolved. maybe( http_archive, - name = "lz4", - build_file = "@com_github_mvukov_rules_ros2//repositories:lz4.BUILD.bazel", - sha256 = "4ec935d99aa4950eadfefbd49c9fad863185ac24c32001162c44a683ef61b580", - strip_prefix = "lz4-1.9.3", - urls = ["https://github.com/lz4/lz4/archive/refs/tags/v1.9.3.zip"], + name = "pybind11", + build_file = "@com_github_mvukov_rules_ros2//repositories:pybind11.BUILD.bazel", + sha256 = "d475978da0cdc2d43b73f30910786759d593a9d8ee05b1b6846d1eb16c6d2e0c", + strip_prefix = "pybind11-2.11.1", + urls = ["https://github.com/pybind/pybind11/archive/refs/tags/v2.11.1.tar.gz"], + ) + + maybe( + http_archive, + name = "libyaml", + build_file = "@com_github_mvukov_rules_ros2//repositories:libyaml.BUILD.bazel", + sha256 = "2c103fc473e904c6fe7580277f1fa16b6d716e54d5e3f32a8913c4850ae03b3f", + strip_prefix = "libyaml-acd6f6f014c25e46363e718381e0b35205df2d83", + urls = ["https://github.com/yaml/libyaml/archive/acd6f6f014c25e46363e718381e0b35205df2d83.tar.gz"], + ) + + maybe( + http_archive, + name = "console_bridge", + build_file = "@com_github_mvukov_rules_ros2//repositories:console_bridge.BUILD.bazel", + sha256 = "303a619c01a9e14a3c82eb9762b8a428ef5311a6d46353872ab9a904358be4a4", + strip_prefix = "console_bridge-1.0.2", + urls = ["https://github.com/ros/console_bridge/archive/1.0.2.tar.gz"], ) maybe( @@ -144,20 +190,23 @@ def rules_ros2_workspace_deps(): maybe( http_archive, - name = "yaml-cpp", - build_file = "@com_github_mvukov_rules_ros2//repositories:yaml-cpp.BUILD.bazel", - sha256 = "43e6a9fcb146ad871515f0d0873947e5d497a1c9c60c58cb102a97b47208b7c3", - strip_prefix = "yaml-cpp-yaml-cpp-0.7.0", - urls = ["https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-0.7.0.tar.gz"], + name = "ros2", + build_file = "@com_github_mvukov_rules_ros2//repositories:ros2.BUILD.bazel", + sha256 = "6e2611392776fdf39e47205db44956b77727cd561245c012ccc3ff5b1a4cd7ad", + strip_prefix = "ros2-release-humble-20231122", + urls = ["https://github.com/ros2/ros2/archive/refs/tags/release-humble-20231122.tar.gz"], ) + ros2_repositories_impl() + + # ros2-devel branch maybe( http_archive, - name = "eigen", - build_file = "@com_github_mvukov_rules_ros2//repositories:eigen.BUILD.bazel", - sha256 = "8586084f71f9bde545ee7fa6d00288b264a2b7ac3607b974e54d13e7162c1c72", - strip_prefix = "eigen-3.4.0", - urls = ["https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz"], + name = "ros2_gps_umd", + build_file = "@com_github_mvukov_rules_ros2//repositories:gps_umd.BUILD.bazel", + sha256 = "64a96f93053d0d59e8fcccceab5408a7d666dd813d4c12df139ef24d916f49ab", + strip_prefix = "gps_umd-fc782811804fafb12ee479a48a2aa2e9ee942e2d", + urls = ["https://github.com/swri-robotics/gps_umd/archive/fc782811804fafb12ee479a48a2aa2e9ee942e2d.tar.gz"], ) maybe( @@ -169,13 +218,6 @@ def rules_ros2_workspace_deps(): urls = ["https://github.com/foxglove/ros-foxglove-bridge/archive/refs/tags/0.7.5.tar.gz"], ) - maybe( - http_archive, - name = "nlohmann_json", - sha256 = "a22461d13119ac5c78f205d3df1db13403e58ce1bb1794edc9313677313f4a9d", - urls = ["https://github.com/nlohmann/json/releases/download/v3.11.3/include.zip"], - ) - maybe( http_archive, name = "websocketpp", @@ -185,15 +227,6 @@ def rules_ros2_workspace_deps(): urls = ["https://github.com/zaphoyd/websocketpp/archive/refs/tags/0.8.2.tar.gz"], ) - maybe( - http_archive, - name = "asio", - build_file = "@com_github_mvukov_rules_ros2//repositories:asio.BUILD.bazel", - sha256 = "b31c63867daaba0e460ee2c85dc508a52c81db0a7318e0d2147f444b26f80ed7", - strip_prefix = "asio-asio-1-27-0/asio", - urls = ["https://github.com/chriskohlhoff/asio/archive/refs/tags/asio-1-27-0.tar.gz"], - ) - # We're pointing at hedronvision's mirror of google/boringssl:main-with-bazel to get # Renovate auto-update. Otherwise, Renovate will keep moving us back to main, which doesn't # support Bazel. @@ -205,61 +238,6 @@ def rules_ros2_workspace_deps(): urls = ["https://github.com/hedronvision/boringssl/archive/e762bd792ab7fecb170bdb1cd96a0bfb0c9d3238.tar.gz"], ) - maybe( - http_archive, - name = "zlib", - build_file = "@com_github_mvukov_rules_ros2//repositories:zlib.BUILD.bazel", - sha256 = "d14c38e313afc35a9a8760dadf26042f51ea0f5d154b0630a31da0540107fb98", - strip_prefix = "zlib-1.2.13", - urls = [ - "https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.xz", - "https://zlib.net/zlib-1.2.13.tar.xz", - ], - ) - - maybe( - http_archive, - name = "tinyxml", - build_file = "@com_github_mvukov_rules_ros2//repositories:tinyxml.BUILD.bazel", - sha256 = "15bdfdcec58a7da30adc87ac2b078e4417dbe5392f3afb719f9ba6d062645593", - urls = [ - "http://archive.ubuntu.com/ubuntu/pool/universe/t/tinyxml/tinyxml_2.6.2.orig.tar.gz", - ], - ) - - maybe( - http_archive, - name = "curl", - build_file = "@com_github_mvukov_rules_ros2//repositories:curl.BUILD.bazel", - sha256 = "230d61a4b1eb3346930f2d601cc8fe5237957163e16befbe15e0ef40c56767a2", - strip_prefix = "curl-curl-8_2_1", - urls = ["https://github.com/curl/curl/archive/refs/tags/curl-8_2_1.tar.gz"], - ) - -def ros2_repositories(): - """Import ROS 2 repositories.""" - - maybe( - http_archive, - name = "ros2", - build_file = "@com_github_mvukov_rules_ros2//repositories:ros2.BUILD.bazel", - sha256 = "6e2611392776fdf39e47205db44956b77727cd561245c012ccc3ff5b1a4cd7ad", - strip_prefix = "ros2-release-humble-20231122", - urls = ["https://github.com/ros2/ros2/archive/refs/tags/release-humble-20231122.tar.gz"], - ) - - ros2_repositories_impl() - - # ros2-devel branch - maybe( - http_archive, - name = "ros2_gps_umd", - build_file = "@com_github_mvukov_rules_ros2//repositories:gps_umd.BUILD.bazel", - sha256 = "64a96f93053d0d59e8fcccceab5408a7d666dd813d4c12df139ef24d916f49ab", - strip_prefix = "gps_umd-fc782811804fafb12ee479a48a2aa2e9ee942e2d", - urls = ["https://github.com/swri-robotics/gps_umd/archive/fc782811804fafb12ee479a48a2aa2e9ee942e2d.tar.gz"], - ) - maybe( http_archive, name = "ros2_xacro", @@ -300,7 +278,7 @@ def ros2_repositories(): ) def _googletest_deps(): - """Lists implicit googletest deps. + """Lists implicit googletest WORKSPACE deps. Necessary such that e.g. `bazel fetch //...` can work. The versions below taken from https://github.com/google/googletest/blob/v1.13.0/WORKSPACE. diff --git a/ros2/interfaces.bzl b/ros2/interfaces.bzl index 9b242906..0702bda9 100644 --- a/ros2/interfaces.bzl +++ b/ros2/interfaces.bzl @@ -18,6 +18,7 @@ load("@bazel_skylib//lib:paths.bzl", "paths") load("@com_github_mvukov_rules_ros2//ros2:cc_opts.bzl", "CPP_COPTS", "C_COPTS") load("@rules_cc//cc:toolchain_utils.bzl", "find_cpp_toolchain") load("@rules_python//python:defs.bzl", "py_library") +load("@rules_python//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") load("@rules_ros2_pip_deps//:requirements.bzl", "requirement") Ros2InterfaceInfo = provider( @@ -822,7 +823,7 @@ py_generator_aspect = aspect( "_py_ext_c_deps": attr.label_list( default = [ Label("@rules_python//python/cc:current_py_cc_headers"), - Label("@rules_ros2_pip_deps_numpy//:headers"), + Label("@rules_ros2_pip_deps" + ("_311" if BZLMOD_ENABLED else "") + "_numpy//:headers"), ], providers = [CcInfo], ),