[merge] only try to read/create multilink files when --merge is specified

Summary:
Thanks to the logging introduced in D5293334 (or because of, depending on your liking of spam), I noticed that there lots of errors being logged of the form

  Couldn't read multilink file '/home/jul/infer/infer/tests/codetoanalyze/cpp/errors/infer-out/attributes/d0/multilink.txt': /home/jul/infer/infer/tests/codetoanalyze/cpp/errors/infer-out/attributes/d0/multilink.txt: No such file or directory

I don't think it makes sense to care about multilink files except when `--merge` is specified.

Also introduced a .mli and self-documented a function.

Reviewed By: akotulski

Differential Revision: D5310129

fbshipit-source-id: c3a6276
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 11ae193356
commit cd83a24381

@ -132,7 +132,7 @@ let main makefile => {
BuiltinDefn.init (); BuiltinDefn.init ();
RegisterCheckers.register (); RegisterCheckers.register ();
switch Config.modified_targets { switch Config.modified_targets {
| Some file => MergeCapture.modified_file file | Some file => MergeCapture.record_modified_targets_from_file file
| None => () | None => ()
}; };
switch Config.cluster_cmdline { switch Config.cluster_cmdline {

@ -15,8 +15,6 @@ module F = Format
(** Module to merge the results of capture for different buck targets. *) (** Module to merge the results of capture for different buck targets. *)
let use_multilinks = true
(** Flag to control whether the timestamp of symbolic links (** Flag to control whether the timestamp of symbolic links
is used to determine whether a captured directory needs to be merged. *) is used to determine whether a captured directory needs to be merged. *)
let check_timestamp_of_symlinks = true let check_timestamp_of_symlinks = true
@ -27,7 +25,7 @@ let infer_deps () = Filename.concat Config.results_dir Config.buck_infer_deps_fi
let modified_targets = ref String.Set.empty let modified_targets = ref String.Set.empty
let modified_file file = let record_modified_targets_from_file file =
match Utils.read_file file with match Utils.read_file file with
| Ok targets -> | Ok targets ->
modified_targets := List.fold ~f:String.Set.add ~init:String.Set.empty targets modified_targets := List.fold ~f:String.Set.add ~init:String.Set.empty targets
@ -118,7 +116,7 @@ let rec slink ~stats ~skiplevels src dst =
items items
end end
else if skiplevels > 0 then () else if skiplevels > 0 then ()
else if use_multilinks && Filename.check_suffix dst ".attr" else if Config.merge && Filename.check_suffix dst ".attr"
then add_multilink_attr ~stats src dst then add_multilink_attr ~stats src dst
else create_link ~stats src dst else create_link ~stats src dst

@ -0,0 +1,14 @@
(*
* Copyright (c) 2017 - 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 record_modified_targets_from_file : string -> unit
val merge_captured_targets : unit -> unit
Loading…
Cancel
Save