Dependency Strategies
Rebaze supports multiple strategies for resolving external dependencies.
Available Strategies
Section titled “Available Strategies”| Strategy | Hermetic | Speed | Setup |
|---|---|---|---|
system | No | Fast | Minimal |
source | Yes | Slow (first build) | Moderate |
vcpkg | Partial | Moderate | vcpkg install |
conan | Partial | Moderate | Conan install |
System Strategy (Default)
Section titled “System Strategy (Default)”Uses system-installed libraries via pkg-config.
[strategy]default = "system"How it works:
- Generates
cc_librarytargets withlinkopts - At build time, pkg-config resolves library paths
- System libraries are linked
Pros:
- Fast builds
- Simple setup
- Works with existing packages
Cons:
- Non-hermetic
- Version may vary across machines
- Not reproducible
Generated:
cc_library( name = "zlib", linkopts = ["-lz"],)Source Strategy
Section titled “Source Strategy”Builds dependencies from source using rules_foreign_cc.
[strategy]default = "source"How it works:
- Downloads source archives
rules_foreign_ccbuilds them- Built libraries are used as deps
Pros:
- Fully hermetic
- Reproducible builds
- Same version everywhere
Cons:
- Slower first build
- Requires package metadata
Generated:
cmake( name = "zlib", lib_source = "@zlib//:all_srcs", out_static_libs = ["libz.a"],)Per-Package Overrides
Section titled “Per-Package Overrides”Mix strategies based on your needs:
[strategy]default = "system"
[strategy.overrides]openssl = "source" # Hermeticzlib = "source" # Hermeticqt = "system" # Large, use systemChoosing a Strategy
Section titled “Choosing a Strategy”Use system when:
Section titled “Use system when:”- Developing locally
- Dependencies are stable system packages
- Build speed is important
Use source when:
Section titled “Use source when:”- Reproducibility is critical
- Building in varied environments
- Creating release builds
CI Considerations
Section titled “CI Considerations”For CI pipelines:
[strategy]default = "source"rebaze migrate . --config rebaze.ci.toml