We put all products and libraries in one monolithic git repository. Its layout looks like this:
- FooProduct
- BarProduct
- BazLibrary
- 3rd_party
|- fftw
|- msgpack
|- zlib
At current, we are using CMake to control the build. As CMake has separated config, generate and build phase, it would take extremely long time to run if you generate all things together. To avoid this, we give top-level CMakeLists.txt
for each part, and referring peer projects by up-level add_subirectory
calls. For example:
# FooProduct/CMakeLists.txt
project(FooProduct)
add_subdirectory(../BazLibrary sibling/BazLibrary)
add_subdirectory(../3rd_party/zlib sibling/3rd_party/zlib)
......
Now we are evaluating Bazel, and I immediately got the question: should I only place one single WORKSPACE
at top dir of the git repo?
- WORKSPACE
- FooProduct
- BarProduct
- BazLibrary
- 3rd_party
|- fftw
|- msgpack
|- zlib
Or put many WORKSPACE
files in each product/library and referring each other using local_repository
rule?
- FooProduct
|- WORKSPACE
- BarProduct
|- WORKSPACE
- BazLibrary
|- WORKSPACE
- 3rd_party
|- fftw
|- WORKSPACE
|- msgpack
|- WORKSPACE
|- zlib
|- WORKSPACE