Skip to content

Commit

Permalink
squashed all previous commits
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lalten committed Jan 30, 2024
1 parent 129edf3 commit 35007ec
Show file tree
Hide file tree
Showing 12 changed files with 304 additions and 149 deletions.
11 changes: 3 additions & 8 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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++
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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}}
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
default_language_version:
python: python3.10
node: 18.16.0

default_stages: [commit]
Expand Down
107 changes: 107 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -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",
)
Empty file added WORKSPACE.bzlmod
Empty file.
66 changes: 66 additions & 0 deletions examples/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -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")
8 changes: 8 additions & 0 deletions extensions.bzl
Original file line number Diff line number Diff line change
@@ -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,
)
13 changes: 4 additions & 9 deletions repositories/asio.BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
)
1 change: 1 addition & 0 deletions repositories/foxglove_bridge.BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ cc_library(
includes = ["foxglove_bridge_base/include"],
deps = [
"@nlohmann_json//:json",
"@openssl//:ssl",
"@websocketpp",
],
)
Expand Down
1 change: 1 addition & 0 deletions repositories/pip_annotations.bzl
Original file line number Diff line number Diff line change
@@ -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 = """\
Expand Down
Loading

0 comments on commit 35007ec

Please sign in to comment.