Skip to content

Commit

Permalink
Bazel: Adapt docs for custom plugins with external deps
Browse files Browse the repository at this point in the history
After flipping of
--incompatible_disallow_load_labels_to_cross_package_boundaries bit in
Bazel: [1], currently documented way to import external dependencies
from plugins that implement standalone build mode doesn't work any more.

This change documents an alternative approach how to make it work,
without abandoning of standalone build mode.

[1] bazelbuild/bazel#6408

Bug: Issue 10885
Change-Id: I7b1c4e9fa4f6ba8966efcde4cdee7d76d6f59d1c
  • Loading branch information
davido committed Aug 30, 2019
1 parent 8f80c85 commit 7c12542
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions Documentation/dev-build-plugins.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,25 @@ CUSTOM_PLUGINS_TEST_DEPS = [
----

If the plugin(s) being bundled in the release have external dependencies, include them
in `plugins/external_plugin_deps`. You should alias `external_plugin_deps()` so it
can be imported for multiple plugins. For example:
in `plugins/external_plugin_deps`. Create symbolic link from plugin's own
`external_plugin_deps()` file in plugins directory and prefix the file with
plugin name, e.g.:

----
load(":my-plugin/external_plugin_deps.bzl", my_plugin="external_plugin_deps")
load(":my-other-plugin/external_plugin_deps.bzl", my_other_plugin="external_plugin_deps")
$ cd plugins
$ ln -s oauth/external_plugin_deps.bzl oauth_external_plugin_deps.bzl
$ ln -s uploadvalidator/external_plugin_deps.bzl uploadvalidator_external_plugin_deps.bzl
----

Now the plugin specific dependency files can be imported:

----
load(":oauth_external_plugin_deps.bzl", oauth_deps="external_plugin_deps")
load(":uploadvalidator_external_plugin_deps.bzl", uploadvalidator_deps="external_plugin_deps")

def external_plugin_deps():
my_plugin()
my_other_plugin()
oauth_deps()
uploadvalidator_deps()
----

[NOTE]
Expand Down

0 comments on commit 7c12542

Please sign in to comment.