[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.
--buck-java
Activates: Make the master Infer process merge capture artefacts
generated by the genrule integration, and report after analysis.
(Conversely: --no-buck-java)
Activates: Buck integration for Java targets. (Conversely:
--no-buck-java)
--buck-merge-all-deps
Activates: Find and merge all infer dependencies produced by buck.

@ -153,9 +153,8 @@ OPTIONS
See also infer-capture(1).
--buck-java
Activates: Make the master Infer process merge capture artefacts
generated by the genrule integration, and report after analysis.
(Conversely: --no-buck-java) See also infer-capture(1).
Activates: Buck integration for Java targets. (Conversely:
--no-buck-java) See also infer-capture(1).
--buck-merge-all-deps
Activates: Find and merge all infer dependencies produced by buck.
@ -1211,11 +1210,6 @@ INTERNAL OPTIONS
--buck-compilation-database-reset
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
Cancel the effect of --buck-out.

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

@ -894,22 +894,27 @@ and buck_merge_all_deps =
and buck_mode =
let buck_mode = ref `None in
let set_mode mode b =
if b then buck_mode := mode
else (* TODO: change to [`None] when we kill [`JavaDeprecated] *) buck_mode := `JavaDeprecated ;
if b then buck_mode := mode else buck_mode := `None ;
b
in
CLOpt.mk_bool ~deprecated:["-flavors"; "-use-flavors"] ~long:"buck-clang"
~deprecated_no:["-no-flavors"]
~in_help:InferCommand.[(Capture, manual_buck)]
~f:(set_mode `ClangFlavors)
"Buck integration for clang-based targets (C/C++/Objective-C/Objective-C++)."
|> ignore ;
CLOpt.mk_bool ~long:"buck-java" ~deprecated:["-genrule-master-mode"]
~deprecated_no:["-no-genrule-master-mode"]
CLOpt.mk_bool ~long:"buck-java"
~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)]
~f:(set_mode `Java)
"Make the master Infer process merge capture artefacts generated by the genrule integration, \
and report after analysis."
"Buck integration for Java targets."
|> ignore ;
CLOpt.mk_symbol_opt ~long:"buck-compilation-database" ~deprecated:["-use-compilation-database"]
~in_help:InferCommand.[(Capture, manual_buck)]
@ -920,11 +925,6 @@ and buck_mode =
clang targets, as per Buck's $(i,#compilation-database) flavor."
~symbols:[("no-deps", `NoDeps); ("deps", `DepsTmp)]
|> 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
@ -2792,8 +2792,6 @@ and buck_mode : BuckMode.t option =
Some (ClangCompilationDB DepsAllDepths)
| `ClangCompilationDB `DepsTmp, Some depth ->
Some (ClangCompilationDB (DepsUpToDepth depth))
| `JavaDeprecated, _ ->
None
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
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 =
match (build_system : Config.build_system) with
| BAnt | BGradle | BJava | BJavac | BMvn ->
@ -494,7 +501,7 @@ let assert_supported_build_system build_system =
let analyzer, build_string =
match Config.buck_mode with
| None ->
(`Java, "buck default java integration")
error_no_buck_mode_specified ()
| Some ClangFlavors ->
(`Clang, "buck with flavors")
| Some (ClangCompilationDB _) ->
@ -522,6 +529,8 @@ let mode_of_build_command build_cmd (buck_mode : BuckMode.t option) =
in
assert_supported_build_system build_system ;
match ((build_system : Config.build_system), buck_mode) with
| BBuck, None ->
error_no_buck_mode_specified ()
| BBuck, Some (ClangCompilationDB deps) ->
BuckCompilationDB (deps, prog, List.append args (List.rev Config.buck_build_args))
| 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)
| BXcode, _ when Config.xcpretty ->
XcodeXcpretty (prog, args)
| (BBuck as build_system), (None | Some ClangFlavors)
| (BBuck as build_system), Some ClangFlavors
| ((BAnt | BGradle | BNdk | BXcode) as build_system), _ ->
PythonCapture (build_system, build_cmd) )

Loading…
Cancel
Save