I'm assuming you're only planning to support builds in one "top-level" WORKSPACE. Otherwise, you have to duplicate all the dependencies (or put them in a big macro that gets used in each), and they each have their own output root (which includes the action cache).
The big developer unfriendliness issue I see with that is that bazel build
(and other commands) look for the first WORKSPACE they find going up the directory tree. It's similar to how git
looks for a .git folder. That means running a bazel command from the wrong directory produces weird errors when it finds the "wrong" WORKSPACE. You can mitigate that by making all the other WORKSPACE files look like this:
fail("Do not build from this directory, try the root folder instead.")
At least it's a clear error then, but it's still annoying to have to cd
before running a build.
Have you considered doing includes = ["."]
for all your rules, and only creating BUILD files in the module root directories? That should let you do the include paths the way you're describing, while keeping it all in the same workspace.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…