   "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)))


(defun ar/bazel-qualified-package-path (path)
  "Convert PATH to workspace-qualified package: /some/path/workspace/package/BUILD => //package."
  (replace-regexp-in-string (ar/bazel-workspace-path) "//"
                            (string-remove-suffix "/" (file-name-directory (expand-file-name path)))))

(defun ar/bazel-linked-dpath (name)
  "Append NAME to bazel root path and return it."

  "With a \"bazel\" prefix, we'd get linked directories like:
bazel-bin, bazel-genfiles, and bazel-out.")

(defvar ar/bazel-compile-subcommand "build" "Compile subcommand.")

(defun ar/bazel-compile ()
  "Invoke `'compile with `'completing-read a build rule in either current or parent directories."
  (interactive)
  (compile (format "%s %s" ar/bazel-command ar/bazel-compile-subcommand
                   ;; Use for narrowing down rules to closest package.
                   ;; (ar/bazel-completing-read-build-rule)
                   (completing-read "build rule: " (ar/bazel-workspace-build-rules)))))

(defun ar/bazel-completing-read-build-rule ()
  "Find a build file in current or parent directories and `'completing-read a build rule."
