Provider_context.add_entry_from_file_contents -> add_entry_from_contents
[hiphop-php.git] / hphp / hack / src / client / clientDownloadSavedState.ml
bloba19b3adf0c19df3bd1e86259511219932f77a2bf
1 (*
2 * Copyright (c) Facebook, Inc. and its affiliates.
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the "hack" directory of this source tree.
7 *)
9 type saved_state_type = Naming_table
11 type env = {
12 root: Path.t;
13 from: string;
14 saved_state_type: saved_state_type;
17 let main (env : env) : Exit_status.t Lwt.t =
18 let%lwt result =
19 State_loader_lwt.load
20 ~repo:env.root
21 ~ignore_hh_version:false
22 ~saved_state_type:Saved_state_loader.Naming_table
24 match result with
25 | Ok (info, _changed_files) ->
26 let json =
27 Hh_json.JSON_Object
29 ( "naming_table_path",
30 info
31 .Saved_state_loader.Naming_table_saved_state_info
32 .naming_table_path
33 |> Path.to_string
34 |> Hh_json.string_ );
37 Hh_json.json_to_multiline_output stdout json;
38 Lwt.return Exit_status.No_error
39 | Error load_error ->
40 let json =
41 Hh_json.JSON_Object
43 ( "error",
44 Hh_json.string_
45 (Saved_state_loader.debug_details_of_error load_error) );
48 Hh_json.json_to_multiline_output stdout json;
49 Lwt.return Exit_status.Failed_to_load_should_abort