Function: bazel-find-build-file

bazel-find-build-file is an interactive and natively compiled function defined in bazel.el.

Signature

(bazel-find-build-file)

Documentation

Find the BUILD file for the current package.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/ws8pkszjvcad1rgzqw6wja7qxacylfhn-emacs-packages-deps/share/emacs/site-lisp/elpa/bazel-20261002.1510/bazel.el
;;;; Finding BUILD and WORKSPACE files

(defun bazel-find-build-file ()
  "Find the BUILD file for the current package."
  (declare (ftype (function () null))
           (interactive-only t))
  (interactive)
  (let* ((source-file
          (or buffer-file-name default-directory
              (user-error "Buffer doesn’t visit a file or directory")))
         (root (or (bazel--repository-root source-file)
                   (user-error "File is not in a Bazel repository")))
         (directory (or (bazel--package-directory source-file root)
                        (user-error "File is not in a Bazel package")))
         (build-file (or (bazel--locate-build-file directory)
                         (user-error "No BUILD file found"))))
    (find-file build-file))
  nil)