Don't start remote type checking if credentials are invalid
[hiphop-php.git] / hphp / hack / src / server / serverLocalConfig.ml
blob058b478e6ee72c6ab7dfd29a9226f54bc0dea482
1 (*
2 * Copyright (c) 2015, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
8 *)
10 open Config_file.Getters
11 open Hh_core
13 module Watchman = struct
14 type t = {
15 (* use_watchman *)
16 enabled: bool;
17 (* in seconds *)
18 debug_logging: bool;
19 init_timeout: int;
20 sockname: string option;
21 subscribe: bool;
22 (* in seconds *)
23 synchronous_timeout: int;
26 let default =
28 debug_logging = false;
29 enabled = false;
30 (* buck and hgwatchman use a 10 second timeout, too *)
31 init_timeout = 10;
32 sockname = None;
33 subscribe = false;
34 synchronous_timeout = 120;
37 let load ~current_version ~default config =
38 let prefix = Some "watchman" in
39 let use_watchman =
40 bool_if_min_version
41 "use_watchman"
42 ~default:default.enabled
43 ~current_version
44 config
46 let enabled =
47 bool_if_min_version
48 "enabled"
49 ~prefix
50 ~default:use_watchman
51 ~current_version
52 config
54 let init_timeout =
55 int_ "init_timeout" ~prefix ~default:default.init_timeout config
57 let sockname = string_opt "sockname" ~prefix config in
58 let subscribe =
59 bool_if_min_version
60 "subscribe_v2"
61 ~prefix
62 ~default:default.subscribe
63 ~current_version
64 config
66 let synchronous_timeout =
67 int_
68 "synchronous_timeout"
69 ~prefix
70 ~default:default.synchronous_timeout
71 config
73 let debug_logging =
74 bool_if_min_version
75 "debug_logging"
76 ~prefix
77 ~default:default.debug_logging
78 ~current_version
79 config
82 debug_logging;
83 enabled;
84 init_timeout;
85 sockname;
86 subscribe;
87 synchronous_timeout;
89 end
91 module RemoteTypeCheck = struct
92 type t = {
93 (* Controls the `defer_class_declaration_threshold` setting on the remote worker *)
94 declaration_threshold: int;
95 (* A list of error phases; if, before type checking, errors in these phases
96 are present, then remote type checking will be disabled *)
97 disabled_on_errors: Errors.phase list;
98 (* Enables remote type check *)
99 enabled: bool;
100 (* Indicates how long to wait between heartbeats (in seconds) *)
101 heartbeat_period: int;
102 load_naming_table_on_full_init: bool;
103 max_batch_size: int;
104 min_batch_size: int;
105 (* Dictates the number of remote type checking workers *)
106 num_workers: int;
107 (* Indicates whether files-to-declare should be fetched by VFS
108 (see `declaration_threshold`) *)
109 prefetch_deferred_files: bool;
110 (* If set, distributes type checking to remote workers if the number of files to
111 type check exceeds the threshold. If not set, then always checks everything locally. *)
112 recheck_threshold: int option;
113 worker_min_log_level: Hh_logger.Level.t;
114 (* Indicates the size of the job below which a virtual file system should
115 be used by the remote worker *)
116 worker_vfs_checkout_threshold: int;
117 (* File system mode used by ArtifactStore *)
118 file_system_mode: ArtifactStore.file_system_mode;
121 let default =
123 enabled = false;
124 declaration_threshold = 50;
125 disabled_on_errors = [];
126 (* Indicates how long to wait between heartbeats (in seconds) *)
127 heartbeat_period = 15;
128 load_naming_table_on_full_init = false;
129 max_batch_size = 25_000;
130 min_batch_size = 5_000;
131 num_workers = 4;
132 prefetch_deferred_files = false;
133 recheck_threshold = None;
134 worker_min_log_level = Hh_logger.Level.Info;
135 worker_vfs_checkout_threshold = 10_000;
136 file_system_mode = ArtifactStore.Distributed;
139 let load ~current_version ~default config =
140 let prefix = Some "remote_type_check" in
141 let declaration_threshold =
142 int_
143 "declaration_threshold"
144 ~prefix
145 ~default:default.declaration_threshold
146 config
149 let file_system_mode =
150 let open ArtifactStore in
151 let file_system_mode =
152 string_
153 "file_system_mode"
154 ~prefix
155 ~default:(string_of_file_system_mode Distributed)
156 config
158 match file_system_mode_of_string file_system_mode with
159 | Some mode -> mode
160 | None -> Distributed
162 let enabled_on_errors =
163 string_list
164 "enabled_on_errors"
165 ~delim:(Str.regexp ",")
166 ~prefix
167 ~default:["typing"]
168 config
169 |> List.fold ~init:[] ~f:(fun acc phase ->
170 match Errors.phase_of_string phase with
171 | Some phase -> phase :: acc
172 | None -> acc)
174 let disabled_on_errors =
175 List.filter
176 [Errors.Typing; Errors.Decl; Errors.Parsing; Errors.Init; Errors.Naming]
177 ~f:(fun phase ->
179 (List.exists enabled_on_errors ~f:(fun enabled_phase ->
180 enabled_phase = phase)))
182 let heartbeat_period =
183 int_ "heartbeat_period" ~prefix ~default:default.heartbeat_period config
185 let num_workers =
186 int_ "num_workers" ~prefix ~default:default.num_workers config
188 let max_batch_size =
189 int_ "max_batch_size" ~prefix ~default:default.max_batch_size config
191 let min_batch_size =
192 int_ "min_batch_size" ~prefix ~default:default.min_batch_size config
194 let prefetch_deferred_files =
195 bool_if_min_version
196 "prefetch_deferred_files"
197 ~prefix
198 ~default:default.prefetch_deferred_files
199 ~current_version
200 config
202 let recheck_threshold = int_opt "recheck_threshold" ~prefix config in
203 let load_naming_table_on_full_init =
204 bool_if_min_version
205 "load_naming_table_on_full_init"
206 ~prefix
207 ~default:default.load_naming_table_on_full_init
208 ~current_version
209 config
211 let enabled =
212 bool_if_min_version
213 "enabled"
214 ~prefix
215 ~default:default.enabled
216 ~current_version
217 config
219 let worker_min_log_level =
220 match
221 Hh_logger.Level.of_enum_string
222 (String.lowercase_ascii
223 (string_
224 ~prefix
225 "worker_min_log_level"
226 ~default:
227 (Hh_logger.Level.to_enum_string default.worker_min_log_level)
228 config))
229 with
230 | Some level -> level
231 | None -> Hh_logger.Level.Debug
233 let worker_vfs_checkout_threshold =
234 int_
235 "worker_vfs_checkout_threshold"
236 ~prefix
237 ~default:default.worker_vfs_checkout_threshold
238 config
241 declaration_threshold;
242 disabled_on_errors;
243 enabled;
244 heartbeat_period;
245 load_naming_table_on_full_init;
246 max_batch_size;
247 min_batch_size;
248 num_workers;
249 prefetch_deferred_files;
250 recheck_threshold;
251 worker_min_log_level;
252 worker_vfs_checkout_threshold;
253 file_system_mode;
257 module RecheckCapture = struct
258 type t = {
259 (* Enables recheck environment capture *)
260 enabled: bool;
261 (* If the error theshold is not met, then the recheck environment that
262 doesn't meet the fanout-related thresholds will not be captured. *)
263 error_threshold: int;
264 (* We will automatically capture the recheck environment if
265 the number of files to recheck exceeds this threshold.
266 The number of rechecked files is always less than or equal to
267 the fanout *)
268 fanout_threshold: int;
269 (* We will automatically capture the recheck environment if
270 the number of rechecked files exceeds this threshold *)
271 rechecked_files_threshold: int;
272 (* If set, determines the rate of sampling of rechecks regardless of
273 their fanout size. The error threshold would still apply.
274 NOTE: valid values fall between 0.0 (0%) and 1.0 (100%).
275 Values less than 0.0 will be interpreted as 0.0; values greater than
276 1.0 will be interpreted as 1.0 *)
277 sample_threshold: float;
280 let default =
282 enabled = false;
283 (* We wouldn't capture small rechecks unless they have at least
284 this many errors. *)
285 error_threshold = 1;
286 (* If capturing is enabled and the recheck fanout (pre-type-check)
287 meets this threshold, then we would snapshot the changed files. *)
288 fanout_threshold = 40_000;
289 (* If the number of files actually rechecked meets this threshold
290 and we already snapshotted the changed files based on fanout
291 size or sampling, we would capture the recheck environment. *)
292 rechecked_files_threshold = 5_000;
293 (* We wouldn't take changed files snapshots of small fanouts
294 unless they are randomly selected with the probability controlled
295 by the sample_threshold setting. By default, we don't snapshot
296 any small fanouts. *)
297 sample_threshold = 0.0;
300 let load ~current_version ~default config =
301 let prefix = Some "recheck_capture" in
302 let enabled =
303 bool_if_min_version
304 "enabled"
305 ~prefix
306 ~default:default.enabled
307 ~current_version
308 config
310 let error_threshold =
311 int_ "error_threshold" ~prefix ~default:default.error_threshold config
313 let fanout_threshold =
314 int_ "fanout_threshold" ~prefix ~default:default.fanout_threshold config
316 let rechecked_files_threshold =
317 int_
318 "rechecked_files_threshold"
319 ~prefix
320 ~default:default.rechecked_files_threshold
321 config
323 let sample_threshold =
324 let sample_threshold =
325 float_
326 "sample_threshold"
327 ~prefix
328 ~default:default.sample_threshold
329 config
331 if sample_threshold > 1.0 then
333 else if sample_threshold < 0.0 then
335 else
336 sample_threshold
339 enabled;
340 error_threshold;
341 fanout_threshold;
342 rechecked_files_threshold;
343 sample_threshold;
347 type t = {
348 min_log_level: Hh_logger.Level.t;
349 (* Indicates whether we attempt to fix the credentials if they're broken *)
350 attempt_fix_credentials: bool;
351 log_categories: string list;
352 (* the list of experiments from the experiments config *)
353 experiments: string list;
354 (* a free-form diagnostic string *)
355 experiments_config_meta: string;
356 use_saved_state: bool;
357 (* should we attempt to load saved-state? (subject to further options) *)
358 require_saved_state: bool;
359 (* if attempting saved-state, should we fail upon failure? *)
360 load_state_script_timeout: int;
361 (** Prefer using Ocaml implementation over load script. *)
362 (* in seconds *)
363 load_state_natively: bool;
364 type_decl_bucket_size: int;
365 extend_fast_bucket_size: int;
366 enable_on_nfs: bool;
367 enable_fuzzy_search: bool;
368 lazy_parse: bool;
369 lazy_init: bool;
370 (* Limit the number of clients that can sit in purgatory waiting
371 * for a server to be started because we don't want this to grow
372 * unbounded. *)
373 max_purgatory_clients: int;
374 search_chunk_size: int;
375 io_priority: int;
376 cpu_priority: int;
377 saved_state_cache_limit: int;
378 can_skip_deptable: bool;
379 shm_dirs: string list;
380 state_loader_timeouts: State_loader_config.timeouts;
381 max_workers: int option;
382 max_bucket_size: int;
383 (* See HhMonitorInformant. *)
384 use_dummy_informant: bool;
385 informant_min_distance_restart: int;
386 informant_use_xdb: bool;
387 use_full_fidelity_parser: bool;
388 interrupt_on_watchman: bool;
389 interrupt_on_client: bool;
390 trace_parsing: bool;
391 prechecked_files: bool;
392 predeclare_ide: bool;
393 predeclare_ide_deps: bool;
394 max_typechecker_worker_memory_mb: int option;
395 hg_aware: bool;
396 hg_aware_parsing_restart_threshold: int;
397 hg_aware_redecl_restart_threshold: int;
398 hg_aware_recheck_restart_threshold: int;
399 (* Flag to disable conservative behavior in incremental-mode typechecks.
401 * By default, when a class has changed and we do not have access to the old
402 * version of its declaration (and thus cannot determine HOW it has changed),
403 * we conservatively redeclare the entire set of files where the class or any
404 * of its members were referenced. Likewise for definitions of functions or
405 * global constants.
407 * This flag disables that behavior--instead, when a class has changed, we
408 * only redeclare files with an Extends dependency on the class, and we do not
409 * redeclare any files when a function or global constant changes.
411 disable_conservative_redecl: bool;
412 ide_parser_cache: bool;
413 ide_tast_cache: bool;
414 (* When enabled, save hot class declarations (for now, specified in a special
415 file in the repository) when generating a saved state. *)
416 store_decls_in_saved_state: bool;
417 (* When enabled, load class declarations stored in the saved state, if any, on
418 server init. *)
419 load_decls_from_saved_state: bool;
420 (* Size of Gc.major_slice to be performed when server is idle. 0 to disable *)
421 idle_gc_slice: int;
422 (* Look up class members lazily from shallow declarations instead of eagerly
423 computing folded declarations representing the entire class type. *)
424 shallow_class_decl: bool;
425 (* If false, only the type check delegate's logic will be used.
426 If the delegate fails to type check, the typing check service as a whole
427 will fail. *)
428 num_local_workers: int option;
429 (* If the number of files to type check is fewer than this value, the files
430 will be type checked sequentially (in the master process). Otherwise,
431 the files will be type checked in parallel (in MultiWorker workers). *)
432 parallel_type_checking_threshold: int;
433 (* If set, defers class declarations after N lazy declarations; if not set,
434 always lazily declares classes not already in cache. *)
435 defer_class_declaration_threshold: int option;
436 (* If set, prevents type checking of files from being deferred more than
437 the number of times greater than or equal to the threshold. If not set,
438 defers class declarations indefinitely. *)
439 max_times_to_defer_type_checking: int option;
440 (* The whether to use the hook that prefetches files on an Eden checkout *)
441 prefetch_deferred_files: bool;
442 (* Settings controlling how and whether we capture the recheck environment *)
443 recheck_capture: RecheckCapture.t;
444 (* The version of the Remote Execution CLI tool to use *)
445 recli_version: string;
446 (* Remote type check settings that can be changed, e.g., by GK *)
447 remote_type_check: RemoteTypeCheck.t;
448 (* If set, uses the key to fetch type checking jobs *)
449 remote_worker_key: string option;
450 (* If set, uses the check ID when logging events in the context of remove init/work *)
451 remote_check_id: string option;
452 (* The version of the package the remote worker is to install *)
453 remote_version_specifier: string option;
454 (* Name of the transport channel used by remote type checking. TODO: move into remote_type_check. *)
455 remote_transport_channel: string option;
456 (* Enables the reverse naming table to fall back to SQLite for queries. *)
457 naming_sqlite_path: string option;
458 enable_naming_table_fallback: bool;
459 (* Selects a search provider for autocomplete and symbol search *)
460 symbolindex_search_provider: string;
461 symbolindex_quiet: bool;
462 symbolindex_file: string option;
463 (* Allows hh_server to invalidate units in hhvm based on local changes *)
464 tico_invalidate_files: bool;
465 (* Use finer grain hh_server dependencies *)
466 tico_invalidate_smart: bool;
467 (* If --profile-log, we'll record telemetry on typechecks that took longer than the threshold. In case of profile_type_check_twice we judge by the second type check. *)
468 profile_type_check_duration_threshold: float;
469 (* The flag "--config profile_type_check_twice=true" causes each file to be typechecked twice in succession. If --profile-log then both times are logged. *)
470 profile_type_check_twice: bool;
471 (* If --profile-log, we can use "--config profile_owner=<str>" to send an arbitrary "owner" along with the telemetry *)
472 profile_owner: string;
473 (* If --profile-log, we can use "--config profile_desc=<str>" to send an arbitrary "desc" along with telemetry *)
474 profile_desc: string;
475 (* Allows the IDE to show the 'find all implementations' button *)
476 go_to_implementation: bool;
477 watchman: Watchman.t;
480 let default =
482 min_log_level = Hh_logger.Level.Info;
483 attempt_fix_credentials = false;
484 log_categories = [];
485 experiments = [];
486 experiments_config_meta = "";
487 use_saved_state = false;
488 require_saved_state = false;
489 load_state_script_timeout = 20;
490 load_state_natively = false;
491 type_decl_bucket_size = 1000;
492 extend_fast_bucket_size = 2000;
493 enable_on_nfs = false;
494 enable_fuzzy_search = true;
495 lazy_parse = false;
496 lazy_init = false;
497 max_purgatory_clients = 400;
498 search_chunk_size = 0;
499 io_priority = 7;
500 cpu_priority = 10;
501 saved_state_cache_limit = 20;
502 can_skip_deptable = true;
503 shm_dirs = [GlobalConfig.shm_dir; GlobalConfig.tmp_dir];
504 max_workers = None;
505 max_bucket_size = Bucket.max_size ();
506 state_loader_timeouts = State_loader_config.default_timeouts;
507 use_dummy_informant = true;
508 informant_min_distance_restart = 100;
509 informant_use_xdb = false;
510 use_full_fidelity_parser = true;
511 interrupt_on_watchman = false;
512 interrupt_on_client = false;
513 trace_parsing = false;
514 prechecked_files = false;
515 predeclare_ide = false;
516 predeclare_ide_deps = false;
517 max_typechecker_worker_memory_mb = None;
518 hg_aware = false;
519 hg_aware_parsing_restart_threshold = 0;
520 hg_aware_redecl_restart_threshold = 0;
521 hg_aware_recheck_restart_threshold = 0;
522 disable_conservative_redecl = false;
523 ide_parser_cache = false;
524 ide_tast_cache = false;
525 store_decls_in_saved_state = false;
526 load_decls_from_saved_state = false;
527 idle_gc_slice = 0;
528 shallow_class_decl = false;
529 num_local_workers = None;
530 parallel_type_checking_threshold = 10;
531 defer_class_declaration_threshold = None;
532 max_times_to_defer_type_checking = None;
533 prefetch_deferred_files = false;
534 recheck_capture = RecheckCapture.default;
535 recli_version = "STABLE";
536 remote_type_check = RemoteTypeCheck.default;
537 remote_worker_key = None;
538 remote_check_id = None;
539 remote_version_specifier = None;
540 remote_transport_channel = None;
541 naming_sqlite_path = None;
542 enable_naming_table_fallback = false;
543 symbolindex_search_provider = "SqliteIndex";
544 symbolindex_quiet = false;
545 symbolindex_file = None;
546 tico_invalidate_files = false;
547 tico_invalidate_smart = false;
548 profile_type_check_duration_threshold = 0.05;
549 profile_type_check_twice = false;
550 profile_owner = "";
551 profile_desc = "";
552 (* seconds *)
553 go_to_implementation = true;
554 watchman = Watchman.default;
557 let path =
558 let dir =
559 try Sys.getenv "HH_LOCALCONF_PATH"
560 with _ -> BuildOptions.system_config_path
562 Filename.concat dir "hh.conf"
564 let state_loader_timeouts_ ~default config =
565 State_loader_config.(
566 let package_fetch_timeout =
567 int_
568 "state_loader_timeout_package_fetch"
569 ~default:default.package_fetch_timeout
570 config
572 let find_exact_state_timeout =
573 int_
574 "state_loader_timeout_find_exact_state"
575 ~default:default.find_exact_state_timeout
576 config
578 let find_nearest_state_timeout =
579 int_
580 "state_loader_timeout_find_nearest_state"
581 ~default:default.find_nearest_state_timeout
582 config
584 let current_hg_rev_timeout =
585 int_
586 "state_loader_timeout_current_hg_rev"
587 ~default:default.current_hg_rev_timeout
588 config
590 let current_base_rev_timeout =
591 int_
592 "state_loader_timeout_current_base_rev_timeout"
593 ~default:default.current_base_rev_timeout
594 config
597 State_loader_config.package_fetch_timeout;
598 find_exact_state_timeout;
599 find_nearest_state_timeout;
600 current_hg_rev_timeout;
601 current_base_rev_timeout;
604 let apply_overrides ~silent ~current_version ~config ~overrides =
605 (* First of all, apply the CLI overrides so the settings below could be specified
606 altered via the CLI, even though the CLI overrides take precedence
607 over the experiments overrides *)
608 let config = Config_file.apply_overrides ~silent ~config ~overrides in
609 let prefix = Some "experiments_config" in
610 let enabled =
611 bool_if_min_version "enabled" ~prefix ~default:false ~current_version config
613 if enabled then (
614 Disk.mkdir_p GlobalConfig.tmp_dir;
615 let dir = string_ "path" ~prefix ~default:GlobalConfig.tmp_dir config in
616 let owner = Sys_utils.get_primary_owner () in
617 let file = Filename.concat dir (Printf.sprintf "hh.%s.experiments" owner) in
618 let update =
619 bool_if_min_version
620 "update"
621 ~prefix
622 ~default:false
623 ~current_version
624 config
626 let ttl = float_of_int (int_ "ttl_seconds" ~prefix ~default:86400 config) in
627 let source = string_opt "source" ~prefix config in
628 let meta =
629 if update then
630 match Experiments_config_file.update ~file ~source ~ttl with
631 | Ok meta -> meta
632 | Error message -> message
633 else
634 "Updating experimental config not enabled"
636 if Disk.file_exists file then
637 (* Apply the experiments overrides *)
638 let experiment_overrides = Config_file.parse_local_config ~silent file in
639 let config =
640 Config_file.apply_overrides
641 ~silent
642 ~config
643 ~overrides:experiment_overrides
645 (* Finally, reapply the CLI overrides, since they should take
646 precedence over the experiments overrides *)
647 (meta, Config_file.apply_overrides ~silent ~config ~overrides)
648 else
649 ("Experimental config not found on disk", config)
650 ) else
651 ("Experimental config not enabled", config)
653 let load_ fn ~silent ~current_version overrides =
654 let config = Config_file.parse_local_config ~silent fn in
655 let (experiments_config_meta, config) =
656 apply_overrides ~silent ~current_version ~config ~overrides
658 let experiments =
659 string_list
660 "experiments"
661 ~delim:(Str.regexp ",")
662 ~default:default.experiments
663 config
666 let log_categories =
667 string_list
668 "log_categories"
669 ~delim:(Str.regexp ",")
670 ~default:default.log_categories
671 config
673 let min_log_level =
674 match
675 Hh_logger.Level.of_enum_string
676 (String.lowercase_ascii
677 (string_
678 "min_log_level"
679 ~default:(Hh_logger.Level.to_enum_string default.min_log_level)
680 config))
681 with
682 | Some level -> level
683 | None -> Hh_logger.Level.Debug
686 let use_saved_state =
687 bool_if_version "use_mini_state" ~default:default.use_saved_state config
689 let require_saved_state =
690 bool_if_version
691 "require_saved_state"
692 ~default:default.require_saved_state
693 config
695 let attempt_fix_credentials =
696 bool_if_min_version
697 "attempt_fix_credentials"
698 ~default:default.attempt_fix_credentials
699 ~current_version
700 config
702 let enable_on_nfs =
703 bool_if_version "enable_on_nfs" ~default:default.enable_on_nfs config
705 let enable_fuzzy_search =
706 bool_if_version
707 "enable_fuzzy_search"
708 ~default:default.enable_fuzzy_search
709 config
711 let lazy_parse =
712 bool_if_version "lazy_parse" ~default:default.lazy_parse config
714 let lazy_init =
715 bool_if_version "lazy_init2" ~default:default.lazy_init config
717 let max_purgatory_clients =
718 int_ "max_purgatory_clients" ~default:default.max_purgatory_clients config
720 let search_chunk_size =
721 int_ "search_chunk_size" ~default:default.search_chunk_size config
723 let load_state_script_timeout =
724 int_
725 "load_mini_script_timeout"
726 ~default:default.load_state_script_timeout
727 config
729 let load_state_natively =
730 bool_if_version
731 "load_state_natively_v4"
732 ~default:default.load_state_natively
733 config
735 let state_loader_timeouts =
736 state_loader_timeouts_ ~default:State_loader_config.default_timeouts config
738 let use_dummy_informant =
739 bool_if_version
740 "use_dummy_informant"
741 ~default:default.use_dummy_informant
742 config
744 let informant_min_distance_restart =
745 int_
746 "informant_min_distance_restart"
747 ~default:default.informant_min_distance_restart
748 config
750 let informant_use_xdb =
751 bool_if_version
752 "informant_use_xdb_v5"
753 ~default:default.informant_use_xdb
754 config
756 let type_decl_bucket_size =
757 int_ "type_decl_bucket_size" ~default:default.type_decl_bucket_size config
759 let extend_fast_bucket_size =
760 int_
761 "extend_fast_bucket_size"
762 ~default:default.extend_fast_bucket_size
763 config
765 let io_priority = int_ "io_priority" ~default:default.io_priority config in
766 let cpu_priority = int_ "cpu_priority" ~default:default.cpu_priority config in
767 let saved_state_cache_limit =
768 int_
769 "saved_state_cache_limit"
770 ~default:default.saved_state_cache_limit
771 config
773 let can_skip_deptable =
774 bool_if_version
775 "can_skip_deptable"
776 ~default:default.can_skip_deptable
777 config
779 let shm_dirs =
780 string_list
781 ~delim:(Str.regexp ",")
782 "shm_dirs"
783 ~default:default.shm_dirs
784 config
785 |> List.map ~f:(fun dir -> Path.(to_string @@ make dir))
787 let max_workers = int_opt "max_workers" config in
788 let max_bucket_size =
789 int_ "max_bucket_size" ~default:default.max_bucket_size config
791 let interrupt_on_watchman =
792 bool_if_version
793 "interrupt_on_watchman"
794 ~default:default.interrupt_on_watchman
795 config
797 let interrupt_on_client =
798 bool_if_version
799 "interrupt_on_client"
800 ~default:default.interrupt_on_client
801 config
803 let use_full_fidelity_parser =
804 bool_if_version
805 "use_full_fidelity_parser"
806 ~default:default.use_full_fidelity_parser
807 config
809 let trace_parsing =
810 bool_if_version "trace_parsing" ~default:default.trace_parsing config
812 let prechecked_files =
813 bool_if_version "prechecked_files" ~default:default.prechecked_files config
815 let predeclare_ide =
816 bool_if_version "predeclare_ide" ~default:default.predeclare_ide config
818 let predeclare_ide_deps =
819 bool_if_version
820 "predeclare_ide_deps"
821 ~default:default.predeclare_ide_deps
822 config
824 let max_typechecker_worker_memory_mb =
825 int_opt "max_typechecker_worker_memory_mb" config
827 let hg_aware = bool_if_version "hg_aware" ~default:default.hg_aware config in
828 let disable_conservative_redecl =
829 bool_if_version
830 "disable_conservative_redecl"
831 ~default:default.disable_conservative_redecl
832 config
834 let store_decls_in_saved_state =
835 bool_if_version
836 "store_decls_in_saved_state"
837 ~default:default.store_decls_in_saved_state
838 config
840 let load_decls_from_saved_state =
841 bool_if_version
842 "load_decls_from_saved_state"
843 ~default:default.load_decls_from_saved_state
844 config
846 let hg_aware_parsing_restart_threshold =
847 int_
848 "hg_aware_parsing_restart_threshold"
849 ~default:default.hg_aware_parsing_restart_threshold
850 config
852 let hg_aware_redecl_restart_threshold =
853 int_
854 "hg_aware_redecl_restart_threshold"
855 ~default:default.hg_aware_redecl_restart_threshold
856 config
858 let hg_aware_recheck_restart_threshold =
859 int_
860 "hg_aware_recheck_restart_threshold"
861 ~default:default.hg_aware_recheck_restart_threshold
862 config
864 let ide_parser_cache =
865 bool_if_version "ide_parser_cache" ~default:default.ide_parser_cache config
867 let ide_tast_cache =
868 bool_if_version "ide_tast_cache" ~default:default.ide_tast_cache config
870 let idle_gc_slice =
871 int_ "idle_gc_slice" ~default:default.idle_gc_slice config
873 let shallow_class_decl =
874 bool_if_version
875 "shallow_class_decl"
876 ~default:default.shallow_class_decl
877 config
879 let parallel_type_checking_threshold =
880 int_
881 "parallel_type_checking_threshold"
882 ~default:default.parallel_type_checking_threshold
883 config
885 let num_local_workers = int_opt "num_local_workers" config in
886 let defer_class_declaration_threshold =
887 int_opt "defer_class_declaration_threshold" config
889 let max_times_to_defer_type_checking =
890 int_opt "max_times_to_defer_type_checking" config
892 let prefetch_deferred_files =
893 bool_if_min_version
894 "prefetch_deferred_files"
895 ~default:false
896 ~current_version
897 config
899 let recheck_capture =
900 RecheckCapture.load ~current_version ~default:default.recheck_capture config
902 let remote_type_check =
903 RemoteTypeCheck.load
904 ~current_version
905 ~default:default.remote_type_check
906 config
908 let watchman =
909 Watchman.load ~current_version ~default:default.watchman config
911 let recli_version =
912 string_ "recli_version" ~default:default.recli_version config
914 let remote_worker_key = string_opt "remote_worker_key" config in
915 let remote_check_id = string_opt "remote_check_id" config in
916 let remote_version_specifier = string_opt "remote_version_specifier" config in
917 let remote_transport_channel = string_opt "remote_transport_channel" config in
918 let enable_naming_table_fallback =
919 bool_if_min_version
920 "enable_naming_table_fallback"
921 ~default:default.enable_naming_table_fallback
922 ~current_version
923 config
925 let naming_sqlite_path =
926 if enable_naming_table_fallback then
927 string_opt "naming_sqlite_path" config
928 else
929 None
931 let symbolindex_search_provider =
932 string_
933 "symbolindex_search_provider"
934 ~default:default.symbolindex_search_provider
935 config
937 let symbolindex_quiet =
938 bool_if_version
939 "symbolindex_quiet"
940 ~default:default.symbolindex_quiet
941 config
943 let symbolindex_file = string_opt "symbolindex_file" config in
944 let tico_invalidate_files =
945 bool_if_version
946 "tico_invalidate_files"
947 ~default:default.tico_invalidate_files
948 config
950 let tico_invalidate_smart =
951 bool_if_version
952 "tico_invalidate_smart"
953 ~default:default.tico_invalidate_smart
954 config
956 let profile_type_check_duration_threshold =
957 float_
958 "profile_type_check_duration_threshold"
959 ~default:default.profile_type_check_duration_threshold
960 config
962 let profile_type_check_twice =
963 bool_if_version
964 "profile_type_check_twice"
965 ~default:default.profile_type_check_twice
966 config
968 let profile_owner =
969 string_ "profile_owner" ~default:default.profile_owner config
971 let profile_desc =
972 string_ "profile_desc" ~default:default.profile_desc config
974 let go_to_implementation =
975 bool_if_version
976 "go_to_implementation"
977 ~default:default.go_to_implementation
978 config
981 min_log_level;
982 attempt_fix_credentials;
983 log_categories;
984 experiments;
985 experiments_config_meta;
986 use_saved_state;
987 require_saved_state;
988 load_state_script_timeout;
989 load_state_natively;
990 max_purgatory_clients;
991 type_decl_bucket_size;
992 extend_fast_bucket_size;
993 enable_on_nfs;
994 enable_fuzzy_search;
995 lazy_parse;
996 lazy_init;
997 search_chunk_size;
998 io_priority;
999 cpu_priority;
1000 saved_state_cache_limit;
1001 can_skip_deptable;
1002 shm_dirs;
1003 max_workers;
1004 max_bucket_size;
1005 state_loader_timeouts;
1006 use_dummy_informant;
1007 informant_min_distance_restart;
1008 informant_use_xdb;
1009 use_full_fidelity_parser;
1010 interrupt_on_watchman;
1011 interrupt_on_client;
1012 trace_parsing;
1013 prechecked_files;
1014 predeclare_ide;
1015 max_typechecker_worker_memory_mb;
1016 hg_aware;
1017 hg_aware_parsing_restart_threshold;
1018 hg_aware_redecl_restart_threshold;
1019 hg_aware_recheck_restart_threshold;
1020 disable_conservative_redecl;
1021 predeclare_ide_deps;
1022 ide_parser_cache;
1023 ide_tast_cache;
1024 store_decls_in_saved_state;
1025 load_decls_from_saved_state;
1026 idle_gc_slice;
1027 shallow_class_decl;
1028 num_local_workers;
1029 parallel_type_checking_threshold;
1030 defer_class_declaration_threshold;
1031 max_times_to_defer_type_checking;
1032 prefetch_deferred_files;
1033 recheck_capture;
1034 recli_version;
1035 remote_type_check;
1036 remote_worker_key;
1037 remote_check_id;
1038 remote_version_specifier;
1039 remote_transport_channel;
1040 naming_sqlite_path;
1041 enable_naming_table_fallback;
1042 symbolindex_search_provider;
1043 symbolindex_quiet;
1044 symbolindex_file;
1045 tico_invalidate_files;
1046 tico_invalidate_smart;
1047 profile_type_check_duration_threshold;
1048 profile_type_check_twice;
1049 profile_owner;
1050 profile_desc;
1051 go_to_implementation;
1052 watchman;
1055 let load ~silent ~current_version config_overrides =
1056 load_ path ~silent ~current_version config_overrides