Skip to content
Open
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
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.5.0
8.3.0
61 changes: 61 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
module(
name = "rules_ros",
bazel_compatibility = [">=7.4.1"],
)

bazel_dep(name = "rules_cc", version = "0.2.2")

# Python
bazel_dep(name = "rules_python", version = "1.5.1")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
is_default = True,
python_version = "3.10.12",
)
use_repo(python, "python_3_10")

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "python_deps",
python_version = "3.10.12",
requirements_lock = "@rules_ros//thirdparty/python:requirements_lock.txt",
)
use_repo(pip, "python_deps")

bazel_dep(name = "bazel_skylib", version = "1.8.1")
bazel_dep(name = "rules_pkg", version = "1.1.0")
bazel_dep(name = "libyaml", version = "0.2.5")

# currently only humble is supported, until new lock file format is introduced
ros2_config = use_extension("@rules_ros//repos/config:extensions.bzl", "ros2_config")
ros2_config.config(
name = "ros2_config",
distro = "humble",
)
use_repo(ros2_config, "ros2_config")

ros_repos = use_extension("//repos/config:extensions/humble.bzl", "ros_repos")
use_repo(
ros_repos,
"ament.ament_index",
"eProsima.Fast-CDR",
"eProsima.Fast-DDS",
"eProsima.foonathan_memory_vendor",
"eclipse-cyclonedds.cyclonedds",
"eclipse-iceoryx.iceoryx",
"ros-tooling.libstatistics_collector",
"ros2.common_interfaces",
"ros2.rcl",
"ros2.rcl_interfaces",
"ros2.rcl_logging",
"ros2.rclcpp",
"ros2.rcpputils",
"ros2.rcutils",
"ros2.rmw",
"ros2.ros2_tracing",
"ros2.ros2cli",
"ros2.rosidl",
"ros2.rosidl_dds",
"ros2.rosidl_typesupport",
)
698 changes: 698 additions & 0 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024 Apex.AI, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

workspace(name = "rules_ros")
3 changes: 2 additions & 1 deletion repos/ament.ament_index/ament_index_python.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
# limitations under the License.

load("@rules_python//python:packaging.bzl", "py_wheel")
load("@rules_python//python:python.bzl", "py_test")
load("@rules_python//python:py_library.bzl", "py_library")
load("@rules_python//python:py_test.bzl", "py_test")
load("@rules_ros//pkg:defs.bzl", "ros_pkg")
load("@python_deps//:requirements.bzl", "requirement")

Expand Down
5 changes: 5 additions & 0 deletions repos/config/detail/ros2_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ def _ros2_config_impl(ctx):
content = "workspace(name = {})".format(ctx.name),
executable = False,
)
ctx.file(
"MODULE.bazel",
content = "module(name = {})".format(ctx.name),
executable = False,
)
ctx.file(
"BUILD.bazel",
content = BUILD_FILE_CONTENT.format(
Expand Down
19 changes: 19 additions & 0 deletions repos/config/extensions.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
load(":defs.bzl", "configure_ros2")

def _ros2_config_impl(module_ctx):
print((module_ctx.modules[0].name))
for mod in module_ctx.modules:
for config in mod.tags.config:
configure_ros2(name = config.name, distro = config.distro)

_distro_config = tag_class(
attrs = {
"name": attr.string(),
"distro": attr.string(),
},
)

ros2_config = module_extension(
implementation = _ros2_config_impl,
tag_classes = {"config": _distro_config},
)
8 changes: 8 additions & 0 deletions repos/config/extensions/humble.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("//repos/config:setup_humble.lock.bzl", "setup")

def _ros_repos_impl(module_ctx):
setup()

ros_repos = module_extension(
implementation = _ros_repos_impl,
)
6 changes: 3 additions & 3 deletions repos/ros-tooling.libstatistics_collector/root.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@bazel_skylib//rules:expand_template.bzl","expand_template")
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")

cc_library(
name = "libstatistics_collector",
srcs = glob([
"src/**/*.c",
"src/**/*.cpp",
]),
], allow_empty = True),
hdrs = glob([
"include/**/*.h",
"include/**/*.hpp",
]),
], allow_empty = True),
strip_include_prefix = "include",
deps = [
"@ros2.rcl_interfaces//builtin_interfaces",
Expand Down
3 changes: 1 addition & 2 deletions repos/ros2.common_interfaces/std_msgs.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ msgs_library(
"msg/*.idl",
"msg/*.msg",
"srv/*.srv",
]),
], allow_empty = True),
visibility = ["//visibility:public"],
deps = [
"@ros2.rcl_interfaces//builtin_interfaces",
],
)

2 changes: 1 addition & 1 deletion repos/ros2.rcl_interfaces/builtin_interfaces.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ msgs_library(
"msg/*.msg",
"msg/*.idl",
"srv/*.srv",
]),
], allow_empty = True),
visibility = ["//visibility:public"],
)
2 changes: 1 addition & 1 deletion repos/ros2.rcl_interfaces/rcl_interfaces.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ msgs_library(
"msg/*.msg",
"msg/*.idl",
"srv/*.srv",
]),
], allow_empty = True),
visibility = ["//visibility:public"],
deps = [
"//builtin_interfaces",
Expand Down
2 changes: 1 addition & 1 deletion repos/ros2.rcl_interfaces/rosgraph_msgs.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ msgs_library(
"msg/*.msg",
"msg/*.idl",
"srv/*.srv",
]),
], allow_empty = True),
visibility = ["//visibility:public"],
deps = [
"//builtin_interfaces",
Expand Down
2 changes: 1 addition & 1 deletion repos/ros2.rcl_interfaces/statistics_msgs.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ msgs_library(
"msg/*.msg",
"msg/*.idl",
"srv/*.srv",
]),
], allow_empty = True),
visibility = ["//visibility:public"],
deps = [
"//builtin_interfaces",
Expand Down
4 changes: 2 additions & 2 deletions repos/ros2.rcpputils/rcpputils.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

cc_library(
name = "rcpputils",
srcs = glob(["src/**/*.c"]),
srcs = glob(["src/**/*.c"], allow_empty = True),
hdrs = glob(["include/**/*.hpp"]),
strip_include_prefix = "include",
visibility = ["//visibility:public"],
)
)
3 changes: 2 additions & 1 deletion repos/ros2.rosidl_typesupport/rosidl_typesupport_c.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
load("@rules_python//python:py_library.bzl", "py_library")

py_library(
name = "rosidl_typesupport_c_python",
Expand Down Expand Up @@ -67,7 +68,7 @@ cc_library(

filegroup(
name = "config_files",
srcs = glob(["resource/*.in"]),
srcs = glob(["resource/*.in"], allow_empty = True),
visibility = ["//visibility:public"],
)

Expand Down
4 changes: 2 additions & 2 deletions thirdparty/bazel_skylib/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

BAZEL_SKYLIB_VERSION = "1.3.0"
BAZEL_SKYLIB_SHA = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506"
BAZEL_SKYLIB_VERSION = "1.8.1"
BAZEL_SKYLIB_SHA = "51b5105a760b353773f904d2bbc5e664d0987fbaf22265164de65d43e910d8ac"

def load_bazel_skylib_repositories():
maybe(
Expand Down
2 changes: 2 additions & 0 deletions thirdparty/python/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ load("@rules_python//python:pip.bzl", "compile_pip_requirements")

compile_pip_requirements(
name = "requirements_lock",
src = "requirements_lock.in",
requirements_txt = "requirements_lock.txt",
)
3 changes: 1 addition & 2 deletions thirdparty/python/pip_parse.bzl
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
load("@python_interpreter//:defs.bzl", "interpreter")
load("@rules_python//python:pip.bzl", _pip_parse = "pip_parse")

def pip_parse():
_pip_parse(
name = "python_deps",
python_interpreter_target = interpreter,
python_interpreter_target = "@python_interpreter_host//:python",
requirements_lock = "@rules_ros//thirdparty/python:requirements_lock.txt",
)
6 changes: 3 additions & 3 deletions thirdparty/python/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

PYTHON_VERSION = "3.8.13"
RULES_PYTHON_VERSION = "0.12.0"
RULES_PYTHON_SHA = "b593d13bb43c94ce94b483c2858e53a9b811f6f10e1e0eedc61073bd90e58d9c"
PYTHON_VERSION = "3.10.12"
RULES_PYTHON_VERSION = "1.5.1"
RULES_PYTHON_SHA = "fa532d635f29c038a64c8062724af700c30cf6b31174dd4fac120bc561a1a560"

def load_rules_python_repositories():
maybe(
Expand Down
6 changes: 3 additions & 3 deletions thirdparty/python/requirements_lock.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# bazel run //thirdparty/python:requirements_lock.update
#
Expand Down Expand Up @@ -99,7 +99,7 @@ python-dateutil==2.8.2 \
--hash=sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86 \
--hash=sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9
# via catkin-pkg
pyyaml==6.0.0 \
pyyaml==6.0 \
--hash=sha256:01b45c0191e6d66c470b6cf1b9531a771a83c1c4208272ead47a3ae4f2f603bf \
--hash=sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293 \
--hash=sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
load("@rules_python//python:repositories.bzl", "python_register_toolchains")
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
load("@rules_ros//thirdparty/python:repositories.bzl", "PYTHON_VERSION")

def register_python_toolchain():
def setup_rules_python_repositories():
py_repositories()
python_register_toolchains(
name = "python_interpreter",
# Available versions are listed in @rules_python//python:versions.bzl.
Expand Down
4 changes: 2 additions & 2 deletions thirdparty/rules_pkg/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

RULES_PKG_VERSION = struct(
version = "0.10.1",
sha256 = "d250924a2ecc5176808fc4c25d5cf5e9e79e6346d79d5ab1c493e289e722d1d0",
version = "1.1.0",
sha256 = "b7215c636f22c1849f1c3142c72f4b954bb12bb8dcf3cbe229ae6e69cc6479db",
)

def load_rules_pkg_repositories():
Expand Down
4 changes: 2 additions & 2 deletions thirdparty/setup_02.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
# limitations under the License.

load("@rules_ros//thirdparty/bazel_skylib:setup.bzl", "setup_bazel_skylib_repositories")
load("@rules_ros//thirdparty/python:setup_toolchain.bzl", "register_python_toolchain")
load("@rules_ros//thirdparty/python:setup.bzl", "setup_rules_python_repositories")
load("@rules_ros//thirdparty/rules_pkg:setup.bzl", "setup_rules_pkg_repositories")

def setup_02():
register_python_toolchain()
setup_rules_python_repositories()
setup_bazel_skylib_repositories()
setup_rules_pkg_repositories()