Blade Build System
June 7, 2026 · View on GitHub

English | 简体中文
A modern, high-performance build system optimized for trunk-based development in large-scale monorepo environments.
Build Status
Demo
First, let's see a cool demo:
Releases
The master branch is the current development line for v3; the former v3 branch has been removed, so master is now the v3 line. v3 is at pre-release (v3.0.0-beta) with no stable release yet — the latest stable release is v2.1.0. See all Releases.
Blade 3.0
V3 is a comprehensive modernization upgrade with these highlights:
- Python 3.10+ only, all Python 2 compatibility code removed
- Full type annotations with pyright static checking
- Comprehensive unit tests covering core build rules and utilities
- Cross-repo E2E smoke tests against the standalone blade-test repository
- Experimental macOS and Windows support, with multiple cross-platform compilation fixes
- Code cleanup: dead code and invalid tests removed, known bugs fixed
- New documentation: Go builds and
$(location)syntax
See the Upgrade to V3 guide for details.
For V2, use the v2 branch or v2.1.0 tag. See the V2 Upgrade Notes.
Stargazers over time
Origin
Blade is engineered as a modern, high-performance build system that combines power with ease of use. It provides comprehensive support for multiple programming languages including C/C++, Java, Python, Scala, Protocol Buffers, and more. The system automatically analyzes target dependencies and seamlessly integrates compilation, linking, testing (with support for incremental and parallel testing), and static code analysis.
Designed to enhance development productivity, Blade simplifies build configuration while maintaining robust functionality for complex projects.
Blade is primarily positioned for large C++ projects, closely integrated with development workflows such as unit testing, continuous integration, and coverage statistics. Like Unix text filtering programs, it maintains relative independence and can run standalone. It currently supports Linux (i386/x86_64/aarch64) as the primary platform, with experimental support for macOS and Windows.
During the development of Tencent's "Typhoon" cloud computing platform, we identified significant challenges with GNU Make and Autotools in large-scale environments. Inspired by insights from Google's engineering blog, we engineered Blade as a declarative build system.
The system utilizes declarative build scripts where developers specify what to build (targets, sources, and direct dependencies) rather than how to build it. This approach dramatically reduces configuration complexity while significantly improving development efficiency and maintainability.
Blade was open-sourced in 2012 as one of Tencent's earliest open-source initiatives. The system has achieved widespread adoption across Tencent's technology stack, including advertising platforms, WeChat backend services, gaming infrastructure, and core infrastructure systems. Beyond Tencent, Blade has been deployed at major technology companies including Xiaomi, Baidu, and iQiyi.
The project has fostered an active contributor community, receiving numerous Pull Requests from both internal and external developers. Originally hosted on Google Code, the project was migrated to chen3feng's personal repository following Google Code's deprecation, where it continues to be actively maintained and developed.
With Blade, you can compile, link, and test multiple targets by just inputting one simple command line. For example:
Build and test all targets in the common directory recursively.
blade test common...
Build and test targets as 32-bit
blade test -m32 common...
Build and test targets in debug mode
blade test -pdebug common...
And you can combine the flags:
blade test -m32 -pdebug common...
Why It Exists
First and foremost, Blade solves dependency problems. When you build certain targets, if header files have changed, it will automatically rebuild them.
Most conveniently, Blade can also track library file dependencies. For example, if library foo depends on library common, then in library foo's BUILD file, you list the dependency:
cc_library(
name = 'foo',
srcs = ...,
hdrs = ...,
deps = ':common'
)
Then for programs using foo, if they don't directly use common, you only need to list foo, not common:
cc_binary(
name = 'my_app',
srcs = ...,
deps = ':foo'
)
This way, when your library implementation changes, adding or removing libraries, you don't need to notify library users to make changes together. Blade automatically maintains this layer of indirect dependencies. When building my_app, it will also automatically check whether foo and common need to be updated.
In terms of ease of use, besides automatic dependency maintenance, Blade can also achieve that users only need to type one command line to handle compilation, linking, and unit testing for the entire directory tree.
Features
- Automatic analysis of header file dependencies, building affected code.
- Incremental compilation and linking, only building code that needs to be rebuilt due to changes.
- Automatic calculation of indirect library dependencies - library authors only need to write direct dependencies, and builds automatically check if dependent libraries need rebuilding.
- Ability to build from any subdirectory in any code tree.
- Support for recursive building of all targets in multiple directories at once, as well as building only specific arbitrary targets.
- Whatever targets you build, their dependent targets are also automatically updated.
- Built-in debug/release build types.
- Colorful highlighting of error messages during build process.
- Support for ccache.
- Support for distcc.
- Support for building multi-platform targets.
- Support for compiler selection during build (different versions of gcc, clang, etc.).
- Support for compiling protobuf, lex, yacc, swig.
- Support for custom rules.
- Support for testing, running multiple tests from command line.
- Support for parallel testing (multiple test processes running concurrently).
- Support for incremental testing (unchanged test programs are automatically skipped).
- Integration with gperftools for automatic memory leak detection in test programs.
- Vim syntax highlighting for build scripts.
- git-style subcommand command line interface.
- Support for bash command line completion.
- Written in Python, no compilation needed, direct installation and use.
Problems Avoided
Completely avoiding the following problems:
- Header files updated, but affected modules were not rebuilt.
- Dependent libraries needed updates but were not updated during build, such as certain subdirectory dependencies.
Documentation
Contributers
Credits
-
Blade is inspired by Google's public information about their build system. Here is a reference article from Google's official blog: build in cloud: how build system works.
Later in 2015, they released it with a partially rewritten version as the
bazelopen-source build system. -
Blade generates Ninja script internally, so of course it depends on Ninja.
-
Python is a powerful and easy-to-used language, we like python.
Some libraries open-sourced by Google, such as:
They are handy and powerful; we have integrated these libraries.
Our philosophy: Liberate programmers, improve productivity. Use tools to solve non-creative technical problems.
Welcome to use and help us improve Blade, we look forward to your contributions.