Skip to content

Commit

Permalink
Replace e2e print-build-report with build-report=-
Browse files Browse the repository at this point in the history
Summary: `print-build-report` is deprecated and should be replaced by  `build-report=-`. First remove our internal e2e usage

Reviewed By: stepancheg

Differential Revision: D57986774

fbshipit-source-id: 182edb5bc6233a9a4fc31af64234cb3bbc89f000
  • Loading branch information
Will-MingLun-Li authored and facebook-github-bot committed Jun 4, 2024
1 parent fdac95c commit 85f33c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions tests/e2e_util/api/buck.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ def build(
if (
self.executable_type
in (ExecutableType.buck2, ExecutableType.buck2_build_api_binary)
and "--print-build-report" not in args
and "--build-report" not in args
):
args.append("--print-build-report")
args.append("--build-report=-")

return self._run_buck_command(
"build",
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e_util/api/buck_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def get_exit_code_v2(self) -> ExitCodeV2:
class BuildReport:
"""
A parsed JSON representation of buck v2 build output on stdout.
Build report is invoked on v2 builds by passing --print-build-report flag.
Build report is invoked on v2 builds by passing --build-report flag.
Does not support buck v1.
Attributes:
Expand Down Expand Up @@ -261,8 +261,8 @@ def get_target_to_build_output(self) -> Dict[str, str]:
"--show-output" in self.args or "--show-full-output" in self.args
), "Must add --show-output or --show-full-output arg to get build output"
show_output = self.stdout.strip().splitlines()
if "--print-build-report" in self.args:
# When mixing --show-output with --print-build-report, the first line is
if "--build-report" in self.args:
# When mixing --show-output with --build-report, the first line is
# the build report, and the remaining ones are the results
show_output = show_output[1:]
for line in show_output:
Expand All @@ -277,14 +277,14 @@ def get_target_to_build_output(self) -> Dict[str, str]:

def get_build_report(self) -> BuildReport:
"""
Returns a BuildReport object for a buck v2 build invoked with --print-build-report.
Returns a BuildReport object for a buck v2 build invoked with --build-report.
Looks for a '{' and parses the build stdout starting from '{' as a json.
"""
try:
assert self.executable_type in (
ExecutableType.buck2,
ExecutableType.buck2_build_api_binary,
), "--print-build-report only works in v2"
), "--build-report only works in v2"
start = self.stdout.index("{")
end = self.stdout.index("\n", start)
parsed = json.loads(self.stdout[start:end])
Expand Down

0 comments on commit 85f33c6

Please sign in to comment.