If your project depends on TensorFlow it is recommended that you add...
load("//tensorflow:workspace.bzl", "tf_workspace")
tf_workspace()
...to your WORKSPACE
file, which will load all of TF's dependencies.
However, if you look at TensorFlow's workspace.bzl
file...
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/workspace.bzl
you can see that it depends on rules from @io_bazel_rules_closure
. This means you also have to define this @io_bazel_rules_closure
rule in your WORKSPACE
file and keep it in sync with TensorFlow, even if you don't need it anywhere else in your project.
Is there a way to add the load()
command somehow/somewhere into the tf_workspace()
macro?
Thanks!
No, there is no way to add this rule in tf_workspace()
, since the skylark rule tf_workspace()
defined in https://github.com/tensorflow/tensorflow/blob/master/tensorflow/workspace.bzl needs to load @io_bazel_rules_closure
.
There are basically two ways to make this work
either the tensorflow project redefines its rules so that it only uses internal rules or native rules.
or bazel is able to load the workspace of a dependency (and I assume load all the transitive dependencies too). This is a hard problem and is tracked in #1943.