New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incompatible_no_transitive_loads: Forbid macros loaded transitively #5636

Open
laurentlb opened this Issue Jul 19, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@laurentlb
Copy link
Contributor

laurentlb commented Jul 19, 2018

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
@ittaiz

This comment has been minimized.

Copy link
Member

ittaiz commented Jul 20, 2018

@laurentlb laurentlb self-assigned this Sep 21, 2018

@laurentlb laurentlb added the P1 label Sep 21, 2018

bazel-io pushed a commit that referenced this issue Sep 27, 2018

Introduce --incompatible_no_transitive_loads
With flag set, loaded symbols are not automatically re-exported.

#5636

RELNOTES: None.
PiperOrigin-RevId: 214776940

@laurentlb laurentlb changed the title Forbid macros loaded transitively --incompatible_no_transitive_loads: Forbid macros loaded transitively Nov 23, 2018

bazel-io pushed a commit that referenced this issue Nov 26, 2018

Skydoc: do not show documentation of loaded symbols
Default behavior of Bazel will change soon (--incompatible_no_transitive_loads)

#5636

RELNOTES: None.
PiperOrigin-RevId: 222841756

@laurentlb laurentlb changed the title --incompatible_no_transitive_loads: Forbid macros loaded transitively incompatible_no_transitive_loads: Forbid macros loaded transitively Jan 7, 2019

@laurentlb

This comment has been minimized.

Copy link
Contributor

laurentlb commented Jan 8, 2019

After running on the CI (https://buildkite.com/bazel/bazel-at-release-plus-incompatible-flags/builds/56), here's the list of projects that fail with the flag:

  • Android Testing
  • bazel-toolchains
  • Gerrit
  • rules_closure
  • rules_foreign_cc
  • rules_scala
  • Tensorflow
@ittaiz

This comment has been minimized.

Copy link
Member

ittaiz commented Jan 16, 2019

@laurentlb you fixed rules_scala, right?

@laurentlb

This comment has been minimized.

Copy link
Contributor

laurentlb commented Jan 16, 2019

I think so. I'll update the list after a new CI run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment