Skip to content
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_disallow_load_labels_to_cross_package_boundaries: make 'load' statement respect package boundaries #6408

Closed
haxorz opened this issue Oct 16, 2018 · 7 comments

Comments

@haxorz
Copy link
Contributor

commented Oct 16, 2018

Description of the problem / feature request:

load('//a:b/c.bzl', 'doesntmatter') currently checks that '//a' is a package but doesn't check that '//a/b' is not.

Feature requests: what underlying problem are you trying to solve with this feature?

we currently have a "label crosses subpackage boundary check" elsewhere (e.g. for target names inside of a package). so we should add this for the sake of consistency.

Any other information, logs, or outputs that you want to share?

we should piggyback/unify the existing mechanism for the existing "label crosses subpackage boundary check" in PackageFunction.java.

@haxorz haxorz self-assigned this Oct 16, 2018

@laurentlb laurentlb added the P1 label Oct 16, 2018

bazel-io pushed a commit that referenced this issue Oct 16, 2018

Error-out if the label in a 'load' statement crosses a subpackage bou…
…ndary. This behavior is guarded by a flag (default value is "don't error out"), and will eventually become the only behavior.

This implements the feature in #6408.

RELNOTES: None
PiperOrigin-RevId: 217402217
@dslomov

This comment has been minimized.

Copy link
Contributor

commented Oct 17, 2018

This is a breaking change, right? Which flag guards it? How do users migrate?

@laurentlb

This comment has been minimized.

Copy link
Member

commented Oct 17, 2018

Yes, it's a breaking change.
The commit above adds an incompatible flag: https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#load-label-cannot-cross-package-boundaries

We need tooling to help the migration (cc @vladmos).

@laurentlb laurentlb assigned laurentlb and unassigned haxorz Oct 17, 2018

@dslomov dslomov changed the title Starlark: make 'load' statement respect package boundaries incompatible_disallow_load_labels_to_cross_package_boundaries: make 'load' statement respect package boundaries Oct 31, 2018

@dslomov

This comment has been minimized.

Copy link
Contributor

commented Oct 31, 2018

What is missing for migration: migration docs, length of migration window. After these are done, please add "migration-ready" label.

@laurentlb

This comment has been minimized.

Copy link
Member

commented Jan 7, 2019

Migration notes

This will fail when a label crosses packages, i.e. when the position of the colon is not correct in a label. The error message will tell you what is the correct label to use instead.

Read more about the label syntax here: https://docs.bazel.build/versions/master/build-ref.html#labels

@laurentlb

This comment has been minimized.

Copy link
Member

commented Jan 8, 2019

Downstream projects that fail with this flag (https://buildkite.com/bazel/bazel-at-release-plus-incompatible-flags/builds/56):

  • rules_k8s
  • rules_typescript
  • TensorFlow
@philwo

This comment has been minimized.

Copy link
Member

commented Feb 6, 2019

This flag was not flipped in time for the Bazel 0.23.0 release and will thus be postponed to Bazel 0.24.0.

@katre

This comment has been minimized.

Copy link
Member

commented Mar 1, 2019

This issue was tagged as "breaking-change-0.24" but does not appear ready to be flipped in the 0.24.0 release. If this is incorrect please comment on that issue and discuss with me.

@bazel-io bazel-io closed this in 3f791e7 Mar 26, 2019

emusand added a commit to emusand/bazel that referenced this issue Apr 16, 2019

Enable incompatible_disallow_load_labels_to_cross_package_boundaries …
…by default

Fixes bazelbuild#6408

Tested: https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/52

RELNOTES: `--incompatible_disallow_load_labels_to_cross_package_boundaries` is enabled by default
PiperOrigin-RevId: 240347889
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.