From 76fa3ac8779eb25a2b8e56412fe404818040e7d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Szab=C3=B3?= Date: Sat, 28 Dec 2024 14:48:58 +0100 Subject: [PATCH] Update OCaml stubs The OSS OCaml stubs under src/stubs have become out of sync with the code referencing them. Update the stubs to match. --- hphp/hack/src/client/dune | 1 + hphp/hack/src/stubs/declarationsRewriter.ml | 1 + hphp/hack/src/stubs/dune | 28 ++++++++------- hphp/hack/src/stubs/hh_distc_ffi.ml | 23 +++++++++++++ hphp/hack/src/stubs/linttool.ml | 1 + .../hack/src/stubs/logging/hackEventLogger.ml | 8 ++++- hphp/hack/src/stubs/remote_old_decls_ffi.ml | 10 ++++++ hphp/hack/src/stubs/sandcastle.ml | 1 + hphp/hack/src/stubs/sandcastle/dune | 34 +++++++++++++++++++ hphp/hack/src/stubs/saved_state_loader.ml | 22 +++++++----- hphp/hack/src/stubs/state_loader_futures.ml | 7 +--- hphp/hack/src/stubs/state_loader_lwt.ml | 32 ++++++++--------- hphp/hack/src/watchman/dune | 2 +- 13 files changed, 124 insertions(+), 46 deletions(-) create mode 100644 hphp/hack/src/stubs/declarationsRewriter.ml create mode 100644 hphp/hack/src/stubs/hh_distc_ffi.ml create mode 100644 hphp/hack/src/stubs/linttool.ml create mode 100644 hphp/hack/src/stubs/remote_old_decls_ffi.ml create mode 100644 hphp/hack/src/stubs/sandcastle.ml create mode 100644 hphp/hack/src/stubs/sandcastle/dune diff --git a/hphp/hack/src/client/dune b/hphp/hack/src/client/dune index da04b54135cf4..76a7959d5782f 100644 --- a/hphp/hack/src/client/dune +++ b/hphp/hack/src/client/dune @@ -28,6 +28,7 @@ pos rage redeclarations + sandcastle server server_command_types server_monitor diff --git a/hphp/hack/src/stubs/declarationsRewriter.ml b/hphp/hack/src/stubs/declarationsRewriter.ml new file mode 100644 index 0000000000000..526c4ce5902a5 --- /dev/null +++ b/hphp/hack/src/stubs/declarationsRewriter.ml @@ -0,0 +1 @@ +let start _ = () diff --git a/hphp/hack/src/stubs/dune b/hphp/hack/src/stubs/dune index d1f794aacfb64..776224186f8cf 100644 --- a/hphp/hack/src/stubs/dune +++ b/hphp/hack/src/stubs/dune @@ -65,16 +65,11 @@ (modules saved_state_loader state_loader_futures state_loader_lwt) (libraries hg + server_env typechecker_options) (preprocess (pps lwt_ppx ppx_deriving.std))) - ; this stub file is used by both buck2 and dune -(rule - (target remote_old_decls_ffi.ml) - (action - (copy# ../facebook/remote_old_decls/stubs/remote_old_decls_ffi.ml remote_old_decls_ffi.ml))) - (library (name remote_old_decls_ffi) (wrapped false) @@ -84,12 +79,6 @@ (preprocess (pps lwt_ppx ppx_deriving.std))) -; this stub file is used by both buck2 and dune -(rule - (target hh_distc_ffi.ml) - (action - (copy# ../facebook/hh_distc/check_ffi/stubs/hh_distc_ffi.ml hh_distc_ffi.ml))) - (library (name hh_distc_ffi) (wrapped false) @@ -169,6 +158,21 @@ (preprocess (pps lwt_ppx ppx_deriving.std))) +(library + (name redeclarations) + (wrapped false) + (modules declarationsRewriter)) + +(library + (name linttool) + (wrapped false) + (modules linttool)) + + (library + (name sandcastle_stubs) + (wrapped false) + (modules sandcastle)) + (library (name startup_initializer_stubs) (wrapped false) diff --git a/hphp/hack/src/stubs/hh_distc_ffi.ml b/hphp/hack/src/stubs/hh_distc_ffi.ml new file mode 100644 index 0000000000000..37ff10aa45125 --- /dev/null +++ b/hphp/hack/src/stubs/hh_distc_ffi.ml @@ -0,0 +1,23 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the "hack" directory of this source tree. + * + *) + +type handle + +let spawn ~root:_ ~ss_dir:_ ~hhdg_path:_ _ = failwith "start not implemented" + +let join _ = failwith "join_handle not implemented" + +let cancel _ = failwith "cancel not implemented" + +let is_finished _ = failwith "is_finished not implemented" + +let get_fd _ = failwith "get_fd not implemented" + +let get_re_session_id _ = failwith "get_re_session_id not implemented" + +let recv _ = failwith "recv not implemented" diff --git a/hphp/hack/src/stubs/linttool.ml b/hphp/hack/src/stubs/linttool.ml new file mode 100644 index 0000000000000..9def038cf6178 --- /dev/null +++ b/hphp/hack/src/stubs/linttool.ml @@ -0,0 +1 @@ +let run _ ~severity:_ = () diff --git a/hphp/hack/src/stubs/logging/hackEventLogger.ml b/hphp/hack/src/stubs/logging/hackEventLogger.ml index 5974c56d80b88..579fe9b12a357 100644 --- a/hphp/hack/src/stubs/logging/hackEventLogger.ml +++ b/hphp/hack/src/stubs/logging/hackEventLogger.ml @@ -27,6 +27,8 @@ let set_changed_mergebase _ = () let set_hhconfig_version _ = () +let set_mergebase_globalrev _ = () + let set_rollout_group _ = () let set_rollout_flags _ = () @@ -105,7 +107,7 @@ let type_check_dirty ~start_t:_ ~dirty_count:_ ~recheck_count:_ = () let lock_stolen _ = () -let client_init ~init_id:_ ~from:_ ~custom_columns:_ _ = () +let client_init ~init_id:_ ~from:_ ~is_interactive:_ ~custom_columns:_ _ = () let serverless_ide_init ~init_id:_ = () @@ -571,3 +573,7 @@ module Fanouts = struct let log ~changes_cardinal:_ ~fanout_cardinal:_ ~max_class_fanout_cardinal:_ = () end + +module TypingErrors = struct + let log_errors ~type_check_end_id:_ ~data:_ = () +end diff --git a/hphp/hack/src/stubs/remote_old_decls_ffi.ml b/hphp/hack/src/stubs/remote_old_decls_ffi.ml new file mode 100644 index 0000000000000..d45c6cc989573 --- /dev/null +++ b/hphp/hack/src/stubs/remote_old_decls_ffi.ml @@ -0,0 +1,10 @@ +(* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the "hack" directory of this source tree. + * + *) + +let get_decls_via_file_hashes _ _ = + failwith "get_decls_via_file_hashes not implemented" diff --git a/hphp/hack/src/stubs/sandcastle.ml b/hphp/hack/src/stubs/sandcastle.ml new file mode 100644 index 0000000000000..63dbb87debc9a --- /dev/null +++ b/hphp/hack/src/stubs/sandcastle.ml @@ -0,0 +1 @@ +let is_sandcastle () : bool = false diff --git a/hphp/hack/src/stubs/sandcastle/dune b/hphp/hack/src/stubs/sandcastle/dune new file mode 100644 index 0000000000000..2db66e092fe62 --- /dev/null +++ b/hphp/hack/src/stubs/sandcastle/dune @@ -0,0 +1,34 @@ +(* -*- tuareg -*- *) + +let library_entry name suffix = + Printf.sprintf +"(library + (name %s) + (wrapped false) + (modules) + (libraries %s_%s))" name name suffix + +let fb_entry name = + library_entry name "fb" + +let stubs_entry name = + library_entry name "stubs" + +let entry is_fb name = + if is_fb then + fb_entry name + else + stubs_entry name + +let () = + (* test presence of fb subfolder *) + let current_dir = Sys.getcwd () in + (* we are in src/stubs/xxx, locate src/utils/facebook *) + let src_dir = Filename.dirname @@ Filename.dirname current_dir in + let utils_dir = Filename.concat src_dir "utils" in + let fb_utils_dir = Filename.concat utils_dir "facebook" in + (* locate src/utils/facebook/dune *) + let fb_dune = Filename.concat fb_utils_dir "dune" in + let is_fb = Sys.file_exists fb_dune in + let lib_name = entry is_fb "sandcastle" in + Jbuild_plugin.V1.send lib_name diff --git a/hphp/hack/src/stubs/saved_state_loader.ml b/hphp/hack/src/stubs/saved_state_loader.ml index 46cc932b66d3b..bcfd6db7e1ef7 100644 --- a/hphp/hack/src/stubs/saved_state_loader.ml +++ b/hphp/hack/src/stubs/saved_state_loader.ml @@ -35,7 +35,9 @@ module Naming_and_dep_table_info = struct naming_table_path: Path.t; naming_sqlite_table_path: Path.t; dep_table_path: Path.t; + compressed_dep_table_path: Path.t; errors_path: Path.t; + warning_hashes_path: Path.t; } type dirty_files = { @@ -44,11 +46,13 @@ module Naming_and_dep_table_info = struct } type additional_info = { - mergebase_global_rev: Hg.global_rev option; dirty_files_promise: dirty_files Future.t; - saved_state_distance: int option; - saved_state_age: int option; + saved_state_revs_info: ServerEnv.saved_state_revs_info; } + + let additional_info_of_yojson _ : additional_info = failwith "Not implemented" + + let yojson_of_additional_info _ = failwith "Not implemented" end module Naming_table_info = struct @@ -80,13 +84,15 @@ include files other than Hack files, so the caller should filter the given list as necessary. *) type changed_files = Relative_path.t list -type ('main_artifacts, 'additional_info) load_result = { - main_artifacts: 'main_artifacts; - additional_info: 'additional_info; +let changed_files_of_yojson _ = failwith "Not implemented" + +let yojson_of_changed_files _ = failwith "Not implemented" + +type load_result = { + main_artifacts: Naming_and_dep_table_info.main_artifacts; + additional_info: Naming_and_dep_table_info.additional_info; manifold_path: string; changed_files_according_to_watchman: changed_files; - corresponding_rev: Hg.Rev.t; - mergebase_rev: Hg.Rev.t; is_cached: bool; } diff --git a/hphp/hack/src/stubs/state_loader_futures.ml b/hphp/hack/src/stubs/state_loader_futures.ml index 3b8caf1d39382..44d8d24f71192 100644 --- a/hphp/hack/src/stubs/state_loader_futures.ml +++ b/hphp/hack/src/stubs/state_loader_futures.ml @@ -14,12 +14,7 @@ let get_project_metadata ~opts:_ = failwith "Not implemented" -let load - ~ssopt:_ - ~progress_callback:_ - ~watchman_opts:_ - ~ignore_hh_version:_ - ~saved_state_type:_ = +let load ~ssopt:_ ~progress_callback:_ ~watchman_opts:_ ~ignore_hh_version:_ = Future.of_value (Error "Not implemented") let wait_for_finish _ = failwith "Not implemented" diff --git a/hphp/hack/src/stubs/state_loader_lwt.ml b/hphp/hack/src/stubs/state_loader_lwt.ml index 77b1936eb3403..05f9ca6c61138 100644 --- a/hphp/hack/src/stubs/state_loader_lwt.ml +++ b/hphp/hack/src/stubs/state_loader_lwt.ml @@ -6,20 +6,10 @@ * *) -let get_project_metadata - ~progress_callback:_ - ~saved_state_type:_ - ~repo:_ - ~ignore_hh_version:_ - ~opts:_ = +let get_project_metadata ~repo:_ ~ignore_hh_version:_ ~opts:_ = failwith "Not implemented" -let load - ~ssopt:_ - ~progress_callback:_ - ~watchman_opts:_ - ~ignore_hh_version:_ - ~saved_state_type:_ = +let load ~ssopt:_ ~progress_callback:_ ~watchman_opts:_ ~ignore_hh_version:_ = failwith "Not implemented" let load_internal @@ -30,15 +20,21 @@ let load_internal ~saved_state_type:_ = failwith "Not implemented" -let prepare_download_dir ~saved_state_type:_ = failwith "Not implemented" +let prepare_download_dir () = failwith "Not implemented" let get_saved_state_target_path ~download_dir:_ ~manifold_path:_ = failwith "Not implemented" let download_and_unpack_saved_state_from_manifold - ~ssopt:_ - ~progress_callback:_ - ~manifold_path:_ - ~target_path:_ - ~saved_state_type:_ = + ~ssopt:_ ~progress_callback:_ ~manifold_path:_ ~target_path:_ = failwith "Not implemented" + +module FromDisk = struct + type load_result = { + naming_table_path: Path.t; + warning_saved_state_path: Path.t; + files_changed: Saved_state_loader.changed_files; + } + + let load ~project_metadata:_ ~threshold:_ ~root:_ = failwith "Not implemented" +end diff --git a/hphp/hack/src/watchman/dune b/hphp/hack/src/watchman/dune index 3d95cba15dd2e..a73f37d773c35 100644 --- a/hphp/hack/src/watchman/dune +++ b/hphp/hack/src/watchman/dune @@ -20,7 +20,7 @@ (name watchman_utils) (wrapped false) (modules watchman_utils) - (libraries hh_json logging utils_core) + (libraries hg hh_json logging utils_core) (preprocess (pps lwt_ppx ppx_deriving.std)))