[infer][java] remove the code to cache the summaries extracted from the jar files

Reviewed By: jvillard

Differential Revision: D8157700

fbshipit-source-id: a1bfb65
master
Jeremy Dubreil 7 years ago committed by Facebook Github Bot
parent eab7fd1242
commit e7714d52f3

@ -32,8 +32,6 @@ DEFAULT_BUCK_OUT_GEN = os.path.join(DEFAULT_BUCK_OUT, 'gen')
INFER_JSON_REPORT = os.path.join(config.BUCK_INFER_OUT,
config.JSON_REPORT_FILENAME)
USE_INFER_CACHE = False
INFER_SCRIPT = """\
#!/usr/bin/env {python_executable}
import subprocess
@ -58,13 +56,6 @@ def prepare_build(args):
]
temp_files = []
if USE_INFER_CACHE:
# Create a temporary directory as a cache for jar files.
infer_cache_dir = os.path.join(args.infer_out, 'cache')
if not os.path.isdir(infer_cache_dir):
os.mkdir(infer_cache_dir)
infer_options += ['--infer-cache', infer_cache_dir]
temp_files += [infer_cache_dir]
try:
infer_command = [utils.get_cmd_in_bin_dir('infer')] + infer_options

@ -295,8 +295,6 @@ let undo_join = true
let unsafe_unret = "<\"Unsafe_unretained\">"
let use_jar_cache = true
let weak = "<\"Weak\">"
(* Whitelists for C++ library functions *)
@ -1413,11 +1411,6 @@ and ignore_trivial_traces =
"Ignore traces whose length is at most 1"
and infer_cache =
CLOpt.mk_path_opt ~deprecated:["infer_cache"; "-infer_cache"] ~long:"infer-cache" ~meta:"dir"
"Select a directory to contain the infer cache (Buck and Java only)"
and iphoneos_target_sdk_version =
CLOpt.mk_string_opt ~long:"iphoneos-target-sdk-version"
~in_help:InferCommand.[(Capture, manual_clang_linters)]
@ -2622,8 +2615,6 @@ and ignore_trivial_traces = !ignore_trivial_traces
and immutable_cast = !immutable_cast
and infer_cache = !infer_cache
and iphoneos_target_sdk_version = !iphoneos_target_sdk_version
and iphoneos_target_sdk_version_path_regex =
@ -2947,34 +2938,7 @@ let dynamic_dispatch =
let dynamic_dispatch = !dynamic_dispatch
let specs_library =
match infer_cache with
| Some cache_dir when use_jar_cache ->
let add_spec_lib specs_library filename =
let key_dir =
let basename = Filename.basename filename in
let key = basename ^ Utils.string_crc_hex32 filename in
cache_dir ^/ key
in
let extract_specs dest_dir filename =
if Filename.check_suffix filename ".jar" then (
(try Unix.mkdir dest_dir ~perm:0o700 with Unix.Unix_error _ -> ()) ;
let zip_channel = Zip.open_in filename in
let entries = Zip.entries zip_channel in
let extract_entry (entry: Zip.entry) =
let dest_file = dest_dir ^/ Filename.basename entry.filename in
if Filename.check_suffix entry.filename specs_files_suffix then
Zip.copy_entry_to_file zip_channel entry dest_file
in
List.iter ~f:extract_entry entries ;
Zip.close_in zip_channel )
in
extract_specs key_dir filename ; key_dir :: specs_library
in
List.fold ~f:add_spec_lib ~init:[] !specs_library
| _ ->
!specs_library
let specs_library = !specs_library
(** Global variables *)

@ -239,8 +239,6 @@ val undo_join : bool
val unsafe_unret : string
val use_jar_cache : bool
val weak : string
val whitelisted_cpp_methods : string list
@ -416,8 +414,6 @@ val ignore_trivial_traces : bool
val immutable_cast : bool
val infer_cache : string option
val infer_is_clang : bool
val infer_is_javac : bool

@ -12,32 +12,6 @@ open PolyVariantEqual
type zip_library = {zip_filename: string; zip_channel: Zip.in_file Lazy.t}
let get_cache_dir infer_cache zip_filename =
let basename = Filename.basename zip_filename in
let key = basename ^ Utils.string_crc_hex32 zip_filename in
Filename.concat infer_cache key
let load_from_cache serializer zip_path cache_dir zip_library =
let absolute_path = Filename.concat cache_dir zip_path in
let deserialize = Serialization.read_from_file serializer in
let extract to_path =
if Sys.file_exists to_path <> `Yes then (
Unix.mkdir_p (Filename.dirname to_path) ;
let lazy zip_channel = zip_library.zip_channel in
let entry = Zip.find_entry zip_channel zip_path in
Zip.copy_entry_to_file zip_channel entry to_path ) ;
DB.filename_from_string to_path
in
match deserialize (extract absolute_path) with
| Some _ as data ->
data
| None ->
None
| exception Caml.Not_found ->
None
let load_from_zip serializer zip_path zip_library =
let lazy zip_channel = zip_library.zip_channel in
let deserialize = Serialization.read_from_string serializer in
@ -52,12 +26,7 @@ let load_from_zip serializer zip_path zip_library =
let load_data serializer path zip_library =
let zip_path = Filename.concat Config.default_in_zip_results_dir path in
match Config.infer_cache with
| None ->
load_from_zip serializer zip_path zip_library
| Some infer_cache ->
let cache_dir = get_cache_dir infer_cache zip_library.zip_filename in
load_from_cache serializer zip_path cache_dir zip_library
(** list of the zip files to search for specs files *)
@ -66,8 +35,6 @@ let zip_libraries =
lazy
(let mk_zip_lib zip_filename = {zip_filename; zip_channel= lazy (Zip.open_in zip_filename)} in
let zip_libs =
if Config.use_jar_cache && Option.is_some Config.infer_cache then []
else
let load_zip fname =
if Filename.check_suffix fname ".jar" then
(* fname is a zip of specs *)

Loading…
Cancel
Save