Skip to content

Commit

Permalink
refactor: extract rules_ros2_workspace_deps
Browse files Browse the repository at this point in the history
  • Loading branch information
lalten committed Feb 1, 2024
1 parent 48244d8 commit 02e22d2
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 88 deletions.
4 changes: 3 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
workspace(name = "com_github_mvukov_rules_ros2")

load("//repositories:repositories.bzl", "ros2_repositories")
load("//repositories:repositories.bzl", "ros2_repositories", "rules_ros2_workspace_deps")

rules_ros2_workspace_deps()

ros2_repositories()

Expand Down
4 changes: 3 additions & 1 deletion examples/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ local_repository(
# url = "https://github.com/mvukov/rules_ros2/archive/<git commit SHA>.tar.gz",
# )

load("@com_github_mvukov_rules_ros2//repositories:repositories.bzl", "ros2_repositories")
load("@com_github_mvukov_rules_ros2//repositories:repositories.bzl", "ros2_repositories", "rules_ros2_workspace_deps")

rules_ros2_workspace_deps()

ros2_repositories()

Expand Down
182 changes: 96 additions & 86 deletions repositories/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
"""Handles imports of external/third-party repositories.
"""

load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load(
"@com_github_mvukov_rules_ros2//repositories:ros2_repositories_impl.bzl",
"ros2_repositories_impl",
)

def ros2_repositories():
"""Imports external/third-party repositories.
"""
def rules_ros2_workspace_deps():
"""Import http_archive dependencies for the WORKSPACE version of rules_ros2."""
maybe(
http_archive,
name = "rules_python",
Expand Down Expand Up @@ -90,15 +88,6 @@ def ros2_repositories():
urls = ["https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.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"],
)

maybe(
http_archive,
name = "readerwriterqueue",
Expand All @@ -117,6 +106,73 @@ def ros2_repositories():
urls = ["https://www.sqlite.org/2018/sqlite-amalgamation-3240000.zip"],
)

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",
build_file = "@com_github_mvukov_rules_ros2//repositories:websocketpp.BUILD.bazel",
sha256 = "6ce889d85ecdc2d8fa07408d6787e7352510750daa66b5ad44aacb47bea76755",
strip_prefix = "websocketpp-0.8.2",
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.
maybe(
http_archive,
name = "openssl",
sha256 = "cf1cfe0adb443ef96197b109292847c0a97304058af21f3488a323b51984608a",
strip_prefix = "boringssl-e762bd792ab7fecb170bdb1cd96a0bfb0c9d3238",
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"],
)

maybe(
http_archive,
name = "zstd",
Expand All @@ -135,15 +191,6 @@ def ros2_repositories():
urls = ["https://github.com/lz4/lz4/archive/refs/tags/v1.9.3.zip"],
)

maybe(
http_archive,
name = "mcap",
build_file = "@com_github_mvukov_rules_ros2//repositories:mcap.BUILD.bazel",
sha256 = "2833f72344308ea58639f3b363a0cf17669580ae7ab435f43f3b104cff6ef548",
strip_prefix = "mcap-releases-cpp-v0.8.0/cpp/mcap",
urls = ["https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v0.8.0.tar.gz"],
)

maybe(
http_archive,
name = "yaml-cpp",
Expand All @@ -162,6 +209,9 @@ def ros2_repositories():
urls = ["https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz"],
)

def ros2_repositories():
"""Import ROS 2 repositories."""

maybe(
http_archive,
name = "ros2",
Expand Down Expand Up @@ -192,54 +242,6 @@ def ros2_repositories():
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",
build_file = "@com_github_mvukov_rules_ros2//repositories:websocketpp.BUILD.bazel",
sha256 = "6ce889d85ecdc2d8fa07408d6787e7352510750daa66b5ad44aacb47bea76755",
strip_prefix = "websocketpp-0.8.2",
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.
maybe(
http_archive,
name = "openssl",
sha256 = "cf1cfe0adb443ef96197b109292847c0a97304058af21f3488a323b51984608a",
strip_prefix = "boringssl-e762bd792ab7fecb170bdb1cd96a0bfb0c9d3238",
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 = "ros2_xacro",
Expand All @@ -259,16 +261,6 @@ def ros2_repositories():
urls = ["https://github.com/orocos/orocos_kinematics_dynamics/archive/507de66205e14b12c8c65f25eafc05c4dc66e21e.tar.gz"],
)

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 = "ros2_urdf",
Expand All @@ -291,15 +283,33 @@ def ros2_repositories():

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"],
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(
http_archive,
name = "foxglove_bridge",
build_file = "@com_github_mvukov_rules_ros2//repositories:foxglove_bridge.BUILD.bazel",
sha256 = "083940a629c225640e4f4a4a9f43512907c98c5c468ae93c75429d8447a97c69",
strip_prefix = "ros-foxglove-bridge-0.7.5",
urls = ["https://github.com/foxglove/ros-foxglove-bridge/archive/refs/tags/0.7.5.tar.gz"],
)

maybe(
http_archive,
name = "mcap",
build_file = "@com_github_mvukov_rules_ros2//repositories:mcap.BUILD.bazel",
sha256 = "2833f72344308ea58639f3b363a0cf17669580ae7ab435f43f3b104cff6ef548",
strip_prefix = "mcap-releases-cpp-v0.8.0/cpp/mcap",
urls = ["https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v0.8.0.tar.gz"],
)

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.
Expand Down

0 comments on commit 02e22d2

Please sign in to comment.