   "Get all workspace qualified rules.  If FRESH-READ, skip cache."
   (if fresh-read
       (let* ((counter 0)
-             (build-files)
-             (length))
-        (setq build-files (ar/bazel-workspace-build-files))
-        (setq length (length build-files))
+             (build-files (ar/bazel-workspace-build-files))
+             (length (length build-files)))
         (seq-mapcat (lambda (build-file)
                       (setq counter (1+ counter))
-                      (message "Reading (%d/%d) %s" counter length build-file)
+                      (message "(%d/%d) %s" counter length
+                               (ar/bazel-qualified-package-path build-file))
                       (ar/bazel-qualified-rule-names-in-build-file-path build-file))
                     build-files))
     (ar/bazel--read-rules-cache)))

  "Cache absolute bazel build rules."
  (interactive)
  (let* ((proc-name "bazel-cache")
         (buffer (get-buffer-create (format "%s*" proc-name)))
         (emacs-bin (file-truename (expand-file-name invocation-name
                                                     invocation-directory))))
    (message "%s started" proc-name)

            (ar/bazel-qualified-package-path closest-build-file)
            (completing-read "build rule: " (ar/bazel-rule-names-in-build-file-path closest-build-file)))))

(defun ar/bazel-rule-names-in-build-file-path (file-path)
  "Get rule names in build FILE-PATH."
  (let ((rule-names))
    (with-temp-buffer
      (insert-file-contents file-path)
      (goto-char 1)
      ;; match all: name = "rulename"
      (while (search-forward-regexp "name *= *\"\\(.*\\)\"" nil t 1)
        (push (match-string-no-properties 1) rule-names)))
    rule-names))

(defun ar/bazel-qualified-rule-names-in-build-file-path (file-path)
  "Get qualified rule names in build FILE-PATH."
