Skip to content

Commit

Permalink
encode as strings instead of SimpleElement
Browse files Browse the repository at this point in the history
Summary:
the pyre client is erroring when json encoding this new argument. see test plan for details. This diff changes the argument from a SimpleElement (can't be encoded) to a string (can be encoded).

to do this we use the [command_line_argument](https://fburl.com/code/s82mhdzk) encoding function like in other places in the file.

Reviewed By: connernilsen

Differential Revision: D50748733

fbshipit-source-id: b9955d27e5ebc22dce842301ecf7b0698626898d
  • Loading branch information
kinto0 authored and facebook-github-bot committed Oct 27, 2023
1 parent 7f19591 commit 30fc317
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion client/backend_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ def serialize(self) -> Dict[str, object]:
**(
{}
if targets_fallback_sources is None
else {"targets_fallback_sources": targets_fallback_sources}
else {
"targets_fallback_sources": [
element.command_line_argument()
for element in targets_fallback_sources
],
}
),
**({} if mode is None else {"mode": mode}),
**(
Expand Down
2 changes: 1 addition & 1 deletion client/tests/backend_arguments_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_serialize_source_paths(self) -> None:
"source_root": "/source",
"artifact_root": "/artifact",
"targets": ["//foo:bar"],
"targets_fallback_sources": [search_path.SimpleElement("/source")],
"targets_fallback_sources": ["/source"],
"mode": "opt",
"isolation_prefix": ".lsp",
"bxl_builder": "//foo.bxl:build",
Expand Down

0 comments on commit 30fc317

Please sign in to comment.