Summary: It seems that we don't need to rely on `make` anymore as the internal process manager is working fine on Buck Java projects. Reviewed By: jvillard Differential Revision: D7903639 fbshipit-source-id: 9b32f05master
							parent
							
								
									afe511b53d
								
							
						
					
					
						commit
						8ce79a0613
					
				| @ -1,50 +0,0 @@ | ||||
| (* | ||||
|  * Copyright (c) 2015 - 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 | ||||
| module F = Format | ||||
| 
 | ||||
| (** Module to process clusters of procedures. *) | ||||
| 
 | ||||
| (** a cluster is a file *) | ||||
| type t = SourceFile.t | ||||
| 
 | ||||
| (** type stored in .cluster file: (n,cl) indicates cl is cluster n *) | ||||
| type serializer_t = int * t | ||||
| 
 | ||||
| (** Serializer for clusters *) | ||||
| let serializer : serializer_t Serialization.serializer = | ||||
|   Serialization.create_serializer Serialization.Key.cluster | ||||
| 
 | ||||
| 
 | ||||
| (** Load a cluster from a file *) | ||||
| let load_from_file (filename: DB.filename) : serializer_t option = | ||||
|   Serialization.read_from_file serializer filename | ||||
| 
 | ||||
| 
 | ||||
| (** Save a cluster into a file *) | ||||
| let store_to_file (filename: DB.filename) (data: serializer_t) = | ||||
|   Serialization.write_to_file serializer filename ~data | ||||
| 
 | ||||
| 
 | ||||
| let cl_name n = "cl" ^ string_of_int n | ||||
| 
 | ||||
| let cl_file n = "x" ^ cl_name n ^ ".cluster" | ||||
| 
 | ||||
| let pp_cluster_name fmt n = Format.pp_print_string fmt (cl_name n) | ||||
| 
 | ||||
| let pp_cluster fmt (nr, cluster) = | ||||
|   let fname = Config.results_dir ^/ Config.multicore_dir_name ^/ cl_file nr in | ||||
|   let pp_cl fmt n = Format.pp_print_string fmt (cl_name n) in | ||||
|   store_to_file (DB.filename_from_string fname) (nr, cluster) ; | ||||
|   F.fprintf fmt "%a: @\n" pp_cl nr ; | ||||
|   F.fprintf fmt "\t%@$(INFERANALYZE) --cluster '%s'@\n" fname ; | ||||
|   (* touch the target of the rule to let `make` know that the job has been done *) | ||||
|   F.fprintf fmt "\t%@touch $%@@\n" ; | ||||
|   F.fprintf fmt "@\n" | ||||
| @ -1,28 +0,0 @@ | ||||
| (* | ||||
|  * Copyright (c) 2016 - 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 | ||||
| module F = Format | ||||
| 
 | ||||
| (** Module to process clusters of procedures. *) | ||||
| 
 | ||||
| (** a cluster is a file *) | ||||
| type t = SourceFile.t | ||||
| 
 | ||||
| (** type stored in .cluster file: (n,cl) indicates cl is cluster n *) | ||||
| type serializer_t = int * t | ||||
| 
 | ||||
| val load_from_file : DB.filename -> serializer_t option | ||||
| (** Load a cluster from a file *) | ||||
| 
 | ||||
| val pp_cluster : F.formatter -> serializer_t -> unit | ||||
| (** Print a cluster *) | ||||
| 
 | ||||
| val pp_cluster_name : F.formatter -> int -> unit | ||||
| (** Print a cluster name *) | ||||
| @ -1,49 +0,0 @@ | ||||
| (* | ||||
|  * Copyright (c) 2015 - 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 | ||||
| module F = Format | ||||
| 
 | ||||
| (** Module to create a makefile with dependencies between clusters *) | ||||
| 
 | ||||
| let pp_prolog fmt clusters = | ||||
|   let escape = Escape.escape_map (fun c -> if Char.equal c '#' then Some "\\#" else None) in | ||||
|   let infer_flag_of_compilation_db = function | ||||
|     | `Escaped f -> | ||||
|         F.sprintf "--compilation-database-escaped '%s'" f | ||||
|     | `Raw f -> | ||||
|         F.sprintf "--compilation-database '%s'" f | ||||
|   in | ||||
|   let compilation_dbs_cmd = | ||||
|     List.map ~f:infer_flag_of_compilation_db !Config.clang_compilation_dbs | ||||
|     |> String.concat ~sep:" " |> escape | ||||
|   in | ||||
|   F.fprintf fmt "INFERANALYZE = '%s' --no-report --results-dir '%s' %s@\n@\n" | ||||
|     (Config.bin_dir ^/ InferCommand.(to_exe_name Analyze)) | ||||
|     (escape Config.results_dir) compilation_dbs_cmd ; | ||||
|   F.pp_print_string fmt "CLUSTERS=" ; | ||||
|   List.iteri ~f:(fun i _ -> F.fprintf fmt "%a " Cluster.pp_cluster_name (i + 1)) clusters ; | ||||
|   F.fprintf fmt "@\n@\ndefault: test@\n@\nall: test@\n@\n" ; | ||||
|   F.fprintf fmt "test: $(CLUSTERS)@\n" ; | ||||
|   if Config.show_progress_bar then F.fprintf fmt "\t%@echo@\n@." | ||||
| 
 | ||||
| 
 | ||||
| let pp_epilog fmt () = F.fprintf fmt "@.clean:@.\trm -f $(CLUSTERS)@." | ||||
| 
 | ||||
| let create_cluster_makefile (clusters: Cluster.t list) (fname: string) = | ||||
|   let outc = Out_channel.create fname in | ||||
|   let fmt = Format.formatter_of_out_channel outc in | ||||
|   let do_cluster cluster_nr cluster = | ||||
|     F.fprintf fmt "#%a@\n" SourceFile.pp cluster ; | ||||
|     Cluster.pp_cluster fmt (cluster_nr + 1, cluster) | ||||
|   in | ||||
|   pp_prolog fmt clusters ; | ||||
|   List.iteri ~f:do_cluster clusters ; | ||||
|   pp_epilog fmt () ; | ||||
|   Out_channel.close outc | ||||
					Loading…
					
					
				
		Reference in new issue