Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename the DWYU output group #170

Merged
merged 1 commit into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ your_dwyu_aspect = dwyu_aspect_factory()
### Use the aspect

Invoke the aspect through the command line on a target:<br>
`bazel build <target_pattern> --aspects=//:aspect.bzl%your_dwyu_aspect --output_groups=cc_dwyu_output`
`bazel build <target_pattern> --aspects=//:aspect.bzl%your_dwyu_aspect --output_groups=dwyu`

If no problem is found, the command will exit with `INFO: Build completed successfully`.<br>
If a problem is detected, the build command will fail with an error and a description of the problem will be printed in the terminal. For example:
Expand Down
6 changes: 3 additions & 3 deletions src/aspect/dwyu.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ def _gather_transitive_reports(ctx):
"""
reports = []
if ctx.attr._recursive:
reports.extend([dep[OutputGroupInfo].cc_dwyu_output for dep in ctx.rule.attr.deps])
reports.extend([dep[OutputGroupInfo].dwyu for dep in ctx.rule.attr.deps])
if hasattr(ctx.rule.attr, "implementation_deps"):
reports.extend([dep[OutputGroupInfo].cc_dwyu_output for dep in ctx.rule.attr.implementation_deps])
reports.extend([dep[OutputGroupInfo].dwyu for dep in ctx.rule.attr.implementation_deps])
return reports

def dwyu_aspect_impl(target, ctx):
Expand Down Expand Up @@ -238,4 +238,4 @@ def dwyu_aspect_impl(target, ctx):
)

accumulated_reports = depset(direct = [report_file], transitive = _gather_transitive_reports(ctx))
return [OutputGroupInfo(cc_dwyu_output = accumulated_reports)]
return [OutputGroupInfo(dwyu = accumulated_reports)]
2 changes: 1 addition & 1 deletion test/apply_fixes/test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def _create_reports(
cmd = ["bazel"]
if startup_args:
cmd.extend(startup_args)
cmd.extend(["build", f"--aspects=//:aspect.bzl%{aspect}", "--output_groups=cc_dwyu_output"])
cmd.extend(["build", f"--aspects=//:aspect.bzl%{aspect}", "--output_groups=dwyu"])
if extra_args:
cmd.extend(extra_args)
cmd.append(self.test_target)
Expand Down
2 changes: 1 addition & 1 deletion test/aspect/execute_tests_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def bazel_binary() -> str:
def make_cmd(test_cmd: TestCmd, startup_args: List[str], extra_args: List[str]) -> List[str]:
cmd = [bazel_binary()] + startup_args + ["build", "--noshow_progress"]
if test_cmd.aspect:
cmd.extend([f"--aspects={test_cmd.aspect}", "--output_groups=cc_dwyu_output"])
cmd.extend([f"--aspects={test_cmd.aspect}", "--output_groups=dwyu"])
cmd.extend(extra_args)
cmd.extend(test_cmd.extra_args)
cmd.append("--")
Expand Down
4 changes: 2 additions & 2 deletions test/aspect/execute_tests_utest.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def test_complex_test_cmd(self):
self.assertEqual(
cmd,
self._base_cmd()
+ ["--aspects=//some/aspect.bzl", "--output_groups=cc_dwyu_output", "--abc", "--cba", "--", "//foo:bar"],
+ ["--aspects=//some/aspect.bzl", "--output_groups=dwyu", "--abc", "--cba", "--", "//foo:bar"],
)

def test_extra_args_on_top_of_test_cmd(self):
Expand All @@ -208,7 +208,7 @@ def test_extra_args_on_top_of_test_cmd(self):
self._base_cmd(startup_args=["--some_startup_arg"])
+ [
"--aspects=//some/aspect.bzl",
"--output_groups=cc_dwyu_output",
"--output_groups=dwyu",
"--outside_arg",
"--test_related_arg",
"--",
Expand Down
2 changes: 1 addition & 1 deletion test/aspect/recursion/rule.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ load("//test/aspect/recursion:aspect.bzl", "recursive_aspect", "recursive_impl_d

def _dwyu_rule_impl(ctx):
# gather artifacts to make sure the aspect is executed
aspect_artifacts = depset(transitive = [dep[OutputGroupInfo].cc_dwyu_output for dep in ctx.attr.deps])
aspect_artifacts = depset(transitive = [dep[OutputGroupInfo].dwyu for dep in ctx.attr.deps])
return [DefaultInfo(files = aspect_artifacts)]

dwyu_rule_direct = rule(
Expand Down