Bazel Multi-Language Build Training
Master multi-language builds with Bazel across Java, Go, Python, C++, TypeScript, Rust, Protobuf, and OCI container images in 3 days.
Build polyglot applications with Bazel's unified build graph spanning Java, Go, Python, C++, TypeScript, Rust, Protobuf, and OCI container images. This 3-day training covers language-specific rule sets, cross-language dependency patterns, auto-generation with Gazelle, and container image building without a Docker daemon.
Training Details
| Duration | 3 days (24 hours) |
| Level | Intermediate |
| Delivery | In-person, Live online, Hybrid |
| Certification | N/A |
Who Is This For?
- Backend engineers building services in multiple languages
- Platform engineers designing multi-language build infrastructure
- DevOps engineers automating polyglot CI/CD pipelines
- Tech leads managing repositories with mixed language stacks
- Build engineers integrating new languages into existing Bazel workspaces
Learning Outcomes
After completing this training, participants will be able to:
- Configure and use rules_java, rules_go, rules_python, rules_cc, rules_js, and rules_rust
- Auto-generate BUILD files for Go projects using Gazelle
- Manage language-specific dependency resolution (Maven, pip, Go modules, crate_universe)
- Compile Protocol Buffers and generate language-specific stubs with rules_proto
- Build OCI container images from Bazel without requiring a Docker daemon
- Design cross-language dependency patterns within a unified build graph
Detailed Agenda
Day 1: JVM, Go, and Python Ecosystems
Module 1: Java Ecosystem with rules_java
- java_library, java_binary, java_test: target definitions and attributes
- java_plugin and java_proto_library for annotation processing and proto generation
- Resource files with resources and resource_strip_prefix
- Configuring JDK toolchains: remote_java_repository, local_jdk
- rules_jvm_external: maven_install, artifact pinning, lock files
- Hands-on: Build a Java microservice with Maven dependencies, annotation processing, and JUnit 5 tests
Module 2: Go Ecosystem with rules_go and Gazelle
- go_library, go_binary, go_test: target definitions and conventions
- go_repository and module-based dependency management
- Gazelle: automatic BUILD file generation from Go source code
- gazelle:update, gazelle:fix directives and configuration
- Integration with Go modules: go.mod/go.sum as source of truth
- Hands-on: Initialize a Go project, run Gazelle to generate BUILD files, add external dependencies
Module 3: Python Ecosystem with rules_python
- py_library, py_binary, py_test: target definitions and imports
- pip.parse for requirements.txt-based dependency management
- Python toolchain configuration: hermetic Python interpreter
- Managing multiple Python versions with python_register_toolchains
- pytest integration and py_test customization with args and env
- Hands-on: Build a Python application with pip dependencies, configure hermetic Python, run pytest-based tests
Module 4: Cross-Language Interop Patterns
- Depending on cc_library from py_binary via Python C extensions
- Shared data files with filegroup across language boundaries
- genrule for code generation consumed by multiple languages
- Combining languages in a single package vs separate packages
- Build graph ordering and execution parallelism across languages
- Hands-on: Build a project where Python calls a C++ native extension built by Bazel
Day 2: C++, TypeScript, Rust, and Protobuf
Module 5: C++ Toolchain with rules_cc
- cc_library, cc_binary, cc_test: headers, srcs, deps, and linkage
- copts, linkopts, defines for compiler and linker flags
- Header-only libraries with hdrs and include_prefix
- Configuring C++ toolchains: cc_toolchain_config, cc_toolchain_suite
- Sanitizers integration: --features=asan, tsan, ubsan
- Hands-on: Build a C++ library with custom compiler flags, header namespacing, and address sanitizer enabled
Module 6: TypeScript and JavaScript with rules_js
- js_library, js_binary, js_test: Node.js target definitions
- npm_translate_lock: pnpm-lock.yaml to Bazel repository rules
- TypeScript compilation with ts_project and tsconfig.json integration
- Bundling with esbuild, rollup, or webpack Bazel rules
- Managing node_modules: virtual store vs linker strategies
- Hands-on: Build a TypeScript Node.js application with npm dependencies and esbuild bundling
Module 7: Rust Ecosystem with rules_rust
- rust_library, rust_binary, rust_test: target definitions and editions
- crate_universe: generating Bazel targets from Cargo.toml and Cargo.lock
- crates_repository and crate.spec for dependency pinning
- Rust toolchain registration and cross-compilation support
- Clippy integration with rust_clippy and rustfmt with rustfmt_test
- Hands-on: Build a Rust CLI application with crate_universe dependencies, run clippy and rustfmt checks
Module 8: Protobuf Cross-Language Compilation
- proto_library: defining language-agnostic proto targets
- java_proto_library, go_proto_library, py_proto_library: language-specific code generation
- gRPC integration: java_grpc_library, go_grpc_library with service stubs
- Managing proto dependencies: well-known types, google.protobuf imports
- Proto descriptor sets and custom protoc plugins
- Hands-on: Define a proto service, generate stubs for Java, Go, and Python, verify cross-language type compatibility
Day 3: Containers, Integration, and Monorepo Design
Module 9: OCI Container Images with rules_oci
- oci_image: building container images without Docker daemon
- oci_image layers, base images, and entrypoint configuration
- oci_push for publishing to registries (Docker Hub, GCR, ECR, GHCR)
- oci_tarball for local Docker-compatible image loading
- Multi-architecture image builds with oci_image_index
- Hands-on: Build OCI images for a Go binary and a Java application, push to a local registry
Module 10: Language Integration Patterns
- Polyglot service communication via gRPC and shared proto definitions
- Shared configuration files across language boundaries
- Test data sharing with exports_files and filegroup
- Build-time code generation consumed by multiple languages
- Macro patterns for reducing boilerplate in multi-language packages
- Hands-on: Build an integration test that exercises Go, Python, and Java services communicating via gRPC
Module 11: Multi-Language Monorepo Design
- Directory structure patterns for polyglot repositories
- Package naming conventions and visibility boundaries
- Shared third-party dependency management across languages
- Consistent test execution: size, timeout, and tag conventions
- Documentation generation from multiple language sources
- Hands-on: Design and implement a monorepo layout with Java API, Go workers, Python ML pipeline, and shared protos
Module 12: Capstone — Full-Stack Polyglot Build
- End-to-end multi-language application architecture
- Dependency graph analysis with bazel query across languages
- Build performance optimization for polyglot builds
- Continuous integration considerations for multi-language repos
- Migration planning: incrementally adding languages to a Bazel workspace
- Hands-on: Capstone project — build a complete polyglot application with Java REST API, Go background workers, Python data processing, shared Protobuf contracts, and OCI container images for each service
Prerequisites
- Bazel Fundamentals training or equivalent hands-on experience
- Familiarity with at least two of: Java, Go, Python, C++, TypeScript, Rust
- Understanding of BUILD files, labels, and dependency declarations
- Experience with at least one package manager (Maven, pip, Go modules, npm, or Cargo)
Delivery Formats
| Format | Description |
|---|---|
| In-Person | On-site at your company's location, hands-on with direct interaction |
| Live Online | Interactive virtual sessions with screen sharing and real-time labs |
| Hybrid | Combination of on-site and remote sessions, flexible scheduling |
All formats include hands-on labs, course materials, and post-training support.
Prerequisites
- Bazel Fundamentals or equivalent experience
- Familiarity with at least two programming languages
Ready to get started?
Request a training quote for your team — in-person, live-online, or hybrid.