[buck] stop supporting the pre-genrule Java integration

Summary:
You should use `--buck-java` instead, which uses the new "genrule
master" integration.

This diff makes it impossible to select the previous integration.
Upcoming diffs will clean up the resulting dead code.

This also make infer fail hard when no buck mode is specified in a buck
capture command, eg `infer -- buck build //foo:foo`. The reason is that
we need to choose between 3 incompatible integrations and making any of
them the default will confuse at least one person in the future.

Reviewed By: ngorogiannis

Differential Revision: D19176391

fbshipit-source-id: 707d18b50
master
Jules Villard 5 years ago committed by Facebook Github Bot
parent 322eee5bf7
commit 4b4183b402

@ -130,9 +130,8 @@ BUCK OPTIONS
option. By default, all recursive dependencies are captured. option. By default, all recursive dependencies are captured.
--buck-java --buck-java
Activates: Make the master Infer process merge capture artefacts Activates: Buck integration for Java targets. (Conversely:
generated by the genrule integration, and report after analysis. --no-buck-java)
(Conversely: --no-buck-java)
--buck-merge-all-deps --buck-merge-all-deps
Activates: Find and merge all infer dependencies produced by buck. Activates: Find and merge all infer dependencies produced by buck.

@ -153,9 +153,8 @@ OPTIONS
See also infer-capture(1). See also infer-capture(1).
--buck-java --buck-java
Activates: Make the master Infer process merge capture artefacts Activates: Buck integration for Java targets. (Conversely:
generated by the genrule integration, and report after analysis. --no-buck-java) See also infer-capture(1).
(Conversely: --no-buck-java) See also infer-capture(1).
--buck-merge-all-deps --buck-merge-all-deps
Activates: Find and merge all infer dependencies produced by buck. Activates: Find and merge all infer dependencies produced by buck.
@ -1211,11 +1210,6 @@ INTERNAL OPTIONS
--buck-compilation-database-reset --buck-compilation-database-reset
Cancel the effect of --buck-compilation-database. Cancel the effect of --buck-compilation-database.
--buck-java-deprecated
Activates: [DO NOT USE] old Buck Java integration. Used to be the
default. Going away imminently (Conversely:
--no-buck-java-deprecated)
--buck-out-reset --buck-out-reset
Cancel the effect of --buck-out. Cancel the effect of --buck-out.

@ -153,9 +153,8 @@ OPTIONS
See also infer-capture(1). See also infer-capture(1).
--buck-java --buck-java
Activates: Make the master Infer process merge capture artefacts Activates: Buck integration for Java targets. (Conversely:
generated by the genrule integration, and report after analysis. --no-buck-java) See also infer-capture(1).
(Conversely: --no-buck-java) See also infer-capture(1).
--buck-merge-all-deps --buck-merge-all-deps
Activates: Find and merge all infer dependencies produced by buck. Activates: Find and merge all infer dependencies produced by buck.

@ -894,22 +894,27 @@ and buck_merge_all_deps =
and buck_mode = and buck_mode =
let buck_mode = ref `None in let buck_mode = ref `None in
let set_mode mode b = let set_mode mode b =
if b then buck_mode := mode if b then buck_mode := mode else buck_mode := `None ;
else (* TODO: change to [`None] when we kill [`JavaDeprecated] *) buck_mode := `JavaDeprecated ;
b b
in in
CLOpt.mk_bool ~deprecated:["-flavors"; "-use-flavors"] ~long:"buck-clang" CLOpt.mk_bool ~deprecated:["-flavors"; "-use-flavors"] ~long:"buck-clang"
~deprecated_no:["-no-flavors"]
~in_help:InferCommand.[(Capture, manual_buck)] ~in_help:InferCommand.[(Capture, manual_buck)]
~f:(set_mode `ClangFlavors) ~f:(set_mode `ClangFlavors)
"Buck integration for clang-based targets (C/C++/Objective-C/Objective-C++)." "Buck integration for clang-based targets (C/C++/Objective-C/Objective-C++)."
|> ignore ; |> ignore ;
CLOpt.mk_bool ~long:"buck-java" ~deprecated:["-genrule-master-mode"] CLOpt.mk_bool ~long:"buck-java"
~deprecated_no:["-no-genrule-master-mode"] ~deprecated:
[ "-genrule-master-mode"
; "-no-genrule-master-mode"
(* --no-genrule-master-mode was used in the past to enable a now-defunct Java integration,
so both --genrule-master-mode and --no-genrule-master-mode enable the Java
integration... sorry about that. *)
; "-no-flavors"
(* --no-flavors was used in the past to enable the Java integration in some cases, let's
keep it that way for compatibility for now *) ]
~in_help:InferCommand.[(Capture, manual_buck)] ~in_help:InferCommand.[(Capture, manual_buck)]
~f:(set_mode `Java) ~f:(set_mode `Java)
"Make the master Infer process merge capture artefacts generated by the genrule integration, \ "Buck integration for Java targets."
and report after analysis."
|> ignore ; |> ignore ;
CLOpt.mk_symbol_opt ~long:"buck-compilation-database" ~deprecated:["-use-compilation-database"] CLOpt.mk_symbol_opt ~long:"buck-compilation-database" ~deprecated:["-use-compilation-database"]
~in_help:InferCommand.[(Capture, manual_buck)] ~in_help:InferCommand.[(Capture, manual_buck)]
@ -920,11 +925,6 @@ and buck_mode =
clang targets, as per Buck's $(i,#compilation-database) flavor." clang targets, as per Buck's $(i,#compilation-database) flavor."
~symbols:[("no-deps", `NoDeps); ("deps", `DepsTmp)] ~symbols:[("no-deps", `NoDeps); ("deps", `DepsTmp)]
|> ignore ; |> ignore ;
(* TOOD: kill this *)
CLOpt.mk_bool ~long:"buck-java-deprecated"
~f:(set_mode `JavaDeprecated)
"[DO NOT USE] old Buck Java integration. Used to be the default. Going away imminently"
|> ignore ;
buck_mode buck_mode
@ -2792,8 +2792,6 @@ and buck_mode : BuckMode.t option =
Some (ClangCompilationDB DepsAllDepths) Some (ClangCompilationDB DepsAllDepths)
| `ClangCompilationDB `DepsTmp, Some depth -> | `ClangCompilationDB `DepsTmp, Some depth ->
Some (ClangCompilationDB (DepsUpToDepth depth)) Some (ClangCompilationDB (DepsUpToDepth depth))
| `JavaDeprecated, _ ->
None
and buck_out = !buck_out and buck_out = !buck_out

@ -482,6 +482,13 @@ let assert_supported_mode required_analyzer requested_mode_string =
requested_mode_string analyzer_string analyzer_string requested_mode_string analyzer_string analyzer_string
let error_no_buck_mode_specified () =
L.die UserError
"`buck` command detected on the command line but no Buck integration has been selected. Please \
specify `--buck-clang`, `--buck-java`, or `--buck-compilation-database`. See `infer capture \
--help` for more information."
let assert_supported_build_system build_system = let assert_supported_build_system build_system =
match (build_system : Config.build_system) with match (build_system : Config.build_system) with
| BAnt | BGradle | BJava | BJavac | BMvn -> | BAnt | BGradle | BJava | BJavac | BMvn ->
@ -494,7 +501,7 @@ let assert_supported_build_system build_system =
let analyzer, build_string = let analyzer, build_string =
match Config.buck_mode with match Config.buck_mode with
| None -> | None ->
(`Java, "buck default java integration") error_no_buck_mode_specified ()
| Some ClangFlavors -> | Some ClangFlavors ->
(`Clang, "buck with flavors") (`Clang, "buck with flavors")
| Some (ClangCompilationDB _) -> | Some (ClangCompilationDB _) ->
@ -522,6 +529,8 @@ let mode_of_build_command build_cmd (buck_mode : BuckMode.t option) =
in in
assert_supported_build_system build_system ; assert_supported_build_system build_system ;
match ((build_system : Config.build_system), buck_mode) with match ((build_system : Config.build_system), buck_mode) with
| BBuck, None ->
error_no_buck_mode_specified ()
| BBuck, Some (ClangCompilationDB deps) -> | BBuck, Some (ClangCompilationDB deps) ->
BuckCompilationDB (deps, prog, List.append args (List.rev Config.buck_build_args)) BuckCompilationDB (deps, prog, List.append args (List.rev Config.buck_build_args))
| BBuck, Some ClangFlavors when Config.linters -> | BBuck, Some ClangFlavors when Config.linters ->
@ -543,7 +552,7 @@ let mode_of_build_command build_cmd (buck_mode : BuckMode.t option) =
Maven (prog, args) Maven (prog, args)
| BXcode, _ when Config.xcpretty -> | BXcode, _ when Config.xcpretty ->
XcodeXcpretty (prog, args) XcodeXcpretty (prog, args)
| (BBuck as build_system), (None | Some ClangFlavors) | (BBuck as build_system), Some ClangFlavors
| ((BAnt | BGradle | BNdk | BXcode) as build_system), _ -> | ((BAnt | BGradle | BNdk | BXcode) as build_system), _ ->
PythonCapture (build_system, build_cmd) ) PythonCapture (build_system, build_cmd) )

Loading…
Cancel
Save