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

Flipping of --incompatible_disallow_load_labels_to_cross_package_boundaries bit broke plugin build in Gerrit Code Review #8367

Closed
davido opened this issue May 16, 2019 · 3 comments

Comments

@davido
Copy link
Contributor

davido commented May 16, 2019

After Bazel upgrade from 0.24.0 to 0.25.1, that flipped cross package boundaries bit in #6408, load statement doesn't work anymore:

$ cat plugins/external_plugin_deps.bzl 
load(":events-log/external_plugin_deps.bzl", events_log = "external_plugin_deps")

def external_plugin_deps():
    events_log()

and is failing with:

ERROR: Failed to load Starlark extension '//plugins:events-log/external_plugin_deps.bzl'.
It usually happens when the repository is not defined prior to being used.
This could either mean you have to add the '' repository with a statement like `http_archive` in your WORKSPACE file (note that transitive dependencies are not added automatically), or the repository '' was defined too late in your WORKSPACE file.
ERROR: cycles detected during target parsing
INFO: Elapsed time: 0.087s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

All is fine, when --incompatible_disallow_load_labels_to_cross_package_boundaries=false option is passed.

Bundling custom plugins feature in release.war is documented here: https://gerrit-review.googlesource.com/Documentation/dev-build-plugins.html#_bundle_custom_plugin_in_release_war.

To reproduce, clone gerrit code review, and clone events-log plugin into plugins directory in gerrit tree.

Then replace plugins/external_plugin_deps.bzl with the file shown above and run:

  $ bazel build :release
@davido
Copy link
Contributor Author

davido commented May 17, 2019

@laurentlb @hanwen Could you please have a look?

@hanwen
Copy link
Contributor

hanwen commented May 17, 2019

the load statement

load(":events-log/external_plugin_deps.bzl", events_log = "external_plugin_deps")

is incorrect "events-log" holds a BUILD file, so this should be something like

load("//plugins/events-log:external_plugin_deps.bzl" , ... )

however, the WORKSPACE under the plugin triggers a recursive workspace.

aehlig suggests to mount the subdir as a local_repository. This causes the sub-WORKSPACE to be ignored.

@davido
Copy link
Contributor Author

davido commented May 17, 2019

Thanks.

@davido davido closed this as completed May 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants