Skip to content

Commit c40ee9e

Browse files
grievejiafacebook-github-bot
authored andcommitted
Quote targets for buck query on incremental rebuilds
Reviewed By: dkgi Differential Revision: D30530162 fbshipit-source-id: ae59634b17971fd94e036ade399af35daa983da1
1 parent 38d8a8f commit c40ee9e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

source/buck/builder.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,13 @@ let query_buck_for_changed_targets ~targets { BuckOptions.raw; mode; isolation_p
8585
match source_paths with
8686
| [] -> Lwt.return "{}"
8787
| source_paths ->
88-
let target_string = List.map targets ~f:Target.show |> String.concat ~sep:" " in
88+
let target_string =
89+
(* Targets need to be quoted since `buck query` can fail with syntax errors if target
90+
name contains special characters like `=`. *)
91+
let quote_string value = Format.sprintf "\"%s\"" value in
92+
let quote_target target = Target.show target |> quote_string in
93+
List.map targets ~f:quote_target |> String.concat ~sep:" "
94+
in
8995
List.concat
9096
[
9197
["--json"];

0 commit comments

Comments
 (0)