rebuild_watch_list Subroutine

private subroutine rebuild_watch_list(self, print_header)

Recompute the watch list, rebuild fingerprints, and print/log the result.

Called: - During initialization, - When the manifest changes, - Periodically when rescan > 0.

Arguments

Type IntentOptional Attributes Name
class(watcher_t), intent(inout) :: self
logical, intent(in) :: print_header

Calls

proc~~rebuild_watch_list~~CallsGraph proc~rebuild_watch_list rebuild_watch_list proc~compute_watch_files_from_settings compute_watch_files_from_settings proc~rebuild_watch_list->proc~compute_watch_files_from_settings proc~ftoa ftoa proc~rebuild_watch_list->proc~ftoa proc~init_fingerprints init_fingerprints proc~rebuild_watch_list->proc~init_fingerprints proc~log_info log_info proc~rebuild_watch_list->proc~log_info proc~manifest_key_from_files manifest_key_from_files proc~rebuild_watch_list->proc~manifest_key_from_files proc~on_watch_list_built_all feature_manager_t%on_watch_list_built_all proc~rebuild_watch_list->proc~on_watch_list_built_all proc~print_banner print_banner proc~rebuild_watch_list->proc~print_banner proc~print_file_list print_file_list proc~rebuild_watch_list->proc~print_file_list str str proc~rebuild_watch_list->str proc~compute_watch_files_from_settings->proc~ftoa proc~compute_watch_files_from_settings->proc~log_info proc~compute_watch_files_from_settings->str add add proc~compute_watch_files_from_settings->add basename basename proc~compute_watch_files_from_settings->basename build_model build_model proc~compute_watch_files_from_settings->build_model dep dep proc~compute_watch_files_from_settings->dep get_package_data get_package_data proc~compute_watch_files_from_settings->get_package_data is_executable_target is_executable_target proc~compute_watch_files_from_settings->is_executable_target join_path join_path proc~compute_watch_files_from_settings->join_path new_dependency_tree new_dependency_tree proc~compute_watch_files_from_settings->new_dependency_tree proc~dfs_mark_bool dfs_mark_bool proc~compute_watch_files_from_settings->proc~dfs_mark_bool proc~dfs_mark_mask dfs_mark_mask proc~compute_watch_files_from_settings->proc~dfs_mark_mask proc~filter_watch_files filter_watch_files proc~compute_watch_files_from_settings->proc~filter_watch_files proc~gather_files_with_mask gather_files_with_mask proc~compute_watch_files_from_settings->proc~gather_files_with_mask proc~is_run_or_test is_run_or_test proc~compute_watch_files_from_settings->proc~is_run_or_test proc~normalize_path normalize_path proc~compute_watch_files_from_settings->proc~normalize_path proc~push_file_with_mask push_file_with_mask proc~compute_watch_files_from_settings->proc~push_file_with_mask proc~select_names_or_all select_names_or_all proc~compute_watch_files_from_settings->proc~select_names_or_all proc~trim_or_empty trim_or_empty proc~compute_watch_files_from_settings->proc~trim_or_empty targets_from_sources targets_from_sources proc~compute_watch_files_from_settings->targets_from_sources proc~file_fingerprint file_fingerprint proc~init_fingerprints->proc~file_fingerprint colorize colorize proc~log_info->colorize proc~manifest_key_from_files->basename features features proc~manifest_key_from_files->features proc~manifest_key_from_files->proc~file_fingerprint proc~fnv1a_mix_i64 fnv1a_mix_i64 proc~manifest_key_from_files->proc~fnv1a_mix_i64 proc~fnv1a_mix_str fnv1a_mix_str proc~manifest_key_from_files->proc~fnv1a_mix_str proc~feat_list_noop watch_feature_t%feat_list_noop proc~on_watch_list_built_all->proc~feat_list_noop proc~print_banner->proc~ftoa proc~print_banner->str proc~print_banner->colorize proc~active_features active_features proc~print_banner->proc~active_features proc~active_profile active_profile proc~print_banner->proc~active_profile proc~command_mode command_mode proc~print_banner->proc~command_mode proc~trim_or_default trim_or_default proc~print_banner->proc~trim_or_default proc~print_file_list->str proc~print_file_list->colorize proc~join_csv join_csv proc~active_features->proc~join_csv proc~active_profile->proc~trim_or_default proc~dfs_mark_bool->proc~dfs_mark_bool dependencies dependencies proc~dfs_mark_bool->dependencies proc~find_ptr_index find_ptr_index proc~dfs_mark_bool->proc~find_ptr_index proc~dfs_mark_mask->proc~dfs_mark_mask proc~dfs_mark_mask->dependencies proc~dfs_mark_mask->proc~find_ptr_index proc~hash_block hash_block proc~file_fingerprint->proc~hash_block proc~filter_watch_files->basename proc~filter_watch_files->proc~normalize_path glob glob proc~filter_watch_files->glob proc~fnv1a_mix_str->proc~fnv1a_mix_i64 include_dependencies include_dependencies proc~gather_files_with_mask->include_dependencies proc~vec_push_unique vec_push_unique proc~gather_files_with_mask->proc~vec_push_unique proc~push_file_with_mask->proc~vec_push_unique proc~select_names_or_all->basename proc~select_names_or_all->is_executable_target proc~select_names_or_all->glob proc~hash_block->proc~fnv1a_mix_i64 proc~vec_push_unique->proc~normalize_path exists exists proc~vec_push_unique->exists proc~is_ignored_path is_ignored_path proc~vec_push_unique->proc~is_ignored_path proc~is_in_dep_dirs is_in_dep_dirs proc~vec_push_unique->proc~is_in_dep_dirs proc~vec_grow vec_grow proc~vec_push_unique->proc~vec_grow proc~is_ignored_path->proc~normalize_path proc~contains_path_fragment contains_path_fragment proc~is_ignored_path->proc~contains_path_fragment proc~starts_with starts_with proc~is_ignored_path->proc~starts_with proc~is_in_dep_dirs->proc~normalize_path proc~is_in_dep_dirs->proc~starts_with proc~ends_with ends_with proc~contains_path_fragment->proc~ends_with

Called by

proc~~rebuild_watch_list~~CalledByGraph proc~rebuild_watch_list rebuild_watch_list proc~handle_manifest_change handle_manifest_change proc~handle_manifest_change->proc~rebuild_watch_list proc~watcher_init watcher_t%watcher_init proc~watcher_init->proc~rebuild_watch_list proc~watcher_run watcher_t%watcher_run proc~watcher_run->proc~rebuild_watch_list proc~watcher_run->proc~handle_manifest_change

Source Code

   subroutine rebuild_watch_list(self, print_header)
      class(watcher_t), intent(inout) :: self
      logical, intent(in) :: print_header

      integer(int64) :: rate, t0, t1
      real :: build_secs_total
      real :: secs_model, secs_targets, secs_watch
      integer :: nfiles, nroots
      real :: dummy_build

      type(string_t), allocatable :: new_files(:)
      integer(int64), allocatable :: new_mask(:)
      type(root_info_t), allocatable :: new_roots(:)

      call system_clock(count_rate=rate)
      if (rate <= 0_int64) rate = 1000_int64
      call system_clock(t0)

      call compute_watch_files_from_settings( &
         settings     = self%cfg%settings, &
         w            = self%cfg%w,        &
         files        = new_files,         &
         file_mask    = new_mask,          &
         roots        = new_roots,         &
         manifest_key = self%man_prev,     &
         build_secs   = dummy_build,       &
         secs_model   = secs_model,        &
         secs_targets = secs_targets,      &
         secs_watch   = secs_watch )

      call move_alloc(new_files, self%files)
      call move_alloc(new_mask,  self%file_mask)
      call move_alloc(new_roots, self%roots)

      call self%fm%on_watch_list_built_all(self%files, self%roots)

      self%man_prev = manifest_key_from_files(self%cfg%settings, self%files)

      call init_fingerprints(self%files, self%fp_prev, self%fp_now, self%changed_idx)

      call system_clock(t1)
      build_secs_total = real(t1 - t0) / real(rate)

      nfiles = 0
      if (allocated(self%files)) nfiles = size(self%files)

      nroots = 0
      if (allocated(self%roots)) nroots = size(self%roots)

      if (self%cfg%w%debug) then
         call log_info(self%cfg%w, "debug: manifest_key=" // str(self%man_prev))
         call log_info(self%cfg%w, "debug: roots=" // str(nroots) // " files=" // str(nfiles))
      end if

      if (print_header) then
         call print_banner( &
            full_cmdline = self%cfg%fpm_cmdline, &
            settings     = self%cfg%settings,    &
            w            = self%cfg%w,           &
            files        = self%files,           &
            build_secs   = build_secs_total,     &
            roots_count  = nroots,               &
            secs_model   = secs_model,           &
            secs_targets = secs_targets,         &
            secs_watch   = secs_watch )
         if (self%cfg%w%print_files_once) call print_file_list(self%files, self%cfg%w)
      else
         call log_info(self%cfg%w, "watch list updated in " // ftoa(build_secs_total) // "s; files=" // str(nfiles))
         if (self%cfg%w%verbosity >= 2) call print_file_list(self%files, self%cfg%w)
      end if
   end subroutine rebuild_watch_list