Skip to content

Classify .BUILD.bazel suffixed files as TypeBuild #1432

@Silic0nS0ldier

Description

@Silic0nS0ldier

Currently the following filename patterns are treated as TypeBuild;

  • .BUILD file extension (*.BUILD) - suitable for copying into repository rules.
  • BUILD base name (BUILD or BUILD.bazel).
  • BUILD. prefix (BUILD.*.bazel) - suitable for copying into repository rules.

For repository rules BUILD and BUILD.bazel cannot be used as the files will be parsed by Bazel in the owning repository, leading to side effects (affects labels and BUILD files for the repo rule may be outside of their intended destination).

*.BUILD and BUILD.*.bazel cover this issue, however these have issues for our (Canva) use case;

  • In our style guide we require file extensions like .bazel and .bzl.
  • For trivial third-party dependencies we name files like a.BUILD.bazel and a.MODULE.bazel so they naturally sit beside each other.
  • *.MODULE.bazel is the only alternative pattern supported for TypeModule.
  • starpls does not recognise BUILD.*.bazel as BUILD files (IMO a bug in the language server, but worth mentioning as an observed point of friction).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions