Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: extract rules_ros2_workspace_deps #254

Merged
merged 3 commits into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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", "ros2_workspace_repositories")

ros2_workspace_repositories()

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", "ros2_workspace_repositories")

ros2_workspace_repositories()

ros2_repositories()

Expand Down
174 changes: 89 additions & 85 deletions repositories/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
"""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 ros2_workspace_repositories():
"""Imports dependent third-party repositories for the non-blzmod (hence, workspace-) version of the repository.

In particular, imports third-party package repositories excluding ROS 2 packages. ROS 2-specific repositories are imported with `ros2_repositories()` macro.
"""
maybe(
http_archive,
Expand Down Expand Up @@ -90,15 +91,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 +109,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 = "boringssl",
sha256 = "6ba54847850468160ca8ccfaf6147db75e8b4b0b8e0c175bb59c5b20684e2297",
strip_prefix = "boringssl-470fce33ee0175e906a4039110ec083849968aa3",
urls = ["https://github.com/hedronvision/boringssl/archive/470fce33ee0175e906a4039110ec083849968aa3.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 +194,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 +212,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 +245,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 = "boringssl",
sha256 = "6ba54847850468160ca8ccfaf6147db75e8b4b0b8e0c175bb59c5b20684e2297",
strip_prefix = "boringssl-470fce33ee0175e906a4039110ec083849968aa3",
urls = ["https://github.com/hedronvision/boringssl/archive/470fce33ee0175e906a4039110ec083849968aa3.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 +264,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 +286,24 @@ 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 = "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
Loading