Skip to content

Commit

Permalink
Remove usage of predeclared outputs from rules (#891)
Browse files Browse the repository at this point in the history
  • Loading branch information
luispadron authored Aug 8, 2024
1 parent 5e43dd1 commit 55ed20d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
10 changes: 6 additions & 4 deletions rules/framework/vfs_overlay.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ def _framework_vfs_overlay_impl(ctx):
if VFSOverlayInfo in dep:
vfsoverlays.append(dep[VFSOverlayInfo].vfs_info)

vfs_overlay_file = ctx.actions.declare_file(ctx.label.name + ".yaml")

vfs = make_vfsoverlay(
ctx,
hdrs = ctx.files.hdrs,
Expand All @@ -275,7 +277,7 @@ def _framework_vfs_overlay_impl(ctx):
has_swift = ctx.attr.has_swift,
swiftmodules = ctx.files.swiftmodules,
merge_vfsoverlays = vfsoverlays,
output = ctx.outputs.vfsoverlay_file,
output = vfs_overlay_file,
extra_search_paths = ctx.attr.extra_search_paths,
)

Expand All @@ -287,6 +289,9 @@ def _framework_vfs_overlay_impl(ctx):
),
)
return [
DefaultInfo(
files = depset([vfs_overlay_file]),
),
apple_common.new_objc_provider(),
cc_info,
VFSOverlayInfo(
Expand Down Expand Up @@ -447,7 +452,4 @@ toolchain (such as `clang`) will be retrieved.
fragments = [
"apple",
],
outputs = {
"vfsoverlay_file": "%{name}.yaml",
},
)
12 changes: 8 additions & 4 deletions rules/hmap.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,26 @@ def _make_headermap_impl(ctx):
# means neither apple_common.Objc nor CcInfo in hdr provider target
fail("direct_hdr_provider %s must contain either 'CcInfo' or 'objc' provider" % provider)

headermap = ctx.actions.declare_file(ctx.label.name + ".hmap")

hmap.make_hmap(
actions = ctx.actions,
headermap_builder = ctx.executable._headermap_builder,
output = ctx.outputs.headermap,
output = headermap,
namespace = ctx.attr.namespace,
hdrs_lists = hdrs_lists,
)

cc_info_provider = CcInfo(
compilation_context = cc_common.create_compilation_context(
headers = depset([ctx.outputs.headermap]),
headers = depset([headermap]),
),
)

providers = [
DefaultInfo(
files = depset([headermap]),
),
apple_common.new_objc_provider(),
cc_info_provider,
swift_common.create_swift_info(),
Expand All @@ -93,7 +98,7 @@ def _make_headermap_impl(ctx):
hdrs_lists = [l for l in hdrs_lists if l]
if len(hdrs_lists) > 0:
providers.append(HeaderMapInfo(
files = depset([ctx.outputs.headermap]),
files = depset([headermap]),
))

return providers
Expand Down Expand Up @@ -126,7 +131,6 @@ headermap = rule(
),
),
},
outputs = {"headermap": "%{name}.hmap"},
doc = """\
Creates a binary headermap file from the given headers,
suitable for passing to clang.
Expand Down

0 comments on commit 55ed20d

Please sign in to comment.