[build] fix ./build-infer clang

Summary:
- inferbo introduced a dependency to extlib. When building Java analyzers, this
  is implicitly pulled in by javalib, but it's missing when building only the
  clang analyzers. Add `extlib` to the packages we build against.
- infer.ml and Javac.ml depend on Javalib, but it's easy to push down the code
  that needs it to `jMain.ml` so that we can build without javalib for the
  clang-only case.
- jMain.mli had 2 copies: one in java/ and one in java_stubs/. Make one a symlink to the other.

Reviewed By: jeremydubreil

Differential Revision: D4566581

fbshipit-source-id: 214a4eb
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 8948b08bf2
commit 451adc7949

@ -35,7 +35,7 @@ OCAMLBUILD_OPTIONS = \
-tag-line "<*{clang/clang_ast_*,backend/jsonbug_*,checkers/stacktree_*}>: warn(-27-32-35-39)" \
-tag-line "<*/{,*/}*.{ml,re}{,i}>: package(ppx_compare)" \
-tag thread \
-pkgs atdgen,core,ctypes.foreign,oUnit,str,unix,xmlm,yojson,zip
-pkgs atdgen,core,ctypes.foreign,extlib,oUnit,str,unix,xmlm,yojson,zip
ifeq ($(ENABLE_OCAML_BINANNOT),yes)
OCAMLBUILD_OPTIONS += -cflags -bin-annot

@ -204,7 +204,7 @@ let capture = function
capture_with_compilation_database json_cdb
| BuckGenrule path ->
L.stdout "Capturing for Buck genrule compatibility...@\n";
JMain.main (lazy (JClasspath.load_from_arguments path))
JMain.from_arguments path
| ClangCompilationDB db_files ->
L.stdout "Capturing using compilation database...@\n";
capture_with_compilation_database db_files

@ -82,5 +82,5 @@ let compile compiler build_prog build_args =
let capture compiler ~prog ~args =
let verbose_out_file = compile compiler prog args in
if Config.analyzer <> Config.Compile then
JMain.main (lazy (JClasspath.load_from_verbose_output verbose_out_file)) ;
JMain.from_verbose_out verbose_out_file;
if not (Config.debug_mode || Config.stats_mode) then Unix.unlink verbose_out_file

@ -139,7 +139,6 @@ let do_all_files classpath sources classes =
JClasspath.cleanup program;
L.out_debug "done @."
(* loads the source files and translates them *)
let main load_sources_and_classes =
(match Config.models_mode, Sys.file_exists Config.models_jar = `Yes with
@ -153,8 +152,15 @@ let main load_sources_and_classes =
JClasspath.add_models Config.models_jar
);
JBasics.set_permissive true;
let classpath, sources, classes = Lazy.force load_sources_and_classes in
let classpath, sources, classes = match load_sources_and_classes with
| `FromVerboseOut verbose_out_file ->
JClasspath.load_from_verbose_output verbose_out_file
| `FromArguments path ->
JClasspath.load_from_arguments path in
if String.Map.is_empty sources then
failwith "Failed to load any Java source code"
else
do_all_files classpath sources classes
let from_arguments path = main (`FromArguments path)
let from_verbose_out verbose_out_file = main (`FromVerboseOut verbose_out_file)

@ -10,4 +10,8 @@
open! IStd
val main: JClasspath.t Lazy.t -> unit
(** loads the source files from command line arguments and translates them *)
val from_arguments : string -> unit
(** loads the source files from javac's verbose output translates them *)
val from_verbose_out : string -> unit

@ -7,4 +7,5 @@
* of patent rights can be found in the PATENTS file in the same directory.
*)
let main _ = ()
let from_arguments _ = ()
let from_verbose_out _ = ()

@ -1,13 +0,0 @@
(*
* Copyright (c) 2009 - 2013 Monoidics ltd.
* Copyright (c) 2013 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*)
open! IStd
val main: 'a -> unit

@ -0,0 +1 @@
../java/jMain.mli

@ -31,6 +31,7 @@ depends: [
"conf-autoconf"
"ctypes" {>="0.9.2"}
"ctypes-foreign" {>="0.4.0"}
"extlib-compat"
"javalib" {>="2.3.3"}
"ocamlfind" {build}
"ounit" {="2.0.0"}

Loading…
Cancel
Save