Skip to content

Commit

Permalink
Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
revati-naik-apex committed Feb 13, 2025
1 parent c3870de commit 31b9f25
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions repos/config/detail/ros2_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,23 @@ exports_files(glob(["**/*"]))
def _ros2_config_impl(ctx):
ctx.symlink(ctx.attr.repos_index, "ros.repos")
ctx.symlink(ctx.attr.setup_file, "setup.bzl")
i = 0
overlay_files = []
for file in ctx.attr.repos_index_overlays:
filname = "overlay_{}.bzl".format(i)
ctx.symlink(file, filname)
i += 1
overlay_files.append(filname)
ctx.file("WORKSPACE", content = "workspace(name = {})".format(ctx.name), executable = False)
ctx.file("BUILD.bazel", content = BUILD_FILE_CONTENT.format(overlays="\n".join([' "{}",'.format(filename) for filename in overlay_files])), executable = False)
for i, file in enumerate(ctx.attr.repos_index_overlays):
filename = "overlay_{}.bzl".format(i)
ctx.symlink(file, filename)
overlay_files.append(filename)
ctx.file(
"WORKSPACE",
content = "workspace(name = {})".format(ctx.name),
executable = False
)
ctx.file(
"BUILD.bazel",
content = BUILD_FILE_CONTENT.format(
overlays="\n".join([' "{}",'.format(filename) for filename in overlay_files])
),
executable = False
)

return update_attrs(ctx.attr, _archive_attrs.keys(), {})

Expand Down

0 comments on commit 31b9f25

Please sign in to comment.