Skip to content

incompatible_no_transitive_loads: Forbid macros loaded transitively #5636

Closed

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

Activity

  1. ittaiz commented on Jul 20, 2018

    @ittaiz
    Member
  2. self-assigned this
    on Sep 21, 2018
  3. added
    P1
    on Sep 21, 2018
  4. changed the title [-]Forbid macros loaded transitively[/-] [+]--incompatible_no_transitive_loads: Forbid macros loaded transitively[/+] on Nov 23, 2018
  5. added
    incompatible-change
    on Nov 23, 2018
  6. changed the title [-]--incompatible_no_transitive_loads: Forbid macros loaded transitively[/-] [+]incompatible_no_transitive_loads: Forbid macros loaded transitively[/+] on Jan 7, 2019
  7. 33 remaining items

  8. added a commit that references this issue on Jan 11, 2020
  9. ittaiz commented on Jan 16, 2020

    @ittaiz
    Member

    @laurentlb to verify- the fact that this issue is closed means new code can use load "regularly" and not have to worry about it being exported, right?

  10. laurentlb commented on Jan 17, 2020

    @laurentlb
    ContributorAuthor

    Yes.
    We close an issue about an incompatible flag when the change is enabled by default at head. So you can expect all Bazel releases after March 2019 to behave correctly in this regard.

  11. added a commit that references this issue on Jan 19, 2020
  12. added a commit that references this issue on Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1incompatible-change

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions