Skip to content

Configuration

Create a rebaze.toml in your project root to customize migration behavior.

Copy-paste these for common scenarios:

[versions]
rules_cc = "0.1.1"
[mappings.system_libraries]
mylib = "@mylib"
[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"]
[strategy]
default = "system"
[strategy.overrides]
openssl = "source" # Security-critical: always hermetic
zlib = "source"
[mappings.packages.OpenSSL]
target_pattern = "@openssl//:{component}"
[mappings.packages.OpenSSL.components]
SSL = "@openssl//:ssl"
Crypto = "@openssl//:crypto"

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"

Control how external dependencies are resolved:

[strategy]
default = "system" # system | source | conan | vcpkg
[strategy.overrides]
zlib = "source"
openssl = "source"
StrategyHermeticBuild speedSetup
systemNoFastNone
sourceYesSlow (first)Package metadata
vcpkgPartialMediumvcpkg install
conanPartialMediumConan install

Map -l flags to Bazel targets:

[mappings.system_libraries]
z = "@zlib"
ssl = "@openssl//:ssl"
crypto = "@openssl//:crypto"
gtest = "@googletest//:gtest"

Map library names without -l prefix:

[mappings.plain_libraries]
gtest = "@googletest//:gtest"
boost = "@boost"

Map find_package() results:

[mappings.packages.Boost]
target_pattern = "@boost//:{component}"
[mappings.packages.Boost.components]
filesystem = "@boost//:filesystem"
system = "@boost//:system"

Libraries to ignore (linked by default):

[mappings]
implicit_system_libs = ["pthread", "c", "m", "dl", "rt"]

Libraries to skip entirely:

[mappings]
ignored_libraries = ["fmt", "spdlog", "Threads::Threads"]

Declare deps that pull in other deps:

[mappings.transitive_deps]
glib = ["pcre2", "libffi", "zlib"]
curl = ["zlib", "openssl"]

Override linker flags:

[mappings.system_linkopts]
"glib-2.0" = ["-lglib-2.0"]
curl = ["-lcurl"]

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 | autotools
out_static_libs = ["libz.a"]

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"

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"]

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/"]

# 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__"]