Watch mode monitors source files and automatically triggers rebuilds when changes are detected.
# Watch all targets
bldr build --watch
# Watch specific target
bldr build --watch //src:app
# Standalone watch command
bldr watch
# Custom debounce delay
bldr build --watch --debounce=500| Option | Description | Default |
|---|---|---|
--watch, -w |
Enable watch mode | - |
--clear |
Clear screen between builds | true |
--no-clear |
Don't clear screen | - |
--debounce=<ms> |
Debounce delay in milliseconds | 300 |
--graph, -g |
Show dependency graph on each build | false |
--mode=<mode> |
Render mode (auto, interactive, plain) | auto |
--verbose, -v |
Verbose output | false |
Builder automatically selects the best available file watcher:
| Platform | Watcher | Requirement |
|---|---|---|
| macOS | FSEvents | fswatch (via Homebrew) |
| Linux | inotify | inotify-tools |
| BSD | kqueue | Built-in |
| Other | Polling | None (fallback) |
macOS:
brew install fswatchLinux (Debian/Ubuntu):
sudo apt-get install inotify-toolsLinux (RHEL/Fedora):
sudo yum install inotify-toolsNative watchers provide near-instant change detection with minimal CPU overhead. The polling fallback works everywhere but uses more resources.
Watch mode:
- Performs an initial build
- Watches all source files (respecting
.builderignore) - On file change, waits for the debounce delay
- Re-parses configuration
- Runs incremental build
- Displays results
- Continues until interrupted (Ctrl+C)
The debounce delay groups rapid file changes into a single rebuild. Adjust based on your workflow:
- 100-200ms: Fast feedback, may trigger multiple builds during IDE auto-save
- 300-500ms: Balanced for most workflows
- 1000ms+: Fewer builds, better for large projects or slow systems
Watch mode leverages the build cache:
- Memory-mapped graph persistence for instant startup
- Per-file content hashing
- Only rebuilds affected targets
Exclude files from watching:
# Build artifacts
bin/
obj/
*.o
# Dependencies
node_modules/
vendor/
.cargo/
# IDE files
.vscode/
.idea/
# Cache
.builder-cache/
# Logs
*.logFor large projects, watch only relevant targets:
# Watch frontend only
bldr build --watch //frontend:app
# Watch multiple targets
bldr build --watch //services/auth:api //services/users:apiAdd to .vscode/tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "Watch Build",
"type": "shell",
"command": "bldr",
"args": ["build", "--watch"],
"isBackground": true,
"problemMatcher": []
}
]
}FROM dlang/ldc
WORKDIR /app
COPY . .
RUN bldr build
CMD ["bldr", "build", "--watch"]- Check
.builderignorepatterns - Verify watcher is running (look for "Watching for changes..." message)
- Increase debounce delay:
--debounce=1000 - Check file permissions
Causes:
- Polling watcher active (install native watcher)
- Too many files being watched
- Debounce delay too short
Solutions:
- Install native watcher (
fswatchorinotify-tools) - Add build artifacts to
.builderignore - Watch specific targets only
- Use
--no-clearto preserve logs for debugging - Profile with
--verbose - Check cache hit rate (should be >80%)
# Watch React app
bldr build --watch //frontend:app# Watch Go API
bldr build --watch //backend:api# Watch and run tests
bldr watch "test --filter unit"bldr build --help- Build command optionsbldr test- Run tests