[buck] Closed regexes to filter target kinds

Summary:
In buck queries, the `regex` in `kind(regex, ...)` is open, it can match superstrings, like `prebuilt_cxx_library` when we want `cxx_library` instead.
This adds `^` and `$` to our existing kind filtering.
Also optimizes the query in `buck_target_determinator.py`.

Reviewed By: dulmarod

Differential Revision: D6722665

fbshipit-source-id: 22d839f
master
Mehdi Bouaziz 7 years ago committed by Facebook Github Bot
parent c18db51417
commit d0a30d61c4

@ -106,7 +106,7 @@ def get_normalized_targets(targets):
# this expands the targets passed on the command line, then filters away # this expands the targets passed on the command line, then filters away
# targets that are not Java/Android. you need to change this if you # targets that are not Java/Android. you need to change this if you
# care about something other than Java/Android # care about something other than Java/Android
TARGET_TYPES = "kind('android_library|java_library', deps('%s'))" TARGET_TYPES = "kind('^(android|java)_library$', deps('%s'))"
BUCK_GET_JAVA_TARGETS = ['buck', 'query', TARGET_TYPES] BUCK_GET_JAVA_TARGETS = ['buck', 'query', TARGET_TYPES]
buck_cmd = BUCK_GET_JAVA_TARGETS + targets buck_cmd = BUCK_GET_JAVA_TARGETS + targets

@ -132,8 +132,8 @@ let parameters_with_argument =
let get_accepted_buck_kinds_pattern () = let get_accepted_buck_kinds_pattern () =
if Option.is_some Config.buck_compilation_database then "(apple|cxx)_(binary|library|test)" if Option.is_some Config.buck_compilation_database then "^(apple|cxx)_(binary|library|test)$"
else "(apple|cxx)_(binary|library)" else "^(apple|cxx)_(binary|library)$"
let max_command_line_length = 50 let max_command_line_length = 50

Loading…
Cancel
Save