ctx.attr.deps,
)
- # Note that we have two types of includes here. The deprecated ones expanded
- # only by "_prefix_roots" are already relative to the execution root, i.e.
- # may contain an `external/<workspace_name>` prefix if the current workspace
- # is not the main workspace (where workspace_name is something configured
- # per-project and therefore generally not known). Note that dirname also
- # already includes this prefix. The new style of includes have it prepended
- # automatically by `_resolve_includes` to avoid BUILD files having to depend
- # on project specific configurations and Bazel implementation details.
+ # Note that the td_file.dirname is already relative to the execution root,
+ # i.e. may contain an `external/<workspace_name>` prefix if the current
+ # workspace is not the main workspace. Therefore it is not included in the
+ # _resolve_includes call that prepends this prefix.
trans_includes = _get_transitive_includes(
_resolve_includes(ctx, ctx.attr.includes + ["/"]) +
- _prefix_roots(ctx, ctx.attr.td_includes + [td_file.dirname]),
+ _prefix_roots(ctx, [td_file.dirname]),
ctx.attr.deps,
)
" directories). The execution roots themselves and the " +
" directory of td_file are always added.",
),
- "td_includes": attr.string_list(
- doc = "Include paths to add to the TableGen invocation. Paths are" +
- " interpreted as relative to the current label's workspace" +
- " root and applied from all roots available in the" +
- " execution environment (source, genfiles, and bin" +
- " directories). Deprecated. Use `includes` instead.",
- ),
},
)
def _gentbl_test_impl(ctx):
td_file = ctx.file.td_file
- # Note that we have two types of includes here. The deprecated ones expanded
- # only by "_prefix_roots" are already relative to the execution root, i.e.
- # may contain an `external/<workspace_name>` prefix if the current workspace
- # is not the main workspace (where workspace_name is something configured
- # per-project and therefore generally not known). Note that dirname also
- # already includes this prefix. The new style of includes have it prepended
- # automatically by `_resolve_includes` to avoid BUILD files having to depend
- # on project specific configurations and Bazel implementation details.
+ # Note that the td_file.dirname is already relative to the execution root,
+ # i.e. may contain an `external/<workspace_name>` prefix if the current
+ # workspace is not the main workspace. Therefore it is not included in the
+ # _resolve_includes call that prepends this prefix.
trans_includes = _get_transitive_includes(
_resolve_includes(ctx, ctx.attr.includes + ["/"]) +
- _prefix_roots(ctx, ctx.attr.td_includes + [td_file.dirname]),
+ _prefix_roots(ctx, [td_file.dirname]),
ctx.attr.deps,
)
"deps": attr.label_list(doc = "See gentbl_rule.deps"),
"opts": attr.string_list(doc = "See gentbl_rule.opts"),
"includes": attr.string_list(doc = "See gentbl_rule.includes"),
- "td_includes": attr.string_list(doc = "See gentbl_rule.td_includes"),
},
)
td_file,
tbl_outs,
td_srcs = [],
- td_includes = [],
includes = [],
deps = [],
test = False,
corresponding output file produced.
td_srcs: See gentbl_rule.td_srcs
includes: See gentbl_rule.includes
- td_includes: See gentbl_rule.td_includes
deps: See gentbl_rule.deps
test: Whether to create a shell test that invokes the tool too.
skip_opts: Files generated using these opts in tbl_outs will be excluded
**kwargs: Extra keyword arguments to pass to all generated rules.
"""
- llvm_project_execroot_path = Label("//mlir:tblgen.bzl").workspace_root
-
- # TODO(gcmn): Update callers to td_library and explicit includes and drop
- # this hardcoded include.
- hardcoded_includes = [
- paths.join(llvm_project_execroot_path, "mlir/include"),
- ]
-
for (opts, out) in tbl_outs:
first_opt = opts[0] if opts else ""
rule_suffix = "_{}_{}".format(
td_srcs = td_srcs,
deps = deps,
includes = includes,
- td_includes = td_includes + hardcoded_includes,
out = out,
**kwargs
)
td_srcs = td_srcs,
deps = deps,
includes = includes,
- td_includes = td_includes + hardcoded_includes,
# Shell files not executable on Windows.
# TODO(gcmn): Support windows.
tags = ["no_windows"],
td_file,
tbl_outs,
td_srcs = [],
- td_includes = [],
includes = [],
deps = [],
strip_include_prefix = None,
corresponding output file produced.
td_srcs: See gentbl_rule.td_srcs
includes: See gentbl_rule.includes
- td_includes: See gentbl_rule.td_includes
deps: See gentbl_rule.deps
strip_include_prefix: attribute to pass through to cc_library.
test: whether to create a shell test that invokes the tool too.
td_file = td_file,
tbl_outs = tbl_outs,
td_srcs = td_srcs,
- td_includes = td_includes,
includes = includes,
deps = deps,
test = test,