Introduction to Bazel


Course Number: BZL-100

Duration: 1 day (6.5 hours)

Format: Live, hands-on

Bazel Training Overview

Bazel is an open-source variant of Blaze, Google’s powerful internal build tool. Is this tool right for your organization? 

Accelebrate's Introduction to Bazel training explores the benefits, use cases, and fundamental concepts of Bazel using concrete Java-based of Bazel’s syntax and functionality. The class also introduces Bazel's advanced features, including remote caching and execution. After taking this class, students are able to implement this versatile, polyglot build tool in their projects.

Location and Pricing

This course is taught as a private, live online class for teams of 3 or more. All our courses are hands-on, instructor-led, and tailored to fit your group’s goals and needs. Most Accelebrate classes can be flexibly scheduled for your group, including delivery in half-day segments across a week or set of weeks. To receive a customized proposal and price quote for online corporate training, please contact us.

Objectives

  • Understand basic Bazel concepts
  • Automate typical tasks of a Java project

Prerequisites

  • User-level experience with build system concept and tools
  • A basic understanding of the Java programming language
  • Hands-on experience with common Java frameworks and dependencies

Outline

Expand All | Collapse All

Introduction to Bazel
  • What is Bazel?
  • Why Should I Use It?
    • Declarative Language
    • Reproducibility
    • Incremental Builds
    • Scalability
    • Parallel and Distributed Execution
    • Building Polyglot Projects
    • Extensibility
  • Installing the Bazel Runtime + Launcher
    • Runtime Installation Options
    • Using Bazelisk
  • Installing the Bazel Runtime
  • Project Structure and Basic Building Blocks
    • Project Building Blocks
    • Project Structure
    • Build Logic Concepts
  • Invoking a Target From the Command Line
    • Executing a Target
    • Commonly-Used Commands
    • Building the Whole Project
    • Output and Cache Directories
  • Bazel Quickstart
  • The Lifecycle of a Bazel Build
    • Lifecycle Phases
    • Bazel Configuration File
    • Programming Language Rules
Basic Automation for a Java Project
  • Exploring Java Rules
  • Setting up a Java Project and Building It
    • Sample Java Project
    • Modeling the Binary Package
    • Standard Industry Conventions
    • Modeling the Workspace
    • Running the Application
  • Running the Build from the Command Line
  • Building a “Hello World” Java Project
  • Inspecting the Generated Artifact
  • Launching and running the Java Project
  • Driving Bazel from the IDE
    • IntelliJ Plugin
    • VSCode Extension
    • Eclipse Plugin
  • Using Bazel in IntelliJ
Dependency Management and Automated Testing
  • Modeling Fine-Grained Package Granularity and Dependencies
    • Types of Dependencies
    • Multi-Package Project
    • Modeling the Library Package
    • Package Dependencies
    • Visibility of Targets
  • Declaring External Dependencies
    • What are External Dependencies?
    • Rules for JVM Dependencies
  • Declaring an External Library and Using it in the Code
  • Executing Automated Tests
    • Separating Test Source Code
    • Declaring Test Dependencies
    • Executing Tests
    • Test Reporting
  • Declaring the JUnit Dependency and Executing Tests
  • Publishing a JAR to a Maven repository
    • Sharing JAR for consumption from a binary repository
    • Command for publishing to the Maven Local directory
    • Command for publishing to a binary repository
  • Publishing a Java library to Maven Local
Outlook on Advanced Topics
  • Overview of Extension Concepts: Macros and Rules
    • Extension Mechanism
    • When are Macros and Rules Executed?
    • Starlark Build Language Overview
    • High Level: Writing and Using a Macro
    • High Level: Writing and Using a Genrule
    • High Level: Writing and Using a Rule
  • Writing and executing a genrule
  • Remote Caching and Execution
    • Motivation
    • Overview Remote Caching
    • Overview Remote Execution
  • Build Stamping
    • Workspace Status Information
    • Generating and appending custom information with a script
    • Including build information with an artifact
  • Bazel Query
    • Analyze build dependencies by an expression 
    • Transitive closure of dependencies: deps
    • Transitive closure of source dependencies: deps
    • Build files for packages: buildfiles(deps)
    • Finding reverse dependencies: rdeps
  • Java Toolchains
    • Java rules provide two toolchains
    • Discovering available Java runtime toolchains
    • Configuring JVM and Java compiler flags
    • Configuring toolchains in .bazelrc
    • Defining additional toolchains
Conclusion

Training Materials

All attendees receive a copy of the instructor’s presentation and related code.

Software Requirements



Learn faster

Our live, instructor-led lectures are far more effective than pre-recorded classes

Satisfaction guarantee

If your team is not 100% satisfied with your training, we do what's necessary to make it right

Learn online from anywhere

Whether you are at home or in the office, we make learning interactive and engaging

Multiple Payment Options

We accept check, ACH/EFT, major credit cards, and most purchase orders



Recent Training Locations

Alabama

Birmingham

Huntsville

Montgomery

Alaska

Anchorage

Arizona

Phoenix

Tucson

Arkansas

Fayetteville

Little Rock

California

Los Angeles

Oakland

Orange County

Sacramento

San Diego

San Francisco

San Jose

Colorado

Boulder

Colorado Springs

Denver

Connecticut

Hartford

DC

Washington

Florida

Fort Lauderdale

Jacksonville

Miami

Orlando

Tampa

Georgia

Atlanta

Augusta

Savannah

Hawaii

Honolulu

Idaho

Boise

Illinois

Chicago

Indiana

Indianapolis

Iowa

Cedar Rapids

Des Moines

Kansas

Wichita

Kentucky

Lexington

Louisville

Louisiana

New Orleans

Maine

Portland

Maryland

Annapolis

Baltimore

Frederick

Hagerstown

Massachusetts

Boston

Cambridge

Springfield

Michigan

Ann Arbor

Detroit

Grand Rapids

Minnesota

Minneapolis

Saint Paul

Mississippi

Jackson

Missouri

Kansas City

St. Louis

Nebraska

Lincoln

Omaha

Nevada

Las Vegas

Reno

New Jersey

Princeton

New Mexico

Albuquerque

New York

Albany

Buffalo

New York City

White Plains

North Carolina

Charlotte

Durham

Raleigh

Ohio

Akron

Canton

Cincinnati

Cleveland

Columbus

Dayton

Oklahoma

Oklahoma City

Tulsa

Oregon

Portland

Pennsylvania

Philadelphia

Pittsburgh

Rhode Island

Providence

South Carolina

Charleston

Columbia

Greenville

Tennessee

Knoxville

Memphis

Nashville

Texas

Austin

Dallas

El Paso

Houston

San Antonio

Utah

Salt Lake City

Virginia

Alexandria

Arlington

Norfolk

Richmond

Washington

Seattle

Tacoma

West Virginia

Charleston

Wisconsin

Madison

Milwaukee

Alberta

Calgary

Edmonton

British Columbia

Vancouver

Manitoba

Winnipeg

Nova Scotia

Halifax

Ontario

Ottawa

Toronto

Quebec

Montreal

Puerto Rico

San Juan