bazel__book/packages.md

546 B
Raw Permalink Blame History

Packages

Packages are how BZL organizes code.

  • A package is a directory container a BUILD[.bazel] file.
  • The BUILD.bazel defines targets in the package:
    • libraries
    • binaries
    • tests
  • Targets can depend on other targets in the same package or other packages.
    • Visibility can be widened to the subtree or the entiry repository, but like in Go it is best to start with the smallest possible scope.
  • They are visible only within the package by default
  • Targets flagged testonly can only be used by test targets.