Search code examples
bazelseparation-of-concerns

Is it possible to split up WORKSPACE file in several files?


I have a Bazel project with a WORKSPACE and many packages. WORKSPACE file is quite huge, so I wonder if it's possible to break it down in separated files and import them.


Solution

  • You can extract parts of the WORKSPACE into .bzl files, and load() these symbols for variables and functions into the WORKSPACE.

    load("//foo/bar:file.bzl", "function_for_workspace")
    function_for_workspace()
    

    See Loading an extension for more information.