Skip to content

incompatible_no_transitive_loads: Forbid macros loaded transitively #5636

@laurentlb

Description

@laurentlb

When a bzl file contains a load, e.g.
load("//some:file.bzl", "fct")
it implicitly exports fct.

This is problematic for many reasons:

  • Exports should be explicit
  • Other languages don't do that
  • Removing a load can break other files
  • So it means we can't have a tool to safely remove unused loads

Unfortunately, this is a breaking change.

There are two ways to fix it.

  1. Update the load site and use the label of the file where the symbol is really declared
  2. Update the loaded file. To explicitly re-export the symbol foo, use:
load("...", _foo = "foo")

foo = _foo

Metadata

Metadata

Assignees

Labels

P1I'll work on this now. (Assignee required)incompatible-changeIncompatible/breaking change

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions