Skip to content

Commit

Permalink
Merge pull request #13 from ApexAI/pass-in-repos-overlay
Browse files Browse the repository at this point in the history
Pass repo index overlays to configure_ros2
  • Loading branch information
kilian-funk authored Aug 2, 2024
2 parents 4dfebd9 + 65ae96c commit c76f2c3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions repos/config/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ load("@rules_ros//repos/config/detail:ros2_config.bzl", "ros2_config")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@rules_ros//repos/config:distros.bzl", "DISTROS")

def _configure_ros2(*, name, distro_src):
def _configure_ros2(*, name, distro_src, repo_index_overlays):
distro_src_wo_index = {k: v for k, v in distro_src.items() if k != "repo_index"}
distro_src_wo_index["build_file_content"] = 'exports_files(["ros2.repos"])'

Expand All @@ -27,10 +27,10 @@ def _configure_ros2(*, name, distro_src):
repo_index = distro_src["repo_index"],
repo_index_overlays = [
"@rules_ros//repos/config:bazel.repos",
],
] + repo_index_overlays,
)

def configure_ros2(*, name = "ros2_config", distro):
def configure_ros2(*, name = "ros2_config", repo_index_overlays = [], distro):
"""
"""
if type(distro) == type(""):
Expand All @@ -41,4 +41,6 @@ def configure_ros2(*, name = "ros2_config", distro):
if not type(distro) == type({}) or not "repo_rule" in distro:
fail("Distro either needs to be a string (e.g. 'iron') or a dict with arguments for the maybe repo rule")
distro_src = distro
_configure_ros2(name = name, distro_src = distro_src)
if not type(repo_index_overlays) == type([]):
fail("repo_index_overlays needs to be a list of *.repos files")
_configure_ros2(name = name, distro_src = distro_src, repo_index_overlays = repo_index_overlays)

0 comments on commit c76f2c3

Please sign in to comment.