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

Update dependency bazel to v7 #228

Merged
merged 11 commits into from
Dec 23, 2023
12 changes: 12 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# See e.g. https://blog.aspect.dev/bazelrc-flags

# https://github.com/bazelbuild/rules_foreign_cc/issues/1129
# 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 Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.4.0
7.0.0
2 changes: 1 addition & 1 deletion .github/workflows/ci.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ build:remote --experimental_remote_cache_compression
# buildbuddy suggestions:
build:remote --experimental_profile_include_primary_output
build:remote --experimental_profile_include_target_label
build:remote --experimental_remote_build_event_upload=minimal
build:remote --remote_build_event_upload=minimal
build:remote --noslim_profile

# Don't spam CI logs.
Expand Down
3 changes: 0 additions & 3 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,4 @@ Before you build/run/test any of the targets in this folder, please make sure
your terminal is in this folder, or in a subfolder, and not in the root
of the repo.

If you want to run ROS 2 deployments in Docker containers, please install
[Docker](https://docs.docker.com/engine/install/ubuntu/).

You can start with a simple [chatter](chatter) example.
38 changes: 0 additions & 38 deletions examples/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -50,41 +50,3 @@ load(
)

install_rules_ros2_pip_deps()

# Below are listed only deps needed by examples: if you just need ROS 2 you don't
# need to import/load anything below.

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# rules_docker is not strictly necessary, but interesting if you want to create
# and/or push docker containers for the examples. The docker executable is
# needed only if you want to run an image using Bazel.
http_archive(
name = "io_bazel_rules_docker",
sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf",
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"],
)

load(
"@io_bazel_rules_docker//repositories:repositories.bzl",
container_repositories = "repositories",
)

container_repositories()

load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps")

container_deps()

load(
"@io_bazel_rules_docker//container:container.bzl",
"container_pull",
)

# The base docker image is defined in https://github.com/mvukov/bazel_deploy_base repo.
container_pull(
name = "ros_deploy_base",
digest = "sha256:322c3900f36c4078f4a7831026bd1782c859d27f0a8fc909c9928e59bdd764bb",
registry = "docker.io",
repository = "mvukov/bazel-deploy-base",
)
18 changes: 0 additions & 18 deletions examples/chatter/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ load("@com_github_mvukov_rules_ros2//ros2:cc_defs.bzl", "ros2_cpp_binary")
load("@com_github_mvukov_rules_ros2//ros2:launch.bzl", "ros2_launch")
load("@com_github_mvukov_rules_ros2//ros2:test.bzl", "ros2_test")
load("@com_github_mvukov_rules_ros2//ros2:topic.bzl", "ros2_topic")
load("@io_bazel_rules_docker//container:container.bzl", "container_push")
load("@io_bazel_rules_docker//lang:image.bzl", container_image = "app_layer")
load("@rules_python//python:defs.bzl", "py_binary")

ros2_cpp_binary(
Expand Down Expand Up @@ -70,19 +68,3 @@ ros2_bag(
"@ros2_rosbag2//:rosbag2_interfaces",
],
)

container_image(
name = "chatter_image",
base = "@ros_deploy_base//image",
binary = ":chatter",
docker_run_flags = "-it --rm --network=host",
)

container_push(
name = "chatter_publish",
format = "Docker",
image = ":chatter_image",
registry = "docker.io",
repository = "mvukov/chatter",
tag = "demo_ros2",
)
6 changes: 0 additions & 6 deletions examples/chatter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ You can run tests with
bazel test //chatter:tests # To see the logs run with `--test_output=all`.
```

To run the sample deployment in a Docker container, run

```sh
bazel run //chatter:chatter_image
```

Alternatively, you can run nodes without the launch mechanism. In a terminal run

```sh
Expand Down