Configuration
Create a rebaze.toml in your project root to customize migration behavior.
Common recipes
Section titled “Common recipes”Copy-paste these for common scenarios:
Minimal config
Section titled “Minimal config”[versions]rules_cc = "0.1.1"Map a custom library
Section titled “Map a custom library”[mappings.system_libraries]mylib = "@mylib"Hermetic builds (CI/CD)
Section titled “Hermetic builds (CI/CD)”[strategy]default = "source"
[mappings.known_packages.zlib]version = "1.3.1"url = "https://github.com/madler/zlib/releases/download/v1.3.1/zlib-1.3.1.tar.gz"sha256 = "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23"strip_prefix = "zlib-1.3.1"build_system = "cmake"out_static_libs = ["libz.a"]Hybrid (fast local, hermetic CI)
Section titled “Hybrid (fast local, hermetic CI)”[strategy]default = "system"
[strategy.overrides]openssl = "source" # Security-critical: always hermeticzlib = "source"CMake package mapping
Section titled “CMake package mapping”[mappings.packages.OpenSSL]target_pattern = "@openssl//:{component}"
[mappings.packages.OpenSSL.components]SSL = "@openssl//:ssl"Crypto = "@openssl//:crypto"Full reference
Section titled “Full reference”[versions]
Section titled “[versions]”Pin Bazel dependency versions:
[versions]rules_cc = "0.1.1"platforms = "0.0.11"rules_foreign_cc = "0.14.0"googletest = "1.15.2"google_benchmark = "1.9.1"[strategy]
Section titled “[strategy]”Control how external dependencies are resolved:
[strategy]default = "system" # system | source | conan | vcpkg
[strategy.overrides]zlib = "source"openssl = "source"| Strategy | Hermetic | Build speed | Setup |
|---|---|---|---|
system | No | Fast | None |
source | Yes | Slow (first) | Package metadata |
vcpkg | Partial | Medium | vcpkg install |
conan | Partial | Medium | Conan install |
[mappings]
Section titled “[mappings]”System libraries
Section titled “System libraries”Map -l flags to Bazel targets:
[mappings.system_libraries]z = "@zlib"ssl = "@openssl//:ssl"crypto = "@openssl//:crypto"gtest = "@googletest//:gtest"Plain libraries
Section titled “Plain libraries”Map library names without -l prefix:
[mappings.plain_libraries]gtest = "@googletest//:gtest"boost = "@boost"CMake packages
Section titled “CMake packages”Map find_package() results:
[mappings.packages.Boost]target_pattern = "@boost//:{component}"
[mappings.packages.Boost.components]filesystem = "@boost//:filesystem"system = "@boost//:system"Implicit system libraries
Section titled “Implicit system libraries”Libraries to ignore (linked by default):
[mappings]implicit_system_libs = ["pthread", "c", "m", "dl", "rt"]Ignored libraries
Section titled “Ignored libraries”Libraries to skip entirely:
[mappings]ignored_libraries = ["fmt", "spdlog", "Threads::Threads"]Transitive dependencies
Section titled “Transitive dependencies”Declare deps that pull in other deps:
[mappings.transitive_deps]glib = ["pcre2", "libffi", "zlib"]curl = ["zlib", "openssl"]System linkopts
Section titled “System linkopts”Override linker flags:
[mappings.system_linkopts]"glib-2.0" = ["-lglib-2.0"]curl = ["-lcurl"][mappings.known_packages]
Section titled “[mappings.known_packages]”Define source builds for hermetic resolution:
[mappings.known_packages.zlib]version = "1.3.1"url = "https://github.com/madler/zlib/releases/download/v1.3.1/zlib-1.3.1.tar.gz"sha256 = "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23"strip_prefix = "zlib-1.3.1"build_system = "cmake" # cmake | meson | autotoolsout_static_libs = ["libz.a"][build]
Section titled “[build]”Configure generated BUILD files:
[build]default_visibility = "//visibility:public"header_patterns = ["**/*.h", "**/*.hpp"]default_cxx_standard = "17"default_c_standard = "11"module_version = "0.1.0"Custom rules
Section titled “Custom rules”Use your own rule implementations:
[build.rules]library_rule = "my_cc_library"binary_rule = "my_cc_binary"test_rule = "my_cc_test"
[[build.rules.extra_loads]]bzl = "@company//build:rules.bzl"items = ["my_cc_library", "my_cc_binary"][filters]
Section titled “[filters]”Filter platform-specific artifacts:
[filters]excluded_source_extensions = ["rc", "res", "plist", "o", "obj"]excluded_define_patterns = ["_WIN32", "__APPLE__", "_DEBUG"]excluded_copt_patterns = ["/", "-O", "-g", "-std="]excluded_include_patterns = ["/usr/", "/opt/"]Complete example
Section titled “Complete example”# rebaze.toml - Complete example
[versions]rules_cc = "0.1.1"rules_foreign_cc = "0.14.0"googletest = "1.15.2"
[strategy]default = "system"
[strategy.overrides]openssl = "source"zlib = "source"
[mappings.system_libraries]z = "@zlib"ssl = "@openssl//:ssl"crypto = "@openssl//:crypto"
[mappings]implicit_system_libs = ["pthread", "c", "m", "dl", "rt"]ignored_libraries = ["Threads::Threads"]
[mappings.known_packages.zlib]version = "1.3.1"url = "https://github.com/madler/zlib/releases/download/v1.3.1/zlib-1.3.1.tar.gz"sha256 = "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23"strip_prefix = "zlib-1.3.1"build_system = "cmake"out_static_libs = ["libz.a"]
[build]default_visibility = "//visibility:public"default_cxx_standard = "17"
[filters]excluded_source_extensions = ["rc", "res", "plist"]excluded_define_patterns = ["_WIN32", "__APPLE__"]