Skip to content

Commit

Permalink
Change ZigModuleInfo field names
Browse files Browse the repository at this point in the history
  • Loading branch information
aherrmann committed Feb 21, 2024
1 parent d4b53c7 commit 2830f58
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions zig/private/providers/zig_module_info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ instead the Zig compiler performs whole program compilation.
FIELDS = {
"name": "string, The import name of the module.",
"canonical_name": "string, The canonical name may differ from the import name via remapping.",
"all_args": "depset of struct, All module CLI specifications required when depending on the module, to be rendered.",
"all_srcs": "depset of File, All source files required when depending on the module.",
"transitive_args": "depset of struct, All module CLI specifications required when depending on the module, including transitive dependencies, to be rendered.",
"transitive_inputs": "depset of File, All build inputs files required when depending on the module, including transitive dependencies.",
}

ZigModuleInfo = provider(
Expand All @@ -40,8 +40,8 @@ def zig_module_info(*, name, canonical_name, main, srcs, extra_srcs, deps):
srcs_transitive = []

for dep in deps:
args_transitive.append(dep.all_args)
srcs_transitive.append(dep.all_srcs)
args_transitive.append(dep.transitive_args)
srcs_transitive.append(dep.transitive_inputs)

arg_direct = _module_args(
canonical_name = canonical_name,
Expand All @@ -50,13 +50,13 @@ def zig_module_info(*, name, canonical_name, main, srcs, extra_srcs, deps):
)
srcs_direct = [main] + srcs + extra_srcs

all_args = depset(direct = [arg_direct], transitive = args_transitive)
all_srcs = depset(direct = srcs_direct, transitive = srcs_transitive)
transitive_args = depset(direct = [arg_direct], transitive = args_transitive)
transitive_inputs = depset(direct = srcs_direct, transitive = srcs_transitive)
module = ZigModuleInfo(
name = name,
canonical_name = canonical_name,
all_args = all_args,
all_srcs = all_srcs,
transitive_args = transitive_args,
transitive_inputs = transitive_inputs,
)

return module
Expand Down Expand Up @@ -113,8 +113,8 @@ def zig_module_dependencies(*, deps, extra_deps = [], inputs, args):

for module in modules:
deps_args.append(_render_dep(module))
transitive_args.append(module.all_args)
inputs.append(module.all_srcs)
transitive_args.append(module.transitive_args)
inputs.append(module.transitive_inputs)

args.add_all(depset(transitive = transitive_args), map_each = _render_args)
args.add_joined("--deps", deps_args, join_with = ",")
4 changes: 2 additions & 2 deletions zig/tests/module_info_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def _single_module_test_impl(ctx):

bazel_builtin_file = [
file
for file in module.all_srcs.to_list()
for file in module.transitive_inputs.to_list()
if file.path == _bazel_builtin_file_name(ctx, ctx.attr.mod.label)
]

Expand Down Expand Up @@ -158,7 +158,7 @@ def _nested_modules_test_impl(ctx):
dep = _bazel_builtin_dep(mod.label),
file = [
file
for file in mods[mod.label.name].all_srcs.to_list()
for file in mods[mod.label.name].transitive_inputs.to_list()
if file.path == _bazel_builtin_file_name(ctx, mod.label)
],
)
Expand Down

0 comments on commit 2830f58

Please sign in to comment.