diff --git a/upstream b/upstream
index 37654e56..a0bb2eed 160000
--- a/upstream
+++ b/upstream
@@ -1 +1 @@
-Subproject commit 37654e56598027f1f65bf729d604a600786dd8e9
+Subproject commit a0bb2eedde841cff8b75ae5965de851d2403da69
diff --git a/versions/9.1.0/basics/task-based-builds.mdx b/versions/9.1.0/basics/task-based-builds.mdx
index a0fe9fb2..b5a3d46a 100644
--- a/versions/9.1.0/basics/task-based-builds.mdx
+++ b/versions/9.1.0/basics/task-based-builds.mdx
@@ -23,32 +23,32 @@ Take this example from the
+
Acqio is a Fintech that provides payment products and services for small and
medium merchants. Acqio has a handful of monorepos and uses Bazel along with
Kubernetes to deliver fast and reliable microservices.
-### [Adobe](https://www.adobe.com/){: .external}
+### [Adobe](https://www.adobe.com/)
-
+
-Adobe has released Bazel [rules](https://github.com/adobe/rules_gitops){: .external} for
+Adobe has released Bazel [rules](https://github.com/adobe/rules_gitops) for
continuous, GitOps driven Kubernetes deployments.
-### [Asana](https://asana.com){: .external}
+### [Asana](https://asana.com)
-
+
Asana is a web and mobile application designed to help teams track their work.
In their own words:
@@ -41,32 +41,32 @@ at Asana. We no longer need to clean because of incorrect caches.
Ascend is a Palo Alto startup that offers solutions for large data sets
analysis. Their motto is _Big data is hard. We make it easy_.
-### [ASML](https://asml.com){: .external}
+### [ASML](https://asml.com)
-
+
ASML is an innovation leader in the semiconductor industry. We provide chipmakers
with everything they need – hardware, software and services – to mass produce
patterns on silicon through lithography.
-### [Beeswax](https://www.beeswax.com/){: .external}
+### [Beeswax](https://www.beeswax.com/)
> Beeswax is a New York based startup that provides real time bidding as
service. Bazel powers their Jenkins based continuous integration and deployment
framework. Beeswax loves Bazel because it is blazingly fast, correct and well
supported across many languages and platforms.
-### [Braintree](https://www.braintreepayments.com){: .external}
+### [Braintree](https://www.braintreepayments.com)
-
+
Braintree, a PayPal subsidiary, develops payment solutions for websites and
applications. They use Bazel for parts of their internal build and Paul Gross
even posted a
[nice piece about how their switch to Bazel went](https://www.pgrs.net/2015/09/01/migrating-from-gradle-to-bazel/).
-### [Canva](https://www.canva.com/){: .external}
-
+### [Canva](https://www.canva.com/)
+
Canva leverages Bazel to manage its large polyglot codebase, which includes
Java, TypeScript, Scala, Python, and more. Migration to Bazel has delivered
@@ -74,21 +74,21 @@ significant developer and compute infrastructure efficiencies, for example 5-6x
decreases in average CI build times, and it continues to become the foundation
of fast, reproducible, and standardised software builds at the company.
-### [CarGurus](https://www.cargurus.com){: .external}
-
+### [CarGurus](https://www.cargurus.com)
+
CarGurus is on a mission to build the world's most trusted and transparent
automotive marketplace and uses Bazel to build their polyglot monorepo.
-### [Compass](https://www.compass.com){: .external}
+### [Compass](https://www.compass.com)
Compass is a tech-driven real estate platform. With an elite team of real
estate, technology and business professionals, we aim to be the best and most
trusted source for home seekers.
-### [Databricks](https://databricks.com){: .external}
+### [Databricks](https://databricks.com)
-
+
Databricks provides cloud-based integrated workspaces based on Apache Spark™.
> The Databricks codebase is a Monorepo, containing the Scala code that powers
@@ -98,32 +98,32 @@ monorepo contains a million lines of Scala, working with code within is fast
and snappy.
([Speedy Scala Builds with Bazel at Databricks](https://databricks.com/blog/2019/02/27/speedy-scala-builds-with-bazel-at-databricks.html))
-### [Dataform](https://dataform.co){: .external}
+### [Dataform](https://dataform.co)
Dataform provides scalable analytics for data teams. They maintain a handful of
NPM packages and a documentation site in one single monorepo and they do it all
with Bazel.
After the migration to Bazel, they
-[reported many benefits](https://github.com/bazelbuild/rules_nodejs#user-testimonials){: .external},
+[reported many benefits](https://github.com/bazelbuild/rules_nodejs#user-testimonials),
including:
> * Faster CI: we enabled the remote build caching which has reduced our average build time from 30 minutes to 5 (for the entire repository).
> * Improvements to local development: no more random bash scripts that you forget to run, incremental builds reduced to seconds from minutes
> * Developer setup time: New engineers can build all our code with just 3 dependencies - bazel, docker and the JVM. The last engineer to join our team managed to build all our code in < 30 minutes on a brand new, empty laptop
-### [Deep Silver FISHLABS](https://www.dsfishlabs.com){: .external}
+### [Deep Silver FISHLABS](https://www.dsfishlabs.com)
Deep Silver FISHLABS is a developer of high-end 3D games. They use Bazel with
C++/Python/Go/C as a base for their internal build tooling and especially for
baking and deploying all their 3D Assets.
-### [Dropbox](https://www.dropbox.com/){: .external}
-
+### [Dropbox](https://www.dropbox.com/)
+
At Dropbox, Bazel is a key component to our distributed build and test
environment. We use Bazel to combine TypeScript/Python/Go/C/Rust into reliable
production releases.
-### [Engel & Völkers](https://www.engelvoelkers.com){: .external}
+### [Engel & Völkers](https://www.engelvoelkers.com)
Engel & Völkers AG is a privately owned German company that, via a series of
franchised offices, provides services related to real estate transactions.
@@ -131,10 +131,10 @@ franchised offices, provides services related to real estate transactions.
> One of our internal project has seen a decrease of compilation time from 11
minutes to roughly 1 minute, this was an impressive achievement and we are
currently working on bringing Bazel to more projects.
-([Experimenting with Google Cloud Build and Bazel](https://www.engelvoelkers.com/en/tech/engineering/software-engineering/experimenting-with-google-cloud-build-and-bazel/)){: .external}
+([Experimenting with Google Cloud Build and Bazel](https://www.engelvoelkers.com/en/tech/engineering/software-engineering/experimenting-with-google-cloud-build-and-bazel/))
-### [Etsy](https://www.etsy.com/){: .external}
-
+### [Etsy](https://www.etsy.com/)
+
Etsy is an e-commerce website focused on handmade or vintage items and supplies,
as well as unique factory-manufactured items.
@@ -142,24 +142,24 @@ as well as unique factory-manufactured items.
They use Bazel to build and test its Java-based search platform. Bazel produces
both packages for bare metal servers and repeatable Docker images.
-### [Evertz.io](https://www.evertz.io/){: .external}
+### [Evertz.io](https://www.evertz.io/)
Evertz.io is a multi-tenant, serverless SaaS platform for offering cost
effective, multi-regional services worldwide to the Broadcast Media Industry,
created by [Evertz Microsystems](https://en.wikipedia.org/wiki/Evertz_Microsystems).
The website is fully built and deployed with an Angular and Bazel workflow
-([source](https://twitter.com/MattMackay/status/1113947685508341762){: .external}).
+([source](https://twitter.com/MattMackay/status/1113947685508341762)).
-### [FINDMINE](http://www.findmine.com){: .external}
-
+### [FINDMINE](http://www.findmine.com)
+
FINDMINE is a automation technology for the retail industry that uses machine
learning to scale the currently manual and tedious process of product curation.
We use Bazel to mechanize our entire python package building, testing, and
deployment process.
-### [Flexport](https://www.flexport.com/){: .external}
+### [Flexport](https://www.flexport.com/)
Flexport is a tech-enabled global freight forwarder; our mission is to make
global trade easier for everyone. At Flexport, we use Bazel to build/test our
@@ -167,8 +167,8 @@ Java/JavaScript services and client libraries and to generate Java and Ruby
code from protobuf definitions.
[Read about how we run individual JUnit 5 tests in isolation with Bazel.](https://flexport.engineering/connecting-bazel-and-junit5-by-transforming-arguments-46440c6ea068)
-### [Foursquare](https://foursquare.com){: .external}
-
+### [Foursquare](https://foursquare.com)
+
Foursquare's mission is to create technology that constructs meaningful
bridges between digital spaces and physical places. We manage millions of
@@ -176,45 +176,45 @@ lines of primarily Scala and Python code powering data-intensive
applications, including complex codegen and container build processes, with
Bazel.
-### [GermanTechJobs](https://germantechjobs.de){: .external}
-
+### [GermanTechJobs](https://germantechjobs.de)
+
Bazel has simplified our workflows 10-fold and enabled shipping features at
scale.
-### [Google](https://google.com){: .external}
-
+### [Google](https://google.com)
+
Bazel was designed to be able to scale to Google's needs and meet Google's
requirements of reproducibility and platform/language support. All software at
Google is built using Bazel. Google uses Bazel and its rules for millions of
builds every day.
-### [Huawei](http://www.huawei.com/){: .external}
+### [Huawei](http://www.huawei.com/)
> Huawei Technologies is using Bazel in about 30 projects, they are Java/Scala/Go
projects, except for Go projects, others originally were built by Maven. We
write a simple tool to translate a Maven-built project into Bazel-built one.
More and more projects will use Bazel in recent future.
-### [IMC Trading](https://imc.com){: .external}
-
+### [IMC Trading](https://imc.com)
+
> IMC is a global proprietary trading firm and market maker headquarted in
Amsterdam. We are using Bazel to continuously build and test our
Java/C++/Python/SystemVerilog projects.
-### [Improbable.io](https://improbable.io/){: .external}
+### [Improbable.io](https://improbable.io/)
Improbable.io develops SpatialOS, a distributed operating system that enables
creating huge simulations inhabited by millions of complex entities.
-### [Interaxon](https://www.choosemuse.com/){: .external}
+### [Interaxon](https://www.choosemuse.com/)
InteraXon is a thought-controlled computing firm that creates hardware and
software platforms to convert brainwaves into digital signals.
-### [Jupiter](https://jupiter.co/){: .external}
+### [Jupiter](https://jupiter.co/)
Jupiter is a company that provides delivery of groceries and household
essentials every week.
@@ -223,7 +223,7 @@ They use Bazel in their backend code, specifically to compile protos and Kotlin
to JVM binaries, using remote caching.
([source](https://starship.jupiter.co/jupiter-stack/))
-### [Just](https://gojust.com/){: .external}
+### [Just](https://gojust.com/)
Just is an enterprise financial technology company, headquartered in Norway,
creating software solutions to transform how global corporate treasurers manage
@@ -235,29 +235,29 @@ Line provides an app for instant communications, which is the most popular
messaging application in Japan.
They use Bazel on their codebase consisting of about 60% Swift and 40%
C/C++/Objective-C/Objective-C++
-([source](https://twitter.com/thi_dt/status/1253334262020886532){: .external}).
+([source](https://twitter.com/thi_dt/status/1253334262020886532)).
> After switching to Bazel, we were able to achieve a huge improvement in the
build times. This brought a significant improvement in the turn-around time
during a QA period. Distributing a new build to our testers no longer means
another hour waiting for building and testing.
-([Improving Build Performance of LINE for iOS with Bazel](https://engineering.linecorp.com/en/blog/improving-build-performance-line-ios-bazel/){: .external})
+([Improving Build Performance of LINE for iOS with Bazel](https://engineering.linecorp.com/en/blog/improving-build-performance-line-ios-bazel/))
-### [LingoChamp](https://www.liulishuo.com/en){: .external}
+### [LingoChamp](https://www.liulishuo.com/en)
-
+
LingoChamp provides professional solutions to English learners. We use Bazel
for our go, java and python projects.
-### [LinkedIn](https://linkedin.com/){: .external}
+### [LinkedIn](https://linkedin.com/)
-
+
LinkedIn, a subsidiary of Microsoft, is the world’s largest professional social
network. LinkedIn uses Bazel for building its iOS Apps.
-### [Lucid Software](https://lucid.co/){: .external}
+### [Lucid Software](https://lucid.co/)
-
+
Lucid Software is a leader in visual collaboration, helping teams see and build the
future from idea to reality. With its products—[Lucidchart](https://www.lucidchart.com/),
@@ -271,35 +271,35 @@ dependencies on the build environment, and simplified developers' experience
with the build system. Bazel has improved developer productivity at Lucid and
unlocked further growth.
-### [Lyft](https://www.lyft.com/){: .external}
+### [Lyft](https://www.lyft.com/)
Lyft is using Bazel for their iOS ([source](https://twitter.com/SmileyKeith/status/1116486751806033920)) and Android Apps.
-### [Meetup](http://www.meetup.com/){: .external}
+### [Meetup](http://www.meetup.com/)
Meetup is an online social networking portal that facilitates offline group
meetings.
The Meetup engineering team contributes to
-[rules_scala](https://github.com/bazelbuild/rules_scala){: .external} and is the
-maintainer of [rules_avro](https://github.com/meetup/rules_avro){: .external}
-and [rules_openapi](https://github.com/meetup/rules_openapi){: .external}.
+[rules_scala](https://github.com/bazelbuild/rules_scala) and is the
+maintainer of [rules_avro](https://github.com/meetup/rules_avro)
+and [rules_openapi](https://github.com/meetup/rules_openapi).
-### [Nvidia](https://www.nvidia.com/){: .external}
+### [Nvidia](https://www.nvidia.com/)
> At Nvidia we have been using dazel(docker bazel) for python to work around
some of bazel's python short comings. Everything else runs in normal bazel
(Mostly Go / Scala/ C++/ Cuda)
-([source](https://twitter.com/rwhitcomb/status/1080887723433447424){: .external})
+([source](https://twitter.com/rwhitcomb/status/1080887723433447424))
-### [Peloton Technology](http://www.peloton-tech.com){: .external}
+### [Peloton Technology](http://www.peloton-tech.com)
Peloton Technology is an automated vehicle technology company that tackles truck
accidents and fuel use. They use Bazel to _enable reliable builds for automotive
safety systems_.
-### [Pigweed](https://pigweed.dev){: .external}
+### [Pigweed](https://pigweed.dev)
-
+
Pigweed is an open-source solution for sustained, robust, and rapid embedded
product development for large teams. Pigweed has shipped in millions of
@@ -314,9 +314,9 @@ system for embedded projects!
[pw-bazel-great]: https://blog.bazel.build/2024/08/08/bazel-for-embedded.html#why-bazel-for-embedded
-### [Pinterest](https://www.pinterest.com/){: .external}
+### [Pinterest](https://www.pinterest.com/)
-
+
Pinterest is the world’s catalog of ideas. They use Bazel to build various
backend services (Java/C++) and the iOS application (Objective-C/C++).
@@ -327,19 +327,19 @@ build environments and adopt incrementally. As a result, we’re now shipping al
our iOS releases using Bazel.
[Developing fast & reliable iOS builds at Pinterest](https://medium.com/@Pinterest_Engineering/developing-fast-reliable-ios-builds-at-pinterest-part-one-cb1810407b92)
-### [PubRef](https://github.com/pubref){: .external}
+### [PubRef](https://github.com/pubref)
PubRef is an emerging scientific publishing platform. They use Bazel with
-[rules_closure](https://github.com/bazelbuild/rules_closure){: .external} to build the
+[rules_closure](https://github.com/bazelbuild/rules_closure) to build the
frontend, native java rules to build the main backend,
-[rules_go](https://github.com/bazelbuild/rules_go){: .external},
-[rules_node](https://github.com/pubref/rules_node){: .external}, and
-[rules_kotlin](https://github.com/pubref/rules_kotlin){: .external} to build assorted
-backend services. [rules_protobuf](https://github.com/pubref/rules_protobuf){: .external} is
+[rules_go](https://github.com/bazelbuild/rules_go),
+[rules_node](https://github.com/pubref/rules_node), and
+[rules_kotlin](https://github.com/pubref/rules_kotlin) to build assorted
+backend services. [rules_protobuf](https://github.com/pubref/rules_protobuf) is
used to assist with gRPC-based communication between backend services.
PubRef.org is based in Boulder, CO.
-### [Redfin](https://redfin.com/){: .external}
+### [Redfin](https://redfin.com/)
Redfin is a next-generation real estate brokerage with full-service local
agents. They use Bazel to build and deploy the website and various backend
services.
@@ -352,32 +352,32 @@ quantify, but the shift from unexplained build failures being something that
virtuous cycle of ever-increasing reliability.
([We Switched from Maven to Bazel and Builds Got 10x Faster](https://redfin.engineering/we-switched-from-maven-to-bazel-and-builds-got-10x-faster-b265a7845854))
-### [Ritual](https://ritual.co){: .external}
-
+### [Ritual](https://ritual.co)
+
Ritual is a mobile pick up app, connecting restaurants with customers to offer
a simple, time-saving tool to get the food and beverages they want, without the
wait. Ritual uses Bazel for their backend services.
-### [Snap](https://www.snap.com/en-US/){: .external}
+### [Snap](https://www.snap.com/en-US/)
Snap, the developer of Snapchat messaging app, has migrated from Buck to Bazel
-in 2020 ([source](https://twitter.com/wew/status/1326957862816509953){: .external}). For more
-details about their process, see their [engineering blog](https://eng.snap.com/blog/){: .external}.
+in 2020 ([source](https://twitter.com/wew/status/1326957862816509953)). For more
+details about their process, see their [engineering blog](https://eng.snap.com/blog/).
-### [Stripe](https://stripe.com){: .external}
-
+### [Stripe](https://stripe.com)
+
-Stripe provides mobile payment solutions. They use Bazel in their build and test pipelines, as detailed in their [engineering blog](https://stripe.com/blog/fast-secure-builds-choose-two){: .external}.
+Stripe provides mobile payment solutions. They use Bazel in their build and test pipelines, as detailed in their [engineering blog](https://stripe.com/blog/fast-secure-builds-choose-two).
-### [Tinder](https://tinder.com){: .external}
-
+### [Tinder](https://tinder.com)
+
Tinder migrated its iOS app from CocoaPods to Bazel
-in 2021 ([source](https://medium.com/tinder/bazel-hermetic-toolchain-and-tooling-migration-c244dc0d3ae){: .external}).
+in 2021 ([source](https://medium.com/tinder/bazel-hermetic-toolchain-and-tooling-migration-c244dc0d3ae)).
-### [Tink](https://tink.com/){: .external}
-
+### [Tink](https://tink.com/)
+
Tink is a european fintech, building the best way to connect to banks across
Europe.
@@ -386,7 +386,7 @@ They are using Bazel to build their backend services from a polyglot monorepo.
Engineers at Tink are organizing the [bazel build //stockholm/...](https://www.meetup.com/BazelSTHLM/)
meetup group.
-### [Tokopedia](https://www.tokopedia.com/){: .external}
+### [Tokopedia](https://www.tokopedia.com/)
Tokopedia is an Indonesian technology company specializing in e-commerce, with
over 90 million monthly active users and over 7 million merchants on the
@@ -398,27 +398,27 @@ where they explain how Bazel sped up their builds. The build duration went from
55 minutes to 10 minutes by using Bazel, and down to 5 minutes with remote
caching.
-### [Trunk.io](https://trunk.io/merge/trunk-merge-and-bazel){: .external}
-
+### [Trunk.io](https://trunk.io/merge/trunk-merge-and-bazel)
+
Trunk is a San Francisco-based company backed by Andreessen Horowitz and Initialized Capital. Trunk offers a powerful pull request merge service with first-class support for the Bazel build system. By leveraging Bazel's understanding of dependencies within a codebase, Trunk's merge service intelligently creates parallel merge lanes, allowing independent changes to be tested and merged simultaneously.
> Trunk’s internal monorepo builds modern C++ 20 and typescript all while leveraging bazel graph knowledge to selectively test and merge code.
-### [Twitter](https://twitter.com/){: .external}
+### [Twitter](https://twitter.com/)
Twitter has made the decision to migrate from Pants to Bazel as their primary
build tool
([source](https://groups.google.com/forum/#!msg/pants-devel/PHVIbVDLhx8/LpSKIP5cAwAJ)).
-### [Two Sigma](https://www.twosigma.com/){: .external}
-
+### [Two Sigma](https://www.twosigma.com/)
+
Two Sigma is a New York-headquartered technology company dedicated to finding
value in the world’s data.
-### [TypeDB](https://typedb.com){: .external}
-
+### [TypeDB](https://typedb.com)
+
TypeDB is a database technology that can be used to intuitively model
interconnected data. Through its type-theoretic and polymorphic query language,
@@ -430,32 +430,32 @@ pipeline that manages many repositories in a wide variety of languages, and
deploys to numerous platforms seamlessly. The TypeDB team has also released
Bazel rules for assembling and deploying software distributions.
-### [Uber](https://www.uber.com){: .external}
+### [Uber](https://www.uber.com)
Uber is a ride-hailing company. With 900 active developers, Uber’s Go monorepo
is likely one of the largest Go repositories using Bazel. See the article
[Building Uber’s Go Monorepo with Bazel](https://eng.uber.com/go-monorepo-bazel/)
to learn more about their experience.
-### [Uber Advanced Technologies Group](https://www.uber.com/info/atg/){: .external}
-
+### [Uber Advanced Technologies Group](https://www.uber.com/info/atg/)
+
Uber Advanced Technologies Group is focused on autonomous vehicle efforts at
Uber, including trucking/freight and autonomous ride sharing. The organization
uses Bazel as its primary build system.
-### [Vistar Media](http://vistarmedia.com){: .external}
+### [Vistar Media](http://vistarmedia.com)
Vistar Media is an advertising platform that enables brands to reach consumers
based on their behavior in the physical world. Their engineering team is
primarily based out of Philadelphia and is using Bazel for builds, deploys, to
speed up testing, and to consolidate repositories written with a variety of
different technologies.
-### [VMware](https://www.vmware.com/){: .external}
+### [VMware](https://www.vmware.com/)
VMware uses Bazel to produce deterministic, reliable builds while developing
innovative products for their customers.
-### [Wix](https://www.wix.com/){: .external}
+### [Wix](https://www.wix.com/)
Wix is a cloud-based web development platform. Their backend uses Java and Scala
code. They use remote execution with Google Cloud Build.
@@ -465,25 +465,25 @@ execution which utilizes bazel’s great build/test parallelism capabilities whe
it dispatches build/test actions to a worker farm. Average build times are more
than 10 times faster due to the utilization of bazel’s aggressive caching
mechanism.
-([Migrating to Bazel from Maven or Gradle? 5 crucial questions you should ask yourself](https://medium.com/wix-engineering/migrating-to-bazel-from-maven-or-gradle-5-crucial-questions-you-should-ask-yourself-f23ac6bca070){: .external})
+([Migrating to Bazel from Maven or Gradle? 5 crucial questions you should ask yourself](https://medium.com/wix-engineering/migrating-to-bazel-from-maven-or-gradle-5-crucial-questions-you-should-ask-yourself-f23ac6bca070))
-### [Zenly](https://zen.ly/){: .external}
+### [Zenly](https://zen.ly/)
Zenly is a live map of your friends and family. It’s the most fun way to meet up
— or just see what’s up! — so you can feel together, even when you're apart.
***
-## Open source projects using Bazel {:#open-source-projects-using-Bazel}
+## Open source projects using Bazel {#open-source-projects-using-Bazel}
-### [Abseil](https://abseil.io/){: .external}
+### [Abseil](https://abseil.io/)
Abseil is an open-source collection of C++ code (compliant to C++11) designed
to augment the C++ standard library.
-### [Angular](https://angular.io){: .external}
+### [Angular](https://angular.io)
-
+
Angular is a popular web framework.
Angular is [built with Bazel](https://github.com/angular/angular/blob/master/docs/BAZEL.md).
@@ -493,165 +493,165 @@ Angular is [built with Bazel](https://github.com/angular/angular/blob/master/doc
Apollo is a high performance, flexible architecture which accelerates the
development, testing, and deployment of Autonomous Vehicles.
-### [brpc](https://github.com/brpc/brpc){: .external}
+### [brpc](https://github.com/brpc/brpc)
An industrial-grade RPC framework used throughout Baidu, with 1,000,000+
instances(not counting clients) and thousands kinds of services, called
"baidu-rpc" inside Baidu.
-### [cert-manager](https://github.com/jetstack/cert-manager){: .external}
+### [cert-manager](https://github.com/jetstack/cert-manager)
cert-manager is a Kubernetes add-on to automate the management and issuance of
TLS certificates from various issuing sources. It will ensure certificates are
valid and up to date periodically, and attempt to renew certificates at an
appropriate time before expiry.
-### [CallBuilder](https://github.com/google/CallBuilder){: .external}
+### [CallBuilder](https://github.com/google/CallBuilder)
A Java code generator that allows you to create a builder by writing one
function.
-### [CPPItertools](https://github.com/ryanhaining/cppitertools){: .external}
+### [CPPItertools](https://github.com/ryanhaining/cppitertools)
C++ library providing range-based for loop add-ons inspired by the Python
builtins and itertools library. Like itertools and the Python3 builtins, this
library uses lazy evaluation wherever possible.
-### [Copybara](https://github.com/google/copybara){: .external}
+### [Copybara](https://github.com/google/copybara)
Copybara is a tool for transforming and moving code between repositories.
-### [Dagger](https://google.github.io/dagger/){: .external}
+### [Dagger](https://google.github.io/dagger/)
Dagger is a fully static, compile-time dependency injection framework for both
Java and Android.
-### [DAML](https://github.com/digital-asset/daml){: .external}
+### [DAML](https://github.com/digital-asset/daml)
DAML is a smart contract language for building future-proof distributed
applications on a safe, privacy-aware runtime.
-### [DeepMind Lab](https://github.com/deepmind/lab){: .external}
+### [DeepMind Lab](https://github.com/deepmind/lab)
A customisable 3D platform for agent-based AI research.
-### [Drake](https://github.com/RobotLocomotion/drake){: .external}
+### [Drake](https://github.com/RobotLocomotion/drake)
Drake is a C++ toolbox started at MIT and now led by the Toyota Research
Institute. It is a collection of tools for analyzing the dynamics of our robots
and building control systems for them, with a heavy emphasis on
optimization-based design/analysis.
-### [Envoy](https://github.com/lyft/envoy){: .external}
+### [Envoy](https://github.com/lyft/envoy)
C++ L7 proxy and communication bus
-### [Error Prone](https://github.com/google/error-prone){: .external}
+### [Error Prone](https://github.com/google/error-prone)
Catches common Java mistakes as compile-time errors. (Migration to Bazel is in
progress.)
-### [Extensible Service Proxy](https://github.com/cloudendpoints/esp){: .external}
+### [Extensible Service Proxy](https://github.com/cloudendpoints/esp)
Extensible Service Proxy, a.k.a. ESP is a proxy which enables API management
capabilities for JSON/REST or gRPC API services. The current implementation is
based on an NGINX HTTP reverse proxy server.
-### [FFruit](https://gitlab.com/perezd/ffruit/){: .external}
+### [FFruit](https://gitlab.com/perezd/ffruit/)
FFruit is a free & open source Android application to the popular service
-[Falling Fruit](https://fallingfruit.org){: .external}.
+[Falling Fruit](https://fallingfruit.org).
-### [Gerrit Code Review](https://gerritcodereview.com){: .external}
+### [Gerrit Code Review](https://gerritcodereview.com)
Gerrit is a code review and project management tool for Git based projects.
-### [Gitiles](https://gerrit.googlesource.com/gitiles/){: .external}
+### [Gitiles](https://gerrit.googlesource.com/gitiles/)
Gitiles is a simple repository browser for Git repositories, built on JGit.
-### [Grakn](https://github.com/graknlabs/grakn){: .external}
+### [Grakn](https://github.com/graknlabs/grakn)
Grakn (https://grakn.ai/) is the knowledge graph engine to organise complex
networks of data and make it queryable.
-### [GRPC](http://www.grpc.io){: .external}
+### [GRPC](http://www.grpc.io)
A language-and-platform-neutral remote procedure call system.
(Bazel is a supported, although not primary, build system.)
-### [gVisor](https://github.com/google/gvisor){: .external}
+### [gVisor](https://github.com/google/gvisor)
gVisor is a container runtime sandbox.
-### [Guetzli](https://github.com/google/guetzli/){: .external}
+### [Guetzli](https://github.com/google/guetzli/)
Guetzli is a JPEG encoder that aims for excellent compression density at high
visual quality.
-### [Gulava](http://www.github.com/google/gulava/){: .external}
+### [Gulava](http://www.github.com/google/gulava/)
A Java code generator that lets you write Prolog-style predicates and use them
seamlessly from normal Java code.
-### [Heron](https://github.com/apache/incubator-heron){: .external}
+### [Heron](https://github.com/apache/incubator-heron)
Heron is a realtime, distributed, fault-tolerant stream processing engine from
Twitter.
-### [Internet Computer Protocol](https://internetcomputer.org/){: .external}
+### [Internet Computer Protocol](https://internetcomputer.org/)
-
+
The Internet Computer Protocol is a publicly available blockchain network that
enables replicated execution of general-purpose computation, serving hundreds
of thousands of applications and their users.
-### [Jazzer](https://github.com/CodeIntelligenceTesting/jazzer){: .external}
+### [Jazzer](https://github.com/CodeIntelligenceTesting/jazzer)
-
+
Jazzer is a fuzzer for Java and other JVM-based languages that integrates with JUnit 5.
-### [JGit](https://eclipse.org/jgit/){: .external}
+### [JGit](https://eclipse.org/jgit/)
JGit is a lightweight, pure Java library implementing the Git version control
system.
-### [Jsonnet](https://jsonnet.org/){: .external}
+### [Jsonnet](https://jsonnet.org/)
An elegant, formally-specified config generation language for JSON.
(Bazel is a supported build system.)
-### [Kubernetes](https://github.com/kubernetes/kubernetes){: .external}
+### [Kubernetes](https://github.com/kubernetes/kubernetes)
-
+
Kubernetes is an open source system for managing containerized applications
across multiple hosts, providing basic mechanisms for deployment, maintenance,
and scaling of applications.
-### [Kythe](https://github.com/google/kythe){: .external}
+### [Kythe](https://github.com/google/kythe)
An ecosystem for building tools that work with code.
-### [ls-lint](https://github.com/loeffel-io/ls-lint){: .external}
+### [ls-lint](https://github.com/loeffel-io/ls-lint)
-
+
An extremely fast directory and filename linter - Bring some structure to your
project file system.
-### [Nomulus](https://github.com/google/nomulus){: .external}
+### [Nomulus](https://github.com/google/nomulus)
Top-level domain name registry service on Google App Engine.
-### [ONOS : Open Network Operating System](https://github.com/opennetworkinglab/onos){: .external}
+### [ONOS : Open Network Operating System](https://github.com/opennetworkinglab/onos)
-
+
ONOS is the only SDN controller platform that supports the transition from
legacy “brown field” networks to SDN “green field” networks. This enables
exciting new capabilities, and disruptive deployment and operational cost points
for network operators.
-### [PetitParser for Java](https://github.com/petitparser/java-petitparser){: .external}
+### [PetitParser for Java](https://github.com/petitparser/java-petitparser)
Grammars for programming languages are traditionally specified statically.
They are hard to compose and reuse due to ambiguities that inevitably arise.
@@ -659,87 +659,87 @@ PetitParser combines ideas from scannnerless parsing, parser combinators,
parsing expression grammars and packrat parsers to model grammars and parsers
as objects that can be reconfigured dynamically.
-### [PlaidML](https://github.com/plaidml/plaidml){: .external}
+### [PlaidML](https://github.com/plaidml/plaidml)
PlaidML is a framework for making deep learning work everywhere.
-### [Project V](https://www.v2ray.com/){: .external}
+### [Project V](https://www.v2ray.com/)
-
+
Project V is a set of tools to help you build your own privacy network over
internet.
-### [Prysmatic Labs Ethereum 2.0 Implementation](https://github.com/prysmaticlabs/prysm){: .external}
+### [Prysmatic Labs Ethereum 2.0 Implementation](https://github.com/prysmaticlabs/prysm)
Prysm is a sharding client for Ethereum 2.0, a blockchain-based distributed
computing platform.
-### [Ray](https://github.com/ray-project/ray){: .external}
+### [Ray](https://github.com/ray-project/ray)
Ray is a flexible, high-performance distributed execution framework.
-### [Resty](https://github.com/go-resty/resty){: .external}
+### [Resty](https://github.com/go-resty/resty)
Resty is a Simple HTTP and REST client library for Go (inspired by Ruby
rest-client).
-### [Roughtime](https://roughtime.googlesource.com/roughtime){: .external}
+### [Roughtime](https://roughtime.googlesource.com/roughtime)
Roughtime is a project that aims to provide secure time synchronisation.
-### [Selenium](https://github.com/SeleniumHQ/selenium){: .external}
+### [Selenium](https://github.com/SeleniumHQ/selenium)
Selenium is a portable framework for testing web applications.
-### [Semantic](https://github.com/github/semantic){: .external}
+### [Semantic](https://github.com/github/semantic)
Semantic is a Haskell library and command line tool for parsing, analyzing, and
comparing source code. It is developed by GitHub (and used for example for the
code navigation).
-### [Served](https://github.com/meltwater/served){: .external}
+### [Served](https://github.com/meltwater/served)
Served is a C++ library for building high performance RESTful web servers.
-### [Sonnet](https://github.com/deepmind/sonnet){: .external}
+### [Sonnet](https://github.com/deepmind/sonnet)
Sonnet is a library built on top of TensorFlow for building complex neural
networks.
-### [Sorbet](https://github.com/sorbet/sorbet){: .external}
+### [Sorbet](https://github.com/sorbet/sorbet)
Sorbet is a fast, powerful type checker for a subset of Ruby. It scales to
codebases with millions of lines of code and can be adopted incrementally.
-### [Spotify](https://spotify.com){: .external}
+### [Spotify](https://spotify.com)
Spotify is using Bazel to build their iOS and Android Apps ([source](https://twitter.com/BalestraPatrick/status/1573355078995566594)).
-### [Tink](https://github.com/google/tink){: .external}
+### [Tink](https://github.com/google/tink)
Tink is a multi-language, cross-platform, open source library that provides
cryptographic APIs that are secure, easy to use correctly, and hard(er) to
misuse.
-### [TensorFlow](http://tensorflow.org){: .external}
-
+### [TensorFlow](http://tensorflow.org)
+
An open source software library for machine intelligence.
-### [Turbo Santa](https://github.com/turbo-santa/turbo-santa-common){: .external}
+### [Turbo Santa](https://github.com/turbo-santa/turbo-santa-common)
A platform-independent GameBoy emulator.
-### [Wycheproof](https://github.com/google/wycheproof){: .external}
+### [Wycheproof](https://github.com/google/wycheproof)
Project Wycheproof tests crypto libraries against known attacks.
-### [XIOSim](https://github.com/s-kanev/XIOSim){: .external}
+### [XIOSim](https://github.com/s-kanev/XIOSim)
XIOSim is a detailed user-mode microarchitectural simulator for the x86
architecture.
-### [ZhihuDailyPurify](https://github.com/izzyleung/ZhihuDailyPurify){: .external}
+### [ZhihuDailyPurify](https://github.com/izzyleung/ZhihuDailyPurify)
ZhihuDailyPurify is a light weight version of Zhihu Daily, a Chinese
question-and-answer webs.
\ No newline at end of file
diff --git a/versions/9.1.0/concepts/build-files.mdx b/versions/9.1.0/concepts/build-files.mdx
index 882107b2..57e853e2 100644
--- a/versions/9.1.0/concepts/build-files.mdx
+++ b/versions/9.1.0/concepts/build-files.mdx
@@ -15,7 +15,7 @@ For simplicity's sake, the documentation refers to these files simply as `BUILD`
files.
`BUILD` files are evaluated using an imperative language,
-[Starlark](https://github.com/bazelbuild/starlark/){: .external}.
+[Starlark](https://github.com/bazelbuild/starlark/).
They are interpreted as a sequential list of statements.
@@ -48,7 +48,7 @@ team. `BUILD` file authors should comment liberally to document the role
of each build target, whether or not it is intended for public use, and to
document the role of the package itself.
-## Loading an extension {:#load}
+## Loading an extension {#load}
Bazel extensions are files ending in `.bzl`. Use the `load` statement to import
a symbol from an extension.
@@ -90,7 +90,7 @@ loaded from another file.
You can use [load visibility](/versions/9.1.0/concepts/visibility#load-visibility) to restrict
who may load a `.bzl` file.
-## Types of build rules {:#types-of-build-rules}
+## Types of build rules {#types-of-build-rules}
The majority of build rules come in families, grouped together by
language. For example, `cc_binary`, `cc_library`
@@ -130,19 +130,6 @@ for anyone to create new rules.
and binaries and tests can depend on libraries, with the expected
separate-compilation behavior.
-
| - Labels - | -- Dependencies - | -
rule(
+```
+rule(
name = "a",
srcs = "a.in",
deps = "//b:b",
)
-
+```
+```
rule(
name = "b",
srcs = "b.in",
deps = "//c:c",
)
-
+```
b / b.in++``` import b; b.foo(); - +``` - +``` import c; function foo() { c.bar(); } -+```
- import b; - import c; - b.foo(); - c.garply(); -+``` +import b; +import c; +b.foo(); +c.garply(); +```
rule(
+```
+rule(
name = "b",
srcs = "b.in",
deps = "//d:d",
)
-
+```
- import d;
- function foo() {
- d.baz();
- }
-
+```
+import d;
+function foo() {
+ d.baz();
+}
+```
Not recommended — +
+ Not recommended —
data = ["//data/regression:unittest/."]
Not recommended — +
+ Not recommended —
data = ["testdata/."]
Not recommended — +
+ Not recommended —
data = ["testdata/"]
Recommended — +
+ Recommended —
data = glob(["testdata/**"])
| - BUILD files - | -- Visibility - | -
Wrong — Do not use .. to refer to files in other packages
Correct — Use
- //{{ "" }}package-name{{ "" }}:{{ "" }}filename{{ "" }}
//package-name:filename
While it is common to use `/` in the name of a file target, avoid the use of
`/` in the names of rules. Especially when the shorthand form of a label is
@@ -155,7 +155,7 @@ However, there are some situations where use of a slash is convenient, or
sometimes even necessary. For example, the name of certain rules must match
their principal source file, which may reside in a subdirectory of the package.
-### Package names — `//package-name:{{ "" }}target-name{{ "" }}` {:#package-names}
+### Package names — `//package-name:target-name` {#package-names}
The name of a package is the name of the directory containing its `BUILD` file,
relative to the top-level directory of the containing repository.
@@ -186,7 +186,7 @@ On a practical level:
`//:foo`), it's best to leave that package empty so all meaningful packages
have descriptive names.
-## Rules {:#rules}
+## Rules {#rules}
A rule specifies the relationship between inputs and outputs, and the
steps to build the outputs. Rules can be of one of many different
@@ -239,16 +239,3 @@ the build.
This directed acyclic graph over targets is called the _target graph_ or
_build dependency graph_, and is the domain over which the
[Bazel Query tool](/versions/9.1.0/query/guide) operates.
-
-| - Targets - | -- BUILD files - | -
| Constraint - | -Description - | +Constraint | +Description |
requires = [ - feature_set (features = [ - 'feature-name-1', - 'feature-name-2' - ]), -]+ |
+ requires = [ + feature_set (features = [ + 'feature-name-1', + 'feature-name-2' + ]), + ] |
- Feature-level. The feature is supported only if the specified required
- features are enabled. For example, when a feature is only supported in
- certain build modes (opt, dbg, or
- fastbuild). If `requires` contains multiple `feature_set`s
- the feature is supported if any of the `feature_set`s is satisfied
- (when all specified features are enabled).
+ |
+ Feature-level. The feature is supported only if the specified required
+ features are enabled. For example, when a feature is only supported in
+ certain build modes (opt, dbg, or
+ fastbuild). If `requires` contains multiple `feature_set`s
+ the feature is supported if any of the `feature_set`s is satisfied
+ (when all specified features are enabled).
|
implies = ['feature']- |
- Feature-level. This feature implies the specified feature(s). - Enabling a feature also implicitly enables all features implied by it - (that is, it functions recursively). -Also provides the ability to factor common subsets of functionality out of - a set of features, such as the common parts of sanitizers. Implied - features cannot be disabled. + | implies = ['feature'] |
+
+ Feature-level. This feature implies the specified feature(s). + Enabling a feature also implicitly enables all features implied by it + (that is, it functions recursively). +Also provides the ability to factor common subsets of functionality out of + a set of features, such as the common parts of sanitizers. Implied + features cannot be disabled. |
provides = ['feature']- |
- Feature-level. Indicates that this feature is one of several mutually
- exclusive alternate features. For example, all of the sanitizers could
- specify This improves error handling by listing the alternatives if the user asks - for two or more mutually exclusive features at once. + | provides = ['feature'] |
+
+ Feature-level. Indicates that this feature is one of several mutually
+ exclusive alternate features. For example, all of the sanitizers could
+ specify This improves error handling by listing the alternatives if the user asks + for two or more mutually exclusive features at once. |
with_features = [ - with_feature_set( - features = ['feature-1'], - not_features = ['feature-2'], - ), -]+ |
+ with_features = [ + with_feature_set( + features = ['feature-1'], + not_features = ['feature-2'], + ), + ] |
- Flag set-level. A feature can specify multiple flag sets with multiple. + |
+ Flag set-level. A feature can specify multiple flag sets with multiple.
When with_features is specified, the flag set will only expand
to the build command if there is at least one with_feature_set
for which all of the features in the specified features set
@@ -195,7 +197,7 @@ support and expansion. These are:
|
| Action - | -Description - | +Action | +Description |
preprocess-assemble
- |
- Assemble with preprocessing. Typically for .S files.
- |
+ preprocess-assemble |
+ Assemble with preprocessing. Typically for .S files. |
assemble
- |
- Assemble without preprocessing. Typically for .s files.
- |
+ assemble |
+ Assemble without preprocessing. Typically for .s files. |
| Action - | -Description - | +Action | +Description |
cc-flags-make-variable
- |
- Propagates CC_FLAGS to genrules.
- |
+ cc-flags-make-variable |
+ Propagates CC_FLAGS to genrules. |
c-compile
- |
- Compile as C. - | +c-compile |
+ Compile as C. |
c++-compile
- |
- Compile as C++. - | +c++-compile |
+ Compile as C++. |
c++-header-parsing
- |
- Run the compiler's parser on a header file to ensure that the header is + | c++-header-parsing |
+ + Run the compiler's parser on a header file to ensure that the header is self-contained, as it will otherwise produce compilation errors. Applies only to toolchains that support modules. |
| Action - | -Description - | +Action | +Description |
c++-link-dynamic-library
- |
- Link a shared library containing all of its dependencies. - | +c++-link-dynamic-library |
+ Link a shared library containing all of its dependencies. |
c++-link-nodeps-dynamic-library
- |
- Link a shared library only containing cc_library sources.
- |
+ c++-link-nodeps-dynamic-library |
+ Link a shared library only containing cc_library sources. |
c++-link-executable
- |
- Link a final ready-to-run library. - | +c++-link-executable |
+ Link a final ready-to-run library. |
| Action - | -Description - | +Action | +Description |
c++-link-static-library
- |
- Create a static library (archive). - | +c++-link-static-library |
+ Create a static library (archive). |
| Action - | -Description - | +Action | +Description |
lto-backend
- |
- ThinLTO action compiling bitcodes into native objects. - | +lto-backend |
+ ThinLTO action compiling bitcodes into native objects. |
lto-index
- |
- ThinLTO action generating global index. - | +lto-index |
+ ThinLTO action generating global index. |
| Attribute - | -Description - | +Attribute | +Description |
action_name
- |
- The Bazel action to which this action corresponds. - Bazel uses this attribute to discover per-action tool and execution - requirements. - | +action_name |
+ + The Bazel action to which this action corresponds. + Bazel uses this attribute to discover per-action tool and execution + requirements. + |
tools
- |
- The executable to invoke. The tool applied to the action will be the - first tool in the list with a feature set that matches the feature - configuration. Default value must be provided. + | tools |
+ + The executable to invoke. The tool applied to the action will be the + first tool in the list with a feature set that matches the feature + configuration. Default value must be provided. |
flag_sets
- |
- A list of flags that applies to a group of actions. Same as for a - feature. + | flag_sets |
+ + A list of flags that applies to a group of actions. Same as for a + feature. |
env_sets
- |
- A list of environment constraints that applies to a group of actions. - Same as for a feature. + | env_sets |
+ + A list of environment constraints that applies to a group of actions. + Same as for a feature. |
| Field - | -Description - | +Field | +Description |
path
- |
- Path to the tool in question (relative to the current location). - | +path |
+ Path to the tool in question (relative to the current location). |
with_features
- |
- A list of feature sets out of which at least one must be satisfied - for this tool to apply. + | with_features |
+ + A list of feature sets out of which at least one must be satisfied + for this tool to apply. |
| Variable - | -Action - | -Description - | +Variable | +Action | +Description |
source_file
- |
+ source_file |
compile | -Source file to compile. - | +Source file to compile. | |
input_file
- |
+ input_file |
strip | -Artifact to strip. - | +Artifact to strip. | |
output_file
- |
+ output_file |
compile, strip | -Compilation output. - | +Compilation output. | |
output_assembly_file
- |
+ output_assembly_file |
compile | -Emitted assembly file. Applies only when the
- compile action emits assembly text, typically when using the
- --save_temps flag. The contents are the same as for
- output_file.
+ |
+ Emitted assembly file. Applies only when the
+ compile action emits assembly text, typically when using the
+ --save_temps flag. The contents are the same as for
+ output_file.
|
|
output_preprocess_file
- |
+ output_preprocess_file |
compile | -Preprocessed output. Applies only to compile - actions that only preprocess the source files, typically when using the + |
+ Preprocessed output. Applies only to compile
+ actions that only preprocess the source files, typically when using the
--save_temps flag. The contents are the same as for
output_file.
|
|
includes
- |
+ includes |
compile | -Sequence of files the compiler must - unconditionally include in the compiled source. + | + Sequence of files the compiler must + unconditionally include in the compiled source. | |
include_paths
- |
+ include_paths |
compile | -Sequence directories in which the compiler
- searches for headers included using #include<foo.h>
- and #include "foo.h".
+ |
+ Sequence directories in which the compiler
+ searches for headers included using #include<foo.h>
+ and #include "foo.h".
|
|
quote_include_paths
- |
+ quote_include_paths |
compile | -Sequence of -iquote includes -
- directories in which the compiler searches for headers included using
- #include "foo.h".
+ |
+ Sequence of -iquote includes -
+ directories in which the compiler searches for headers included using
+ #include "foo.h".
|
|
system_include_paths
- |
+ system_include_paths |
compile | -Sequence of -isystem includes -
- directories in which the compiler searches for headers included using
- #include <foo.h>.
+ |
+ Sequence of -isystem includes -
+ directories in which the compiler searches for headers included using
+ #include <foo.h>.
|
|
dependency_file
- |
+ dependency_file |
compile | -The .d dependency file generated by the compiler.
- |
+ The .d dependency file generated by the compiler. |
|
preprocessor_defines
- |
+ preprocessor_defines |
compile | -Sequence of defines, such as --DDEBUG.
- |
+ Sequence of defines, such as --DDEBUG. |
|
pic
- |
+ pic |
compile | -Compiles the output as position-independent code. - | +Compiles the output as position-independent code. | |
gcov_gcno_file
- |
+ gcov_gcno_file |
compile | -The gcov coverage file.
- |
+ The gcov coverage file. |
|
per_object_debug_info_file
- |
+ per_object_debug_info_file |
compile | -The per-object debug info (.dwp) file.
- |
+ The per-object debug info (.dwp) file. |
|
stripopts
- |
+ stripopts |
strip | -Sequence of stripopts.
- |
+ Sequence of stripopts. |
|
legacy_compile_flags
- |
+ legacy_compile_flags |
compile | -Sequence of flags from legacy
- CROSSTOOL fields such as compiler_flag,
- optional_compiler_flag, cxx_flag, and
- optional_cxx_flag.
+ |
+ Sequence of flags from legacy
+ CROSSTOOL fields such as compiler_flag,
+ optional_compiler_flag, cxx_flag, and
+ optional_cxx_flag.
|
|
user_compile_flags
- |
+ user_compile_flags |
compile | -Sequence of flags from either the
- copt rule attribute or the --copt,
- --cxxopt, and --conlyopt flags.
+ |
+ Sequence of flags from either the
+ copt rule attribute or the --copt,
+ --cxxopt, and --conlyopt flags.
|
|
unfiltered_compile_flags
- |
+ unfiltered_compile_flags |
compile | -Sequence of flags from the + |
+ Sequence of flags from the
unfiltered_cxx_flag legacy CROSSTOOL field or the
- unfiltered_compile_flags feature. These are not filtered by
- the nocopts rule attribute.
+ unfiltered_compile_flags feature. These are not filtered by
+ the nocopts rule attribute.
|
|
sysroot
- |
+ sysroot |
- | The sysroot.
- |
+ The sysroot. |
|
runtime_library_search_directories
- |
+ runtime_library_search_directories |
link | -Entries in the linker runtime search path (usually
- set with the -rpath flag).
+ |
+ Entries in the linker runtime search path (usually
+ set with the -rpath flag).
|
|
library_search_directories
- |
+ library_search_directories |
link | -Entries in the linker search path (usually set with
- the -L flag).
+ |
+ Entries in the linker search path (usually set with
+ the -L flag).
|
|
libraries_to_link
- |
+ libraries_to_link |
link | -Flags providing files to link as inputs in the linker invocation. - | +Flags providing files to link as inputs in the linker invocation. | |
def_file_path
- |
+ def_file_path |
link | -Location of def file used on Windows with MSVC. - | +Location of def file used on Windows with MSVC. | |
linker_param_file
- |
+ linker_param_file |
link | -Location of linker param file created by bazel to - overcome command line length limit. + | + Location of linker param file created by bazel to + overcome command line length limit. | |
output_execpath
- |
+ output_execpath |
link | -Execpath of the output of the linker. - | +Execpath of the output of the linker. | |
generate_interface_library
- |
+ generate_interface_library |
link | -"yes" or "no" depending on whether interface library should
- be generated.
+ |
+ "yes" or "no" depending on whether interface library should
+ be generated.
|
|
interface_library_builder_path
- |
+ interface_library_builder_path |
link | -Path to the interface library builder tool. - | +Path to the interface library builder tool. | |
interface_library_input_path
- |
+ interface_library_input_path |
link | -Input for the interface library ifso builder tool.
- |
+ Input for the interface library ifso builder tool. |
|
interface_library_output_path
- |
+ interface_library_output_path |
link | -Path where to generate interface library using the ifso builder tool.
- |
+ Path where to generate interface library using the ifso builder tool. |
|
legacy_link_flags
- |
+ legacy_link_flags |
link | -Linker flags coming from the legacy CROSSTOOL fields.
- |
+ Linker flags coming from the legacy CROSSTOOL fields. |
|
user_link_flags
- |
+ user_link_flags |
link | -Linker flags coming from the --linkopt
- or linkopts attribute.
+ |
+ Linker flags coming from the --linkopt
+ or linkopts attribute.
|
|
linkstamp_paths
- |
+ linkstamp_paths |
link | -A build variable giving linkstamp paths. - | +A build variable giving linkstamp paths. | |
force_pic
- |
+ force_pic |
link | -Presence of this variable indicates that PIC/PIE code should + | + Presence of this variable indicates that PIC/PIE code should be generated (Bazel option `--force_pic` was passed). | |
strip_debug_symbols
- |
+ strip_debug_symbols |
link | -Presence of this variable indicates that the debug - symbols should be stripped. + | + Presence of this variable indicates that the debug + symbols should be stripped. | |
is_cc_test
- |
+ is_cc_test |
link | -Truthy when current action is a cc_test
- linking action, false otherwise.
+ |
+ Truthy when current action is a cc_test
+ linking action, false otherwise.
|
|
is_using_fission
- |
+ is_using_fission |
compile, link | -Presence of this variable indicates that fission (per-object debug info) + |
+ Presence of this variable indicates that fission (per-object debug info)
is activated. Debug info will be in .dwo files instead
- of .o files and the compiler and linker need to know this.
+ of .o files and the compiler and linker need to know this.
|
|
fdo_instrument_path
- |
+ fdo_instrument_path |
compile, link | -Path to the directory that stores FDO instrumentation profile. - | +Path to the directory that stores FDO instrumentation profile. | |
fdo_profile_path
- |
+ fdo_profile_path |
compile | -Path to FDO profile. - | +Path to FDO profile. | |
fdo_prefetch_hints_path
- |
+ fdo_prefetch_hints_path |
compile | -Path to the cache prefetch profile. - | +Path to the cache prefetch profile. | |
cs_fdo_instrument_path
- |
+ cs_fdo_instrument_path |
compile, link | -Path to the directory that stores context sensitive FDO - instrumentation profile. + | + Path to the directory that stores context sensitive FDO + instrumentation profile. |
| Feature - | -Documentation - | +Feature | +Documentation |
opt | dbg | fastbuild
- |
- Enabled by default based on compilation mode. - | +opt | dbg | fastbuild |
+ Enabled by default based on compilation mode. |
static_linking_mode | dynamic_linking_mode
- |
- Enabled by default based on linking mode. - | +static_linking_mode | dynamic_linking_mode |
+ Enabled by default based on linking mode. |
per_object_debug_info
- |
- Enabled if the supports_fission feature is specified and
- enabled and the current compilation mode is specified in the
- --fission flag.
- |
+ per_object_debug_info |
+
+ Enabled if the supports_fission feature is specified and
+ enabled and the current compilation mode is specified in the
+ --fission flag.
+ |
supports_start_end_lib
- |
- If enabled (and the option --start_end_lib is set), Bazel
+ | supports_start_end_lib |
+
+ If enabled (and the option --start_end_lib is set), Bazel
will not link against static libraries but instead use the
--start-lib/--end-lib linker options to link against objects
directly. This speeds up the build since Bazel doesn't have to build
@@ -1033,25 +946,25 @@ conditions.
|
supports_interface_shared_libraries
- |
- If enabled (and the option --interface_shared_objects is
+ | supports_interface_shared_libraries |
+
+ If enabled (and the option --interface_shared_objects is
set), Bazel will link targets that have linkstatic set to
False (cc_tests by default) against interface shared
libraries. This makes incremental relinking faster.
|
supports_dynamic_linker
- |
- If enabled, C++ rules will know the toolchain can produce shared + | supports_dynamic_linker |
+ + If enabled, C++ rules will know the toolchain can produce shared libraries. |
static_link_cpp_runtimes
- |
- If enabled, Bazel will link the C++ runtime statically in static linking + | static_link_cpp_runtimes |
+
+ If enabled, Bazel will link the C++ runtime statically in static linking
mode and dynamically in dynamic linking mode. Artifacts
specified in the cc_toolchain.static_runtime_lib or
cc_toolchain.dynamic_runtime_lib attribute (depending on the
@@ -1059,24 +972,21 @@ conditions.
|
supports_pic
- |
- If enabled, toolchain will know to use PIC objects for dynamic libraries. + | supports_pic |
+ + If enabled, toolchain will know to use PIC objects for dynamic libraries. The `pic` variable is present whenever PIC compilation is needed. If not enabled by default, and `--force_pic` is passed, Bazel will request `supports_pic` and validate that the feature is enabled. If the feature is missing, or couldn't - be enabled, `--force_pic` cannot be used. + be enabled, `--force_pic` cannot be used. |
- static_linking_mode | dynamic_linking_mode
- |
+ static_linking_mode | dynamic_linking_mode |
Enabled by default based on linking mode. | |
no_legacy_features
- |
+ no_legacy_features |
Prevents Bazel from adding legacy features to the C++ configuration when present. See the complete list of @@ -1084,15 +994,12 @@ conditions. | |
shorten_virtual_includes
- |
-
- If enabled, virtual include header files are linked under bin/_virtual_includes/<hash of target path> instead of bin/<target package path>/_virtual_includes/<target name>. Useful on Windows to avoid long path issue with MSVC.
- |
+ shorten_virtual_includes |
+ If enabled, virtual include header files are linked under bin/_virtual_includes/<hash of target path> instead of bin/<target package path>/_virtual_includes/<target name>. Useful on Windows to avoid long path issue with MSVC. |
Bazel applies the following changes to the toolchain's features for backwards @@ -1142,7 +1049,7 @@ conditions.
This is a long list of features. The plan is to get rid of them once -[Crosstool in Starlark](https://github.com/bazelbuild/bazel/issues/5380){: .external} is +[Crosstool in Starlark](https://github.com/bazelbuild/bazel/issues/5380) is done. For the curious reader see the implementation in [CppActionConfigs](https://source.bazel.build/bazel/+/master:src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java?q=cppactionconfigs&ss=bazel), and for production toolchains consider adding `no_legacy_features` to make diff --git a/versions/9.1.0/docs/images/a_b_a_c.svg b/versions/9.1.0/docs/images/a_b_a_c.svg new file mode 100644 index 00000000..d38be075 --- /dev/null +++ b/versions/9.1.0/docs/images/a_b_a_c.svg @@ -0,0 +1,42 @@ + + + + + diff --git a/versions/9.1.0/docs/images/a_b_c.svg b/versions/9.1.0/docs/images/a_b_c.svg new file mode 100644 index 00000000..acd948ab --- /dev/null +++ b/versions/9.1.0/docs/images/a_b_c.svg @@ -0,0 +1,41 @@ + + + + + diff --git a/versions/9.1.0/docs/images/a_b_c_ac.svg b/versions/9.1.0/docs/images/a_b_c_ac.svg new file mode 100644 index 00000000..b099c53e --- /dev/null +++ b/versions/9.1.0/docs/images/a_b_c_ac.svg @@ -0,0 +1,47 @@ + + + + + diff --git a/versions/9.1.0/docs/images/ab_c.svg b/versions/9.1.0/docs/images/ab_c.svg new file mode 100644 index 00000000..bcc4563f --- /dev/null +++ b/versions/9.1.0/docs/images/ab_c.svg @@ -0,0 +1,36 @@ + + + + + diff --git a/versions/9.1.0/docs/images/allpaths.svg b/versions/9.1.0/docs/images/allpaths.svg new file mode 100644 index 00000000..47d0ee33 --- /dev/null +++ b/versions/9.1.0/docs/images/allpaths.svg @@ -0,0 +1,141 @@ + + + + + diff --git a/versions/9.1.0/docs/images/android_instrumentation_test.png b/versions/9.1.0/docs/images/android_instrumentation_test.png new file mode 100644 index 00000000..e4534fbd Binary files /dev/null and b/versions/9.1.0/docs/images/android_instrumentation_test.png differ diff --git a/versions/9.1.0/docs/images/android_ndk.png b/versions/9.1.0/docs/images/android_ndk.png new file mode 100644 index 00000000..76b63cb3 Binary files /dev/null and b/versions/9.1.0/docs/images/android_ndk.png differ diff --git a/versions/9.1.0/docs/images/android_tutorial_app.png b/versions/9.1.0/docs/images/android_tutorial_app.png new file mode 100644 index 00000000..076be5b9 Binary files /dev/null and b/versions/9.1.0/docs/images/android_tutorial_app.png differ diff --git a/versions/9.1.0/docs/images/android_tutorial_before.png b/versions/9.1.0/docs/images/android_tutorial_before.png new file mode 100644 index 00000000..8e41d419 Binary files /dev/null and b/versions/9.1.0/docs/images/android_tutorial_before.png differ diff --git a/versions/9.1.0/docs/images/bep-graph.png b/versions/9.1.0/docs/images/bep-graph.png new file mode 100644 index 00000000..82da6715 Binary files /dev/null and b/versions/9.1.0/docs/images/bep-graph.png differ diff --git a/versions/9.1.0/docs/images/bep-graph.svg b/versions/9.1.0/docs/images/bep-graph.svg new file mode 100644 index 00000000..62b1480f --- /dev/null +++ b/versions/9.1.0/docs/images/bep-graph.svg @@ -0,0 +1,4 @@ + + + + diff --git a/versions/9.1.0/docs/images/cpp-tutorial-stage1.png b/versions/9.1.0/docs/images/cpp-tutorial-stage1.png new file mode 100644 index 00000000..c85fb303 Binary files /dev/null and b/versions/9.1.0/docs/images/cpp-tutorial-stage1.png differ diff --git a/versions/9.1.0/docs/images/cpp-tutorial-stage2.png b/versions/9.1.0/docs/images/cpp-tutorial-stage2.png new file mode 100644 index 00000000..80e202c9 Binary files /dev/null and b/versions/9.1.0/docs/images/cpp-tutorial-stage2.png differ diff --git a/versions/9.1.0/docs/images/cpp-tutorial-stage3.png b/versions/9.1.0/docs/images/cpp-tutorial-stage3.png new file mode 100644 index 00000000..54d82f31 Binary files /dev/null and b/versions/9.1.0/docs/images/cpp-tutorial-stage3.png differ diff --git a/versions/9.1.0/docs/images/deps.svg b/versions/9.1.0/docs/images/deps.svg new file mode 100644 index 00000000..4354222a --- /dev/null +++ b/versions/9.1.0/docs/images/deps.svg @@ -0,0 +1,101 @@ + + + + + diff --git a/versions/9.1.0/docs/images/dyn-trace-alldynamic.png b/versions/9.1.0/docs/images/dyn-trace-alldynamic.png new file mode 100644 index 00000000..fe36b253 Binary files /dev/null and b/versions/9.1.0/docs/images/dyn-trace-alldynamic.png differ diff --git a/versions/9.1.0/docs/images/dyn-trace-javaconly.png b/versions/9.1.0/docs/images/dyn-trace-javaconly.png new file mode 100644 index 00000000..2ae41e52 Binary files /dev/null and b/versions/9.1.0/docs/images/dyn-trace-javaconly.png differ diff --git a/versions/9.1.0/docs/images/e4b-workflow.png b/versions/9.1.0/docs/images/e4b-workflow.png new file mode 100644 index 00000000..412822da Binary files /dev/null and b/versions/9.1.0/docs/images/e4b-workflow.png differ diff --git a/versions/9.1.0/docs/images/e4b-workflow.svg b/versions/9.1.0/docs/images/e4b-workflow.svg new file mode 100644 index 00000000..1de66e02 --- /dev/null +++ b/versions/9.1.0/docs/images/e4b-workflow.svg @@ -0,0 +1,4 @@ + + + + diff --git a/versions/9.1.0/docs/images/error_example_1.png b/versions/9.1.0/docs/images/error_example_1.png new file mode 100644 index 00000000..07ba1358 Binary files /dev/null and b/versions/9.1.0/docs/images/error_example_1.png differ diff --git a/versions/9.1.0/docs/images/error_example_2.png b/versions/9.1.0/docs/images/error_example_2.png new file mode 100644 index 00000000..861171ee Binary files /dev/null and b/versions/9.1.0/docs/images/error_example_2.png differ diff --git a/versions/9.1.0/docs/images/error_example_3.png b/versions/9.1.0/docs/images/error_example_3.png new file mode 100644 index 00000000..dc16eec4 Binary files /dev/null and b/versions/9.1.0/docs/images/error_example_3.png differ diff --git a/versions/9.1.0/docs/images/error_example_4.png b/versions/9.1.0/docs/images/error_example_4.png new file mode 100644 index 00000000..84383e63 Binary files /dev/null and b/versions/9.1.0/docs/images/error_example_4.png differ diff --git a/versions/9.1.0/docs/images/graph_ex_1.svg b/versions/9.1.0/docs/images/graph_ex_1.svg new file mode 100644 index 00000000..dd7427f4 --- /dev/null +++ b/versions/9.1.0/docs/images/graph_ex_1.svg @@ -0,0 +1,131 @@ + + + + + diff --git a/versions/9.1.0/docs/images/graph_hello-world.svg b/versions/9.1.0/docs/images/graph_hello-world.svg new file mode 100644 index 00000000..93b61444 --- /dev/null +++ b/versions/9.1.0/docs/images/graph_hello-world.svg @@ -0,0 +1,70 @@ + + + + + diff --git a/versions/9.1.0/docs/images/json-trace-profile-network-usage.png b/versions/9.1.0/docs/images/json-trace-profile-network-usage.png new file mode 100644 index 00000000..8a7500a6 Binary files /dev/null and b/versions/9.1.0/docs/images/json-trace-profile-network-usage.png differ diff --git a/versions/9.1.0/docs/images/json-trace-profile-system-load-average.png b/versions/9.1.0/docs/images/json-trace-profile-system-load-average.png new file mode 100644 index 00000000..e71b420c Binary files /dev/null and b/versions/9.1.0/docs/images/json-trace-profile-system-load-average.png differ diff --git a/versions/9.1.0/docs/images/json-trace-profile-workers-memory-usage.png b/versions/9.1.0/docs/images/json-trace-profile-workers-memory-usage.png new file mode 100644 index 00000000..806505f0 Binary files /dev/null and b/versions/9.1.0/docs/images/json-trace-profile-workers-memory-usage.png differ diff --git a/versions/9.1.0/docs/images/json-trace-profile.png b/versions/9.1.0/docs/images/json-trace-profile.png new file mode 100644 index 00000000..538382b2 Binary files /dev/null and b/versions/9.1.0/docs/images/json-trace-profile.png differ diff --git a/versions/9.1.0/docs/images/mobile-install-performance.svg b/versions/9.1.0/docs/images/mobile-install-performance.svg new file mode 100644 index 00000000..b139d658 --- /dev/null +++ b/versions/9.1.0/docs/images/mobile-install-performance.svg @@ -0,0 +1,86 @@ + + + diff --git a/versions/9.1.0/docs/images/namedsetoffiles-bep-graph.png b/versions/9.1.0/docs/images/namedsetoffiles-bep-graph.png new file mode 100644 index 00000000..ea1e10cc Binary files /dev/null and b/versions/9.1.0/docs/images/namedsetoffiles-bep-graph.png differ diff --git a/versions/9.1.0/docs/images/out-ranked.svg b/versions/9.1.0/docs/images/out-ranked.svg new file mode 100644 index 00000000..07e96804 --- /dev/null +++ b/versions/9.1.0/docs/images/out-ranked.svg @@ -0,0 +1,71 @@ + + + + + diff --git a/versions/9.1.0/docs/images/rbe-ci-1.png b/versions/9.1.0/docs/images/rbe-ci-1.png new file mode 100644 index 00000000..fbe76a85 Binary files /dev/null and b/versions/9.1.0/docs/images/rbe-ci-1.png differ diff --git a/versions/9.1.0/docs/images/rbe-ci-2.png b/versions/9.1.0/docs/images/rbe-ci-2.png new file mode 100644 index 00000000..07611889 Binary files /dev/null and b/versions/9.1.0/docs/images/rbe-ci-2.png differ diff --git a/versions/9.1.0/docs/images/somepath1.svg b/versions/9.1.0/docs/images/somepath1.svg new file mode 100644 index 00000000..5e5f8812 --- /dev/null +++ b/versions/9.1.0/docs/images/somepath1.svg @@ -0,0 +1,141 @@ + + + + + diff --git a/versions/9.1.0/docs/images/somepath2.svg b/versions/9.1.0/docs/images/somepath2.svg new file mode 100644 index 00000000..911f2c9b --- /dev/null +++ b/versions/9.1.0/docs/images/somepath2.svg @@ -0,0 +1,141 @@ + + + + + diff --git a/versions/9.1.0/docs/images/targets.svg b/versions/9.1.0/docs/images/targets.svg new file mode 100644 index 00000000..82f47e74 --- /dev/null +++ b/versions/9.1.0/docs/images/targets.svg @@ -0,0 +1,113 @@ + + + + + diff --git a/versions/9.1.0/docs/images/tutorial_java_01.svg b/versions/9.1.0/docs/images/tutorial_java_01.svg new file mode 100644 index 00000000..2fe72f36 --- /dev/null +++ b/versions/9.1.0/docs/images/tutorial_java_01.svg @@ -0,0 +1,29 @@ + + + + + diff --git a/versions/9.1.0/docs/images/tutorial_java_02.svg b/versions/9.1.0/docs/images/tutorial_java_02.svg new file mode 100644 index 00000000..40cbb218 --- /dev/null +++ b/versions/9.1.0/docs/images/tutorial_java_02.svg @@ -0,0 +1,48 @@ + + + + + diff --git a/versions/9.1.0/docs/images/tutorial_java_03.svg b/versions/9.1.0/docs/images/tutorial_java_03.svg new file mode 100644 index 00000000..7d79041a --- /dev/null +++ b/versions/9.1.0/docs/images/tutorial_java_03.svg @@ -0,0 +1,48 @@ + + + + + diff --git a/versions/9.1.0/docs/images/workers-clean-chart.png b/versions/9.1.0/docs/images/workers-clean-chart.png new file mode 100644 index 00000000..63526fc1 Binary files /dev/null and b/versions/9.1.0/docs/images/workers-clean-chart.png differ diff --git a/versions/9.1.0/docs/images/workers-incremental-chart.png b/versions/9.1.0/docs/images/workers-incremental-chart.png new file mode 100644 index 00000000..1c62d25c Binary files /dev/null and b/versions/9.1.0/docs/images/workers-incremental-chart.png differ diff --git a/versions/9.1.0/docs/images/ws-diamond.png b/versions/9.1.0/docs/images/ws-diamond.png new file mode 100644 index 00000000..154a7440 Binary files /dev/null and b/versions/9.1.0/docs/images/ws-diamond.png differ diff --git a/versions/9.1.0/docs/images/ws-line.png b/versions/9.1.0/docs/images/ws-line.png new file mode 100644 index 00000000..e8bfe7a1 Binary files /dev/null and b/versions/9.1.0/docs/images/ws-line.png differ diff --git a/versions/9.1.0/docs/images/ws-multiline.png b/versions/9.1.0/docs/images/ws-multiline.png new file mode 100644 index 00000000..f07b43b1 Binary files /dev/null and b/versions/9.1.0/docs/images/ws-multiline.png differ diff --git a/versions/9.1.0/docs/user-manual.mdx b/versions/9.1.0/docs/user-manual.mdx index 0b60502e..e3639541 100644 --- a/versions/9.1.0/docs/user-manual.mdx +++ b/versions/9.1.0/docs/user-manual.mdx @@ -6,13 +6,13 @@ This page covers the options that are available with various Bazel commands, such as `bazel build`, `bazel run`, and `bazel test`. This page is a companion to the list of Bazel's commands in [Build with Bazel](/versions/9.1.0/run/build). -## Target syntax {:#target-syntax} +## Target syntax {#target-syntax} Some commands, like `build` or `test`, can operate on a list of targets. They use a syntax more flexible than labels, which is documented in [Specifying targets to build](/versions/9.1.0/run/build#specifying-build-targets). -## Options {:#build-options} +## Options {#build-options} The following sections describe the options available during a build. When `--long` is used on a help command, the on-line @@ -23,9 +23,9 @@ Most options can only be specified once. When specified multiple times, the last instance wins. Options that can be specified multiple times are identified in the on-line help with the text 'may be used multiple times'. -### Package location {:#package-location} +### Package location {#package-location} -#### `--package_path` {:#package-path} +#### `--package_path` {#package-path} **WARNING:** The `--package_path` option is deprecated. Bazel prefers packages in the main repository to be under the workspace root. @@ -39,9 +39,9 @@ partial source tree. _To specify a custom package path_ using the `--package_path` option: -+``` % bazel build --package_path %workspace%:/some/other/root -+``` Package path elements may be specified in three formats: @@ -71,14 +71,14 @@ on the package path. Example: Building from an empty client -
+``` % mkdir -p foo/bazel % cd foo/bazel % touch MODULE.bazel % bazel build --package_path /some/other/path //foo -+``` -#### `--deleted_packages` {:flag--deleted_packages} +#### `--deleted_packages` {#flag--deleted_packages} This option specifies a comma-separated list of packages which Bazel should consider deleted, and not attempt to load from any directory @@ -86,17 +86,17 @@ on the package path. This can be used to simulate the deletion of packages witho actually deleting them. This option can be passed multiple times, in which case the individual lists are concatenated. -### Error checking {:#error-checking} +### Error checking {#error-checking} These options control Bazel's error-checking and/or warnings. -#### `--[no]check_visibility` {:#check-visibility} +#### `--[no]check_visibility` {#check-visibility} If this option is set to false, visibility checks are demoted to warnings. The default value of this option is true, so that by default, visibility checking is done. -#### `--output_filter={{ "" }}regex{{ "" }}` {:#output-filter} +#### `--output_filter=regex` {#output-filter} The `--output_filter` option will only show build and compilation warnings for targets that match the regular expression. If a target does not @@ -116,21 +116,19 @@ Here are some typical values for this option:
+``` % bazel build --copt="-g0" --copt="-fpic" //foo -+``` will compile the `foo` library without debug tables, generating position-independent code. @@ -159,35 +157,35 @@ Similarly, compiler options that only have an effect at link time (such as `-l`) should be specified in `--linkopt`, not in `--copt`. -#### `--host_copt={{ "" }}cc-option{{ "" }}` {:#host-copt} +#### `--host_copt=cc-option` {#host-copt} This option takes an argument which is to be passed to the compiler for source files that are compiled in the exec configuration. This is analogous to the [`--copt`](#copt) option, but applies only to the exec configuration. -#### `--host_conlyopt={{ "" }}cc-option{{ "" }}` {:#host-conlyopt} +#### `--host_conlyopt=cc-option` {#host-conlyopt} This option takes an argument which is to be passed to the compiler for C source files that are compiled in the exec configuration. This is analogous to the [`--conlyopt`](#cconlyopt) option, but applies only to the exec configuration. -#### `--host_cxxopt={{ "" }}cc-option{{ "" }}` {:#host-cxxopt} +#### `--host_cxxopt=cc-option` {#host-cxxopt} This option takes an argument which is to be passed to the compiler for C++ source files that are compiled in the exec configuration. This is analogous to the [`--cxxopt`](#cxxopt) option, but applies only to the exec configuration. -#### `--host_linkopt={{ "" }}linker-option{{ "" }}` {:#host-linkopt} +#### `--host_linkopt=linker-option` {#host-linkopt} This option takes an argument which is to be passed to the linker for source files that are compiled in the exec configuration. This is analogous to the [`--linkopt`](#linkopt) option, but applies only to the exec configuration. -#### `--conlyopt={{ "" }}cc-option{{ "" }}` {:#cconlyopt} +#### `--conlyopt=cc-option` {#cconlyopt} This option takes an argument which is to be passed to the compiler when compiling C source files. @@ -198,7 +196,7 @@ not to C++ compilation or linking. So you can pass C-specific options Note: copts parameters listed in specific cc_library or cc_binary build rules are placed on the compiler command line _after_ these options. -#### `--cxxopt={{ "" }}cc-option{{ "" }}` {:#cxxopt} +#### `--cxxopt=cc-option` {#cxxopt} This option takes an argument which is to be passed to the compiler when compiling C++ source files. @@ -209,14 +207,14 @@ not to C compilation or linking. So you can pass C++-specific options For example: -
+``` % bazel build --cxxopt="-fpermissive" --cxxopt="-Wno-error" //foo/cruddy_code -+``` Note: copts parameters listed in specific cc_library or cc_binary build rules are placed on the compiler command line _after_ these options. -#### `--linkopt={{ "" }}linker-option{{ "" }}` {:#linkopt} +#### `--linkopt=linker-option` {#linkopt} This option takes an argument which is to be passed to the compiler when linking. @@ -225,15 +223,15 @@ not to compilation. So you can pass compiler options that only make sense at link time (such as `-lssp` or `-Wl,--wrap,abort`) using `--linkopt`. For example: -
+``` % bazel build --copt="-fmudflap" --linkopt="-lmudflap" //foo/buggy_code -+``` Build rules can also specify link options in their attributes. This option's settings always take precedence. Also see [cc_library.linkopts](/versions/9.1.0/reference/be/c-cpp#cc_library.linkopts). -#### `--strip (always|never|sometimes)` {:#strip} +#### `--strip (always|never|sometimes)` {#strip} This option determines whether Bazel will strip debugging information from all binaries and shared libraries, by invoking the linker with the `-Wl,--strip-debug` option. @@ -242,9 +240,9 @@ all binaries and shared libraries, by invoking the linker with the `-Wl,--strip- The default value of `--strip=sometimes` means strip if the `--compilation_mode` is `fastbuild`. -
+``` % bazel build --strip=always //foo:bar -+``` will compile the target while stripping debugging information from all generated binaries. @@ -266,7 +264,7 @@ pass `--stripopt=--strip-all` and explicitly build the `--stripopt`, this applies a strip action after the final binary is linked rather than including stripping in all of the build's link actions. -#### `--stripopt={{ "" }}strip-option{{ "" }}` {:#stripopt} +#### `--stripopt=strip-option` {#stripopt} This is an additional option to pass to the `strip` command when generating a [`*.stripped` binary](/versions/9.1.0/reference/be/c-cpp#cc_binary_implicit_outputs). The default @@ -275,7 +273,7 @@ is `-S -p`. This option can be used multiple times. Note: `--stripopt` does not apply to the stripping of the main binary with `[--strip](#flag--strip)=(always|sometimes)`. -#### `--fdo_instrument={{ "" }}profile-output-dir{{ "" }}` {:#fdo-instrument} +#### `--fdo_instrument=profile-output-dir` {#fdo-instrument} The `--fdo_instrument` option enables the generation of FDO (feedback directed optimization) profile output when the @@ -285,16 +283,16 @@ containing profile information for each .o file. Once the profile data tree has been generated, the profile tree should be zipped up, and provided to the -`--fdo_optimize={{ "" }}profile-zip{{ "" }}` +`--fdo_optimize=profile-zip` Bazel option to enable the FDO-optimized compilation. For the LLVM compiler the argument is also the directory under which the raw LLVM profile data file(s) is dumped. For example: -`--fdo_instrument={{ "" }}/path/to/rawprof/dir/{{ "" }}`. +`--fdo_instrument=/path/to/rawprof/dir/`. The options `--fdo_instrument` and `--fdo_optimize` cannot be used at the same time. -#### `--fdo_optimize={{ "" }}profile-zip{{ "" }}` {:#fdo-optimize} +#### `--fdo_optimize=profile-zip` {#fdo-optimize} The `--fdo_optimize` option enables the use of the per-object file profile information to perform FDO (feedback @@ -315,66 +313,66 @@ extension. The options `--fdo_instrument` and `--fdo_optimize` cannot be used at the same time. -#### `--java_language_version={{ "" }}version{{ "" }}` {:#java-language-version} +#### `--java_language_version=version` {#java-language-version} This option specifies the version of Java sources. For example: -
+``` % bazel build --java_language_version=8 java/com/example/common/foo:all -+``` compiles and allows only constructs compatible with Java 8 specification. -Default value is 11. --> +Default value is 11. Possible values are: 8, 9, 10, 11, 17, and 21 and may be extended by registering custom Java toolchains using `default_java_toolchain`. -#### `--tool_java_language_version={{ "" }}version{{ "" }}` {:#tool-java-language-version} +#### `--tool_java_language_version=version` {#tool-java-language-version} The Java language version used to build tools that are executed during a build. Default value is 11. -#### `--java_runtime_version={{ "" }}version{{ "" }}` {:#java-runtime-version} +#### `--java_runtime_version=version` {#java-runtime-version} This option specifies the version of JVM to use to execute the code and run the tests. For example: -
+``` % bazel run --java_runtime_version=remotejdk_11 java/com/example/common/foo:java_application -+``` downloads JDK 11 from a remote repository and run the Java application using it. Default value is `local_jdk`. -Possible values are: `local_jdk`, `local_jdk_{{ "" }}version{{ "" }}`, +Possible values are: `local_jdk`, `local_jdk_version`, `remotejdk_11`, `remotejdk_17`, and `remotejdk_21`. You can extend the values by registering custom JVM using either `local_java_repository` or `remote_java_repository` repository rules. -#### `--tool_java_runtime_version={{ "" }}version{{ "" }}` {:#tool-java-runtime-version} +#### `--tool_java_runtime_version=version` {#tool-java-runtime-version} The version of JVM used to execute tools that are needed during a build. Default value is `remotejdk_11`. -#### `--jvmopt={{ "" }}jvm-option{{ "" }}` {:#jvmopt} +#### `--jvmopt=jvm-option` {#jvmopt} This option allows option arguments to be passed to the Java VM. It can be used with one big argument, or multiple times with individual arguments. For example: -
+``` % bazel build --jvmopt="-server -Xms256m" java/com/example/common/foo:all -+``` will use the server VM for launching all Java binaries and set the startup heap size for the VM to 256 MB. -#### `--javacopt={{ "" }}javac-option{{ "" }}` {:#javacopt} +#### `--javacopt=javac-option` {#javacopt} This option allows option arguments to be passed to javac. It can be used with one big argument, or multiple times with individual arguments. For example: -
+``` % bazel build --javacopt="-g:source,lines" //myprojects:prog -+``` will rebuild a java_binary with the javac default debug info (instead of the bazel default). @@ -383,16 +381,16 @@ The option is passed to javac after the Bazel built-in default options for javac and before the per-rule options. The last specification of any option to javac wins. The default options for javac are: -
+``` -source 8 -target 8 -encoding UTF-8 -+``` Note: Changing `--javacopt` settings will force a recompilation of all affected classes. Also note that javacopts parameters listed in specific java_library or java_binary build rules will be placed on the javac command line _after_ these options. -#### `--strict_java_deps (default|strict|off|warn|error)` {:#strict-java-deps} +#### `--strict_java_deps (default|strict|off|warn|error)` {#strict-java-deps} This option controls whether javac checks for missing direct dependencies. Java targets must explicitly declare all directly used targets as @@ -408,11 +406,11 @@ of a direct dependency of the current target. target to fail to build if any missing direct dependencies are found. This is also the default behavior when the flag is unspecified. -### Build semantics {:#build-semantics} +### Build semantics {#build-semantics} These options affect the build commands and/or the output file contents. -#### `--compilation_mode (fastbuild|opt|dbg)` (-c) {:#compilation-mode} +#### `--compilation_mode (fastbuild|opt|dbg)` (-c) {#compilation-mode} The `--compilation_mode` option (often shortened to `-c`, especially `-c opt`) takes an argument of `fastbuild`, `dbg` @@ -433,7 +431,7 @@ needing to do a full rebuild _every_ time. Debugging information will not be generated in `opt` mode unless you also pass `--copt -g`. -#### `--cpu={{ "" }}cpu{{ "" }}` {:#cpu} +#### `--cpu=cpu` {#cpu} This option specifies the target CPU architecture to be used for the compilation of binaries during the build. @@ -442,7 +440,7 @@ Note: A particular combination of crosstool version, compiler version, and target CPU is allowed only if it has been specified in the currently used CROSSTOOL file. -#### `--action_env={{ "" }}VAR=VALUE{{ "" }}` {:#action-env} +#### `--action_env=VAR=VALUE` {#action-env} Specifies the set of environment variables available during the execution of all actions. Variables can be either specified by name, in which case the value will be taken from the @@ -452,17 +450,17 @@ invocation environment. This `--action_env` flag can be specified multiple times. If a value is assigned to the same variable across multiple `--action_env` flags, the latest assignment wins. -#### `--experimental_action_listener={{ "" }}label{{ "" }}` {:#experimental-action-listener} +#### `--experimental_action_listener=label` {#experimental-action-listener} Warning: Extra actions are deprecated. Use [aspects](/versions/9.1.0/extending/aspects) instead. The `experimental_action_listener` option instructs Bazel to use -details from the [`action_listener`](/versions/9.1.0/reference/be/extra-actions#action_listener) rule specified by {{ "" }}label{{ "" }} to +details from the [`action_listener`](/versions/9.1.0/reference/be/extra-actions#action_listener) rule specified by label to insert [`extra_actions`](/versions/9.1.0/reference/be/extra-actions#extra_action) into the build graph. -#### `--[no]experimental_extra_action_top_level_only` {:experimental-extra-action-top-level-only} +#### `--[no]experimental_extra_action_top_level_only` {#experimental-extra-action-top-level-only} Warning: Extra actions are deprecated. Use [aspects](/versions/9.1.0/extending/aspects) instead. @@ -471,7 +469,7 @@ If this option is set to true, extra actions specified by the [ `--experimental_action_listener`](#experimental-action-listener) command line option will only be scheduled for top level targets. -#### `--experimental_extra_action_filter={{ "" }}regex{{ "" }}` {:#experimental-extra-action-filter} +#### `--experimental_extra_action_filter=regex` {#experimental-extra-action-filter} Warning: Extra actions are deprecated. Use [aspects](/versions/9.1.0/extending/aspects) instead. @@ -491,16 +489,17 @@ regular expression. The following example will limit scheduling of `extra_actions` to only apply to actions of which the owner's label contains '/bar/': -
% bazel build --experimental_action_listener=//test:al //foo/... \ +``` +% bazel build --experimental_action_listener=//test:al //foo/... \ --experimental_extra_action_filter=.*/bar/.* -+``` -#### `--host_cpu={{ "" }}cpu{{ "" }}` {:#host-cpu} +#### `--host_cpu=cpu` {#host-cpu} This option specifies the name of the CPU architecture that should be used to build host tools. -#### `--android_platforms={{ "" }}platform[,platform]*{{ "" }}` {:#android-platforms} +#### `--android_platforms=platform[,platform]*` {#android-platforms} The platforms to build the transitive `deps` of `android_binary` rules (specifically for native dependencies like C++). For @@ -517,7 +516,7 @@ with `--android_platforms`. The `.so` file's name prefixes the name of the `android_binary` rule with "lib". For example, if the name of the `android_binary` is "foo", then the file is `libfoo.so`. -#### `--per_file_copt={{ "" }}[+-]regex[,[+-]regex]...@option[,option]...{{ "" }}` {:#per-file-copt} +#### `--per_file_copt=[+-]regex[,[+-]regex]...@option[,option]...` {#per-file-copt} When present, any C++ file with a label or an execution path matching one of the inclusion regex expressions and not matching any of the exclusion expressions will be built @@ -558,7 +557,7 @@ to the C++ compiler. If an option contains a `,` it has to be quoted like so adds the `-O0` and the `-fprofile-arcs` options to the command line of the C++ compiler for all `.cc` files in `//foo/` except `file.cc`. -#### `--dynamic_mode={{ "" }}mode{{ "" }}` {:#dynamic-mode} +#### `--dynamic_mode=mode` {#dynamic-mode} Determines whether C++ binaries will be linked dynamically, interacting with the [linkstatic attribute](/versions/9.1.0/reference/be/c-cpp#cc_binary.linkstatic) on build rules. @@ -574,9 +573,9 @@ Modes: [mostly static](/versions/9.1.0/reference/be/c-cpp#cc_binary.linkstatic) mode. If `-static` is set in linkopts, targets will change to fully static. -#### `--fission (yes|no|[dbg][,opt][,fastbuild])` {:#fission} +#### `--fission (yes|no|[dbg][,opt][,fastbuild])` {#fission} -Enables [Fission](https://gcc.gnu.org/wiki/DebugFission){: .external}, +Enables [Fission](https://gcc.gnu.org/wiki/DebugFission), which writes C++ debug information to dedicated .dwo files instead of .o files, where it would otherwise go. This substantially reduces the input size to links and can reduce link times. @@ -587,13 +586,13 @@ settings. When set to `yes`, Fission is enabled universally. When set to `no`, Fission is disabled universally. Default is
no.
-#### `--force_ignore_dash_static` {:#force-ignore-dash-static}
+#### `--force_ignore_dash_static` {#force-ignore-dash-static}
If this flag is set, any `-static` options in linkopts of
`cc_*` rules BUILD files are ignored. This is only intended as a
workaround for C++ hardening builds.
-#### `--[no]force_pic` {:#force-pic}
+#### `--[no]force_pic` {#force-pic}
If enabled, all C++ compilations produce position-independent code ("-fPIC"),
links prefer PIC pre-built libraries over non-PIC libraries, and links produce
@@ -603,38 +602,38 @@ Note: Dynamically linked binaries (for example `--dynamic_mode fully`)
generate PIC code regardless of this flag's setting. So this flag is for cases
where users want PIC code explicitly generated for static links.
-#### `--android_resource_shrinking` {:#flag--android_resource_shrinking}
+#### `--android_resource_shrinking` {#flag--android_resource_shrinking}
Selects whether to perform resource shrinking for android_binary rules. Sets the default for the
[shrink_resources attribute](/versions/9.1.0/reference/be/android#android_binary.shrink_resources) on
android_binary rules; see the documentation for that rule for further details. Defaults to off.
-#### `--custom_malloc={{ "" }}malloc-library-target{{ "" }}` {:#custom-malloc}
+#### `--custom_malloc=malloc-library-target` {#custom-malloc}
When specified, always use the given malloc implementation, overriding all
`malloc="target"` attributes, including in those targets that use the
default (by not specifying any `malloc`).
-#### `--crosstool_top={{ "" }}label{{ "" }}` {:#crosstool-top}
+#### `--crosstool_top=label` {#crosstool-top}
This option specifies the location of the crosstool compiler suite
to be used for all C++ compilation during a build. Bazel will look in that
location for a CROSSTOOL file and uses that to automatically determine
settings for `--compiler`.
-#### `--host_crosstool_top={{ "" }}label{{ "" }}` {:#host-crosstool-top}
+#### `--host_crosstool_top=label` {#host-crosstool-top}
If not specified, Bazel uses the value of `--crosstool_top` to compile
code in the exec configuration, such as tools run during the build. The main purpose of this flag
is to enable cross-compilation.
-#### `--apple_crosstool_top={{ "" }}label{{ "" }}` {:#apple-crosstool-top}
+#### `--apple_crosstool_top=label` {#apple-crosstool-top}
The crosstool to use for compiling C/C++ rules in the transitive `deps` of
objc_*, ios__*, and apple_* rules. For those targets, this flag overwrites
`--crosstool_top`.
-#### `--compiler={{ "" }}version{{ "" }}` {:#compiler}
+#### `--compiler=version` {#compiler}
This option specifies the C/C++ compiler version (such as `gcc-4.1.0`)
to be used for the compilation of binaries during the build. If you want to
@@ -644,7 +643,7 @@ specifying this flag.
Note: Only certain combinations of crosstool version, compiler version,
and target CPU are allowed.
-#### `--android_sdk={{ "" }}label{{ "" }}` {:#android-sdk}
+#### `--android_sdk=label` {#android-sdk}
Deprecated. This shouldn't be directly specified.
@@ -655,30 +654,30 @@ rule.
The Android SDK will be automatically selected if an `android_sdk_repository`
rule is defined in the WORKSPACE file.
-#### `--java_toolchain={{ "" }}label{{ "" }}` {:#java-toolchain}
+#### `--java_toolchain=label` {#java-toolchain}
No-op. Kept only for backwards compatibility.
-#### `--host_java_toolchain={{ "" }}label{{ "" }}` {:#host-java-toolchain}
+#### `--host_java_toolchain=label` {#host-java-toolchain}
No-op. Kept only for backwards compatibility.
-#### `--javabase=({{ "" }}label{{ "" }})` {:#javabase}
+#### `--javabase=(label)` {#javabase}
No-op. Kept only for backwards compatibility.
-#### `--host_javabase={{ "" }}label{{ "" }}` {:#host-javabase}
+#### `--host_javabase=label` {#host-javabase}
No-op. Kept only for backwards compatibility.
-### Execution strategy {:#execution-strategy}
+### Execution strategy {#execution-strategy}
These options affect how Bazel will execute the build.
They should not have any significant effect on the output files
generated by the build. Typically their main effect is on the
speed of the build.
-#### `--spawn_strategy={{ "" }}strategy{{ "" }}` {:#spawn-strategy}
+#### `--spawn_strategy=strategy` {#spawn-strategy}
This option controls where and how commands are executed.
@@ -695,7 +694,7 @@ This option controls where and how commands are executed.
* `remote` causes commands to be executed remotely; this is only available if a
remote executor has been configured separately.
-#### `--strategy {{ "" }}mnemonic{{ "" }}={{ "" }}strategy{{ "" }}` {:#strategy}
+#### `--strategy mnemonic=strategy` {#strategy}
This option controls where and how commands are executed, overriding the
[--spawn_strategy](#spawn-strategy) (and
@@ -704,7 +703,7 @@ Genrule) on a per-mnemonic basis. See
[--spawn_strategy](#spawn-strategy) for the supported
strategies and their effects.
-#### `--strategy_regexp={{ "" }}+``` % bazel test --test_size_filters=small,medium //foo:all -+``` and -
+``` % bazel test --test_size_filters=-large,-enormous //foo:all -+``` will test only small and medium tests inside //foo. By default, test size filtering is not applied. -#### `--test_timeout_filters={{ "" }}timeout[,timeout]*{{ "" }}` {:#test-timeout-filters} +#### `--test_timeout_filters=timeout[,timeout]*` {#test-timeout-filters} If specified, Bazel will test (or build if `--build_tests_only` is also specified) only test targets with the given timeout. Test timeout filter @@ -972,7 +971,7 @@ for example syntax. By default, test timeout filtering is not applied. -#### `--test_tag_filters={{ "" }}tag[,tag]*{{ "" }}` {:#test-tag-filters} +#### `--test_tag_filters=tag[,tag]*` {#test-tag-filters} If specified, Bazel will test (or build if `--build_tests_only` is also specified) only test targets that have at least one required tag @@ -983,9 +982,9 @@ have a preceding '+' sign. For example, -
+``` % bazel test --test_tag_filters=performance,stress,-flaky //myproject:all -+``` will test targets that are tagged with either `performance` or `stress` tag but are **not** tagged with the `flaky` tag. @@ -994,7 +993,7 @@ By default, test tag filtering is not applied. Note that you can also filter on test's `size` and `local` tags in this manner. -#### `--test_lang_filters={{ "" }}string[,string]*{{ "" }}` {:#test-lang-filters} +#### `--test_lang_filters=string[,string]*` {#test-lang-filters} Specifies a comma-separated list of strings referring to names of test rule classes. To refer to the rule class `foo_test`, use the string "foo". Bazel will @@ -1002,17 +1001,17 @@ test (or build if `--build_tests_only` is also specified) only targets of the referenced rule classes. To instead exclude those targets, use the string "-foo". For example, - -
+ +``` % bazel test --test_lang_filters=foo,bar //baz/... -+```
will test only targets that are instances of `foo_test` or `bar_test` in `//baz/...`, while
-+``` % bazel test --test_lang_filters=-foo,-bar //baz/... -+```
will test all the targets in `//baz/...` except for the `foo_test` and `bar_test` instances. @@ -1028,25 +1027,25 @@ Warning: The option name "--test_lang_filter" is vestigal and is therefore unfortunately misleading; don't make assumptions about the semantics based on the name. -#### `--test_filter={{ "" }}filter-expression{{ "" }}` {:#test-filter} +#### `--test_filter=filter-expression` {#test-filter} Specifies a filter that the test runner may use to pick a subset of tests for running. All targets specified in the invocation are built, but depending on the expression only some of them may be executed; in some cases, only certain test methods are run. -The particular interpretation of {{ "" }}filter-expression{{ "" }} is up to +The particular interpretation of filter-expression is up to the test framework responsible for running the test. It may be a glob, substring, or regexp. `--test_filter` is a convenience over passing different `--test_arg` filter arguments, but not all frameworks support it. -### Verbosity {:#verbosity} +### Verbosity {#verbosity} These options control the verbosity of Bazel's output, either to the terminal, or to additional log files. -#### `--explain={{ "" }}logfile{{ "" }}` {:#explain} +#### `--explain=logfile` {#explain} This option, which requires a filename argument, causes the dependency checker in `bazel build`'s execution phase to @@ -1061,7 +1060,7 @@ when you see an execution step executed unexpectedly. This option may carry a small performance penalty, so you might want to remove it when it is no longer needed. -#### `--verbose_explanations` {:#verbose-explanations} +#### `--verbose_explanations` {#verbose-explanations} This option increases the verbosity of the explanations generated when the [--explain](#explain) option is enabled. @@ -1079,31 +1078,31 @@ generated explanation file and the performance penalty of using If `--explain` is not enabled, then `--verbose_explanations` has no effect. -#### `--profile={{ "" }}file{{ "" }}` {:#profile} +#### `--profile=file` {#profile} This option, which takes a filename argument, causes Bazel to write profiling data into a file. The data then can be analyzed or parsed using the `bazel analyze-profile` command. The Build profile can be useful in understanding where Bazel's `build` command is spending its time. -#### `--[no]show_loading_progress` {:#show-loading-progress} +#### `--[no]show_loading_progress` {#show-loading-progress} This option causes Bazel to output package-loading progress messages. If it is disabled, the messages won't be shown. -#### `--[no]show_progress` {:#show-progress} +#### `--[no]show_progress` {#show-progress} This option causes progress messages to be displayed; it is on by default. When disabled, progress messages are suppressed. -#### `--show_progress_rate_limit={{ "" }}n{{ "" }}` {:#show-progress-rate} +#### `--show_progress_rate_limit=n` {#show-progress-rate} This option causes bazel to display at most one progress message per `n` seconds, -where {{ "" }}n{{ "" }} is a real number. +where n is a real number. The default value for this option is 0.02, meaning bazel will limit the progress messages to one per every 0.02 seconds. -#### `--show_result={{ "" }}n{{ "" }}` {:#show-result} +#### `--show_result=n` {#show-result} This option controls the printing of result information at the end of a `bazel build` command. By default, if a single @@ -1137,23 +1136,23 @@ filename to the shell, to run built executables. The "up-to-date" or "failed" messages for each target can be easily parsed by scripts which drive a build. -#### `--sandbox_debug` {:#sandbox-debug} +#### `--sandbox_debug` {#sandbox-debug} This option causes Bazel to print extra debugging information when using sandboxing for action execution. This option also preserves sandbox directories, so that the files visible to actions during execution can be examined. -#### `--subcommands` (`-s`) {:#subcommands} +#### `--subcommands` (`-s`) {#subcommands} This option causes Bazel's execution phase to print the full command line for each command prior to executing it. -
- >>>>> # //examples/cpp:hello-world [action 'Linking examples/cpp/hello-world']
+```
+ >>>>> # //examples/cpp:hello-world [action 'Linking examples/cpp/hello-world']
(cd /home/johndoe/.cache/bazel/_bazel_johndoe/4c084335afceb392cfbe7c31afee3a9f/bazel && \
exec env - \
/usr/bin/gcc -o bazel-out/local-fastbuild/bin/examples/cpp/hello-world -B/usr/bin/ -Wl,-z,relro,-z,now -no-canonical-prefixes -pass-exit-codes -Wl,-S -Wl,@bazel-out/local_linux-fastbuild/bin/examples/cpp/hello-world-2.params)
-
+```
Where possible, commands are printed in a Bourne shell compatible syntax,
so that they can be easily copied and pasted to a shell command prompt.
@@ -1173,7 +1172,7 @@ For logging subcommands to a file in a tool-friendly format, see
and
[--execution_log_binary_file](/versions/9.1.0/reference/command-line-reference#flag--execution_log_binary_file).
-#### `--verbose_failures` {:#verbose-failures}
+#### `--verbose_failures` {#verbose-failures}
This option causes Bazel's execution phase to print the full command line
for commands that failed. This can be invaluable for debugging a
@@ -1182,14 +1181,14 @@ failing build.
Failing commands are printed in a Bourne shell compatible syntax, suitable
for copying and pasting to a shell prompt.
-### Workspace status {:#workspace-status}
+### Workspace status {#workspace-status}
Use these options to "stamp" Bazel-built binaries: to embed additional information into the
binaries, such as the source control revision or other workspace-related information. You can use
this mechanism with rules that support the `stamp` attribute, such as
`genrule`, `cc_binary`, and more.
-#### `--workspace_status_command={{ "" }}program{{ "" }}` {:#workspace-status-command}
+#### `--workspace_status_command=program` {#workspace-status-command}
This flag lets you specify a binary that Bazel runs before each build. The program can report
information about the status of the workspace, such as the current source control revision.
@@ -1251,18 +1250,18 @@ If the workspace status command fails (exits non-zero) for any reason, the build
Example program on Linux using Git:
-+``` #!/bin/bash echo "CURRENT_TIME $(date +%s)" echo "RANDOM_HASH $(cat /proc/sys/kernel/random/uuid)" echo "STABLE_GIT_COMMIT $(git rev-parse HEAD)" echo "STABLE_USER_NAME $USER" -+``` Pass this program's path with `--workspace_status_command`, and the stable status file will include the STABLE lines and the volatile status file will include the rest of the lines. -#### `--[no]stamp` {:#stamp} +#### `--[no]stamp` {#stamp} This option, in conjunction with the `stamp` rule attribute, controls whether to embed build information in binaries. @@ -1281,23 +1280,23 @@ their dependencies have not changed. Setting `--nostamp` is generally desireable for build performance, as it reduces input volatility and maximizes build caching. -### Platform {:#platform} +### Platform {#platform} Use these options to control the host and target platforms that configure how builds work, and to control what execution platforms and toolchains are available to Bazel rules. Please see background information on [Platforms](/versions/9.1.0/extending/platforms) and [Toolchains](/versions/9.1.0/extending/toolchains). -#### `--platforms={{ "" }}labels{{ "" }}` {:#platforms} +#### `--platforms=labels` {#platforms} The labels of the platform rules describing the target platforms for the current command. -#### `--host_platform={{ "" }}label{{ "" }}` {:#host-platform} +#### `--host_platform=label` {#host-platform} The label of a platform rule that describes the host system. -#### `--extra_execution_platforms={{ "" }}labels{{ "" }}` {:#extra-execution-platforms} +#### `--extra_execution_platforms=labels` {#extra-execution-platforms} The platforms that are available as execution platforms to run actions. Platforms can be specified by exact target, or as a target pattern. These @@ -1306,29 +1305,29 @@ platforms will be considered before those declared in MODULE.bazel files by This option accepts a comma-separated list of platforms in order of priority. If the flag is passed multiple times, the most recent overrides. -#### `--extra_toolchains={{ "" }}labels{{ "" }}` {:#extra-toolchains} +#### `--extra_toolchains=labels` {#extra-toolchains} The toolchain rules to be considered during toolchain resolution. Toolchains can be specified by exact target, or as a target pattern. These toolchains will be considered before those declared in MODULE.bazel files by [register_toolchains()](/versions/9.1.0/rules/lib/globals/module#register_toolchains). -#### `--toolchain_resolution_debug={{ "" }}regex{{ "" }}` {:#toolchain-resolution-debug} +#### `--toolchain_resolution_debug=regex` {#toolchain-resolution-debug} Print debug information while finding toolchains if the toolchain type matches the regex. Multiple regexes can be separated by commas. The regex can be negated by using a `-` at the beginning. This might help developers of Bazel or Starlark rules with debugging failures due to missing toolchains. -### Miscellaneous {:#miscellaneous} +### Miscellaneous {#miscellaneous} -#### `--flag_alias={{ "" }}alias_name=target_path{{ "" }}` {:#flag-alias} +#### `--flag_alias=alias_name=target_path` {#flag-alias} A convenience flag used to bind longer Starlark build settings to a shorter name. For more details, see the [Starlark Configurations](/versions/9.1.0/extending/config#using-build-setting-aliases). -#### `--symlink_prefix={{ "" }}string{{ "" }}` {:#symlink-prefix} +#### `--symlink_prefix=string` {#symlink-prefix} Changes the prefix of the generated convenience symlinks. The default value for the symlink prefix is `bazel-` which @@ -1356,7 +1355,7 @@ Some common values of this option: `--symlink_prefix=.bazel/` will cause Bazel to create symlinks called `bin` (etc) inside a hidden directory `.bazel`. -#### `--platform_suffix={{ "" }}string{{ "" }}` {:#platform-suffix} +#### `--platform_suffix=string` {#platform-suffix} Adds a suffix to the configuration short name, which is used to determine the output directory. Setting this option to different values puts the files into @@ -1364,22 +1363,22 @@ different directories, for example to improve cache hit rates for builds that otherwise clobber each others output files, or to keep the output files around for comparisons. -#### `--default_visibility={{ "" }}(private|public){{ "" }}` {:#default-visibility} +#### `--default_visibility=(private|public)` {#default-visibility} Temporary flag for testing bazel default visibility changes. Not intended for general use but documented for completeness' sake. -#### `--starlark_cpu_profile=_file_` {:#starlark-cpu-profile} +#### `--starlark_cpu_profile=_file_` {#starlark-cpu-profile} This flag, whose value is the name of a file, causes Bazel to gather statistics about CPU usage by all Starlark threads, -and write the profile, in [pprof](https://github.com/google/pprof){: .external} format, +and write the profile, in [pprof](https://github.com/google/pprof) format, to the named file. Use this option to help identify Starlark functions that make loading and analysis slow due to excessive computation. For example: -
+```
$ bazel build --nobuild --starlark_cpu_profile=/tmp/pprof.gz my/project/...
$ pprof /tmp/pprof.gz
(pprof) top
@@ -1395,19 +1394,19 @@ Showing nodes accounting for 3.34s, 100% of 3.34s total
0 0% 100% 1.38s 41.32% my/project/main/BUILD
0 0% 100% 1.96s 58.68% my/project/library.bzl
0 0% 100% 3.34s 100% main
-
+```
For different views of the same data, try the `pprof` commands `svg`,
`web`, and `list`.
-## Using Bazel for releases {:#bazel-for-releases}
+## Using Bazel for releases {#bazel-for-releases}
Bazel is used both by software engineers during the development
cycle, and by release engineers when preparing binaries for deployment
to production. This section provides a list of tips for release
engineers using Bazel.
-### Significant options {:#significant-options}
+### Significant options {#significant-options}
When using Bazel for release builds, the same issues arise as for other scripts
that perform a build. For more details, see
@@ -1426,7 +1425,7 @@ These options are also important:
with a distinct identifier, such as "64bit" vs. "32bit". This option
differentiates the `bazel-bin` (etc.) symlinks.
-## Running tests {:#running-tests}
+## Running tests {#running-tests}
To build and run tests with bazel, type `bazel test` followed by
the name of the test targets.
@@ -1439,9 +1438,9 @@ their prerequisites are built, meaning that test execution is
interleaved with building. Doing so usually results in significant
speed gains.
-### Options for `bazel test` {:#bazel-test-options}
+### Options for `bazel test` {#bazel-test-options}
-#### `--cache_test_results=(yes|no|auto)` (`-t`) {:#cache-test-results}
+#### `--cache_test_results=(yes|no|auto)` (`-t`) {#cache-test-results}
If this option is set to 'auto' (the default) then Bazel will only rerun a test if any of the
following conditions applies:
@@ -1469,7 +1468,7 @@ their `.bazelrc` file may find the
abbreviations `-t` (on) or `-t-` (off)
convenient for overriding the default on a particular run.
-#### `--check_tests_up_to_date` {:#check-tests-up-to-date}
+#### `--check_tests_up_to_date` {#check-tests-up-to-date}
This option tells Bazel not to run the tests, but to merely check and report
the cached test results. If there are any tests which have not been
@@ -1484,7 +1483,7 @@ This option also implies
This option may be useful for pre-submit checks.
-#### `--test_verbose_timeout_warnings` {:#test-verbose-timeout-warnings}
+#### `--test_verbose_timeout_warnings` {#test-verbose-timeout-warnings}
This option tells Bazel to explicitly warn the user if a test's timeout is
significantly longer than the test's actual execution time. While a test's
@@ -1501,14 +1500,14 @@ Note: Each test shard is allotted the timeout of the entire
`XX_test` target. Using this option does not affect a test's timeout
value, merely warns if Bazel thinks the timeout could be restricted further.
-#### `--[no]test_keep_going` {:#test-keep-going}
+#### `--[no]test_keep_going` {#test-keep-going}
By default, all tests are run to completion. If this flag is disabled,
however, the build is aborted on any non-passing test. Subsequent build steps
and test invocations are not run, and in-flight invocations are canceled.
Do not specify both `--notest_keep_going` and `--keep_going`.
-#### `--flaky_test_attempts={{ "" }}attempts{{ "" }}` {:#flaky-test-attempts}
+#### `--flaky_test_attempts=attempts` {#flaky-test-attempts}
This option specifies the maximum number of times a test should be attempted
if it fails for any reason. A test that initially fails but eventually
@@ -1523,7 +1522,7 @@ default), only a single attempt is allowed for regular tests, and
an integer value to override the maximum limit of test attempts. Bazel allows
a maximum of 10 test attempts in order to prevent abuse of the system.
-#### `--runs_per_test={{ "" }}[regex@]number{{ "" }}` {:#runs-per-test}
+#### `--runs_per_test=[regex@]number` {#runs-per-test}
This option specifies the number of times each test should be executed. All
test executions are treated as separate tests (fallback functionality
@@ -1544,7 +1543,7 @@ which match the regex (`--runs_per_test=^//pizza:.*@4` runs all tests
under `//pizza/` 4 times).
This form of `--runs_per_test` may be specified more than once.
-#### `--[no]runs_per_test_detects_flakes` {:#run-per-test-detects-flakes}
+#### `--[no]runs_per_test_detects_flakes` {#run-per-test-detects-flakes}
If this option is specified (by default it is not), Bazel will detect flaky
test shards through `--runs_per_test`. If one or more runs for a single shard
@@ -1552,7 +1551,7 @@ fail and one or more runs for the same shard pass, the target will be
considered flaky with the flag. If unspecified, the target will report a
failing status.
-#### `--test_summary={{ "" }}output_style{{ "" }}` {:#test-summary}
+#### `--test_summary=output_style` {#test-summary}
Specifies how the test result summary should be displayed.
@@ -1565,7 +1564,7 @@ Specifies how the test result summary should be displayed.
only each test. The names of test output files are omitted.
* `none` does not print test summary.
-#### `--test_output={{ "" }}output_style{{ "" }}` {:#test-output}
+#### `--test_output=output_style` {#test-output}
Specifies how test output should be displayed:
@@ -1583,12 +1582,12 @@ Specifies how test output should be displayed:
* `streamed` streams stdout/stderr output from each test in
real-time.
-#### `--java_debug` {:#java-debug}
+#### `--java_debug` {#java-debug}
This option causes the Java virtual machine of a java test to wait for a connection from a
JDWP-compliant debugger before starting the test. This option implies `--test_output=streamed`.
-#### `--[no]verbose_test_summary` {:#verbose-test-summary}
+#### `--[no]verbose_test_summary` {#verbose-test-summary}
By default this option is enabled, causing test times and other additional
information (such as test attempts) to be printed to the test summary. If
@@ -1596,7 +1595,7 @@ information (such as test attempts) to be printed to the test summary. If
include only test name, test status and cached test indicator and will
be formatted to stay within 80 characters when possible.
-#### `--test_tmpdir={{ "" }}path{{ "" }}` {:#test-tmpdir}
+#### `--test_tmpdir=path` {#test-tmpdir}
Specifies temporary directory for tests executed locally. Each test will be
executed in a separate subdirectory inside this directory. The directory will
@@ -1606,7 +1605,7 @@ By default, bazel will place this directory under Bazel output base directory.
Note: This is a directory for running tests, not storing test results
(those are always stored under the `bazel-out` directory).
-#### `--test_timeout={{ "" }}seconds{{ "" }}` OR `--test_timeout={{ "" }}seconds{{ "" }},{{ "" }}seconds{{ "" }},{{ "" }}seconds{{ "" }},{{ "" }}seconds{{ "" }}` {:#test-timeout}
+#### `--test_timeout=seconds` OR `--test_timeout=seconds,seconds,seconds,seconds` {#test-timeout}
Overrides the timeout value for all tests by using specified number of
seconds as a new timeout value. If only one value is provided, then it will
@@ -1628,7 +1627,7 @@ the size tag. So a test of size 'small' which declares a 'long' timeout will
have the same effective timeout that a 'large' tests has with no explicit
timeout.
-#### `--test_arg={{ "" }}arg{{ "" }}` {:#test-arg}
+#### `--test_arg=arg` {#test-arg}
Passes command-line options/flags/arguments to each test process. This
option can be used multiple times to pass several arguments. For example,
@@ -1646,21 +1645,21 @@ target being run is a test target. (As with any other flag, if it's passed in a
`bazel run` command after a `--` token, it's not processed by Bazel but
forwarded verbatim to the executed target.)
-#### `--test_env={{ "" }}variable{{ "" }}=_value_` OR `--test_env={{ "" }}variable{{ "" }}` {:#test-env}
+#### `--test_env=variable=_value_` OR `--test_env=variable` {#test-env}
Specifies additional variables that must be injected into the test
-environment for each test. If {{ "" }}value{{ "" }} is not specified it will be
+environment for each test. If value is not specified it will be
inherited from the shell environment used to start the `bazel test`
command.
The environment can be accessed from within a test by using
`System.getenv("var")` (Java), `getenv("var")` (C or C++),
-#### `--run_under={{ "" }}command-prefix{{ "" }}` {:#test-run-under}
+#### `--run_under=command-prefix` {#test-run-under}
This specifies a prefix that the test runner will insert in front
of the test command before running it. The
-{{ "" }}command-prefix{{ "" }} is split into words using Bourne shell
+command-prefix is split into words using Bourne shell
tokenization rules, and then the list of words is prepended to the
command that will be executed.
@@ -1673,20 +1672,20 @@ Some caveats apply:
* The PATH used for running tests may be different than the PATH in your environment,
so you may need to use an **absolute path** for the `--run_under`
- command (the first word in {{ "" }}command-prefix{{ "" }}).
+ command (the first word in command-prefix).
* **`stdin` is not connected**, so `--run_under`
can't be used for interactive commands.
Examples:
-
+```
--run_under=/usr/bin/strace
--run_under='/usr/bin/strace -c'
--run_under=/usr/bin/valgrind
--run_under='/usr/bin/valgrind --quiet --num-callers=20'
-
+```
-#### Test selection {:#test-selection}
+#### Test selection {#test-selection}
As documented under [Output selection options](#output-selection),
you can filter tests by [size](#test-size-filters),
@@ -1696,18 +1695,18 @@ you can filter tests by [size](#test-size-filters),
[general name filter](#test-filter) can forward particular
filter args to the test runner.
-#### Other options for `bazel test` {:#bazel-test-other-options}
+#### Other options for `bazel test` {#bazel-test-other-options}
The syntax and the remaining options are exactly like
[`bazel build`](/versions/9.1.0/run/build).
-## Running executables {:#running-executables}
+## Running executables {#running-executables}
The `bazel run` command is similar to `bazel build`, except
it is used to build _and run_ a single target. Here is a typical session
(`//java/myapp:myapp` says hello and prints out its args):
-+``` % bazel run java/myapp:myapp -- --arg1 --arg2 INFO: Analyzed target //java/myapp:myapp (13 packages loaded, 27 targets configured). INFO: Found 1 target... @@ -1720,7 +1719,7 @@ it is used to build _and run_ a single target. Here is a typical session $EXEC_ROOT/java/myapp/myapp --arg1 --arg2 -+``` Note: `--` is needed so that Bazel does not interpret `--arg1` and `--arg2` as @@ -1756,9 +1755,9 @@ The following extra environment variables are also available to the binary: These can be used, for example, to interpret file names on the command line in a user-friendly way. -### Options for `bazel run` {:#bazel-run-options} +### Options for `bazel run` {#bazel-run-options} -#### `--run_under={{ "" }}command-prefix{{ "" }}` {:#run-run-under} +#### `--run_under=command-prefix` {#run-run-under} This has the same effect as the `--run_under` option for `bazel test` ([see above](#test-run-under)), @@ -1776,7 +1775,7 @@ suppress the outputs from Bazel itself with the `--ui_event_filters` and For example: `bazel run --ui_event_filters=-info,-stdout,-stderr --noshow_progress //java/myapp:myapp` -### Executing tests {:#executing-tests} +### Executing tests {#executing-tests} `bazel run` can also execute test binaries, which has the effect of running the test in a close approximation of the environment described at @@ -1784,9 +1783,9 @@ running the test in a close approximation of the environment described at `--test_*` arguments have an effect when running a test in this manner except `--test_arg` . -## Cleaning build outputs {:#cleaning-build-outputs} +## Cleaning build outputs {#cleaning-build-outputs} -### The `clean` command {:#clean} +### The `clean` command {#clean} Bazel has a `clean` command, analogous to that of Make. It deletes the output directories for all build configurations performed @@ -1808,9 +1807,9 @@ stops the Bazel server after the clean, equivalent to the [`shutdown`](#shutdown clean up all disk and memory traces of a Bazel instance, you could specify: -
+``` % bazel clean --expunge -+``` Alternatively, you can expunge in the background by using `--expunge_async`. It is safe to invoke a Bazel command @@ -1829,7 +1828,7 @@ these bugs are a high priority to be fixed. If you ever find an incorrect incremental build, file a bug report, and report bugs in the tools rather than using `clean`. -## Querying the dependency graph {:#querying-dependency-graph} +## Querying the dependency graph {#querying-dependency-graph} Bazel includes a query language for asking questions about the dependency graph used during the build. The query language is used @@ -1863,11 +1862,11 @@ but added by bazel. Example: "Show the locations of the definitions (in BUILD files) of all genrules required to build all the tests in the PEBL tree." -
+```
bazel query --output location 'kind(genrule, deps(kind(".*_test rule", foo/bar/pebl/...)))'
-
+```
-## Querying the action graph {:#aquery}
+## Querying the action graph {#aquery}
Caution: The aquery command is still experimental and its API will change.
@@ -1888,9 +1887,9 @@ It supports the same set of functions that is also available to traditional
For more details, see [Action Graph Query](/versions/9.1.0/query/aquery).
-## Miscellaneous commands and options {:#misc-commands-options}
+## Miscellaneous commands and options {#misc-commands-options}
-### `help` {:#help}
+### `help` {#help}
The `help` command provides on-line help. By default, it
shows a summary of available commands and help topics, as shown in
@@ -1900,14 +1899,14 @@ topic. Most topics are Bazel commands, such as `build`
or `query`, but there are some additional help topics
that do not correspond to commands.
-#### `--[no]long` (`-l`) {:#long}
+#### `--[no]long` (`-l`) {#long}
-By default, `bazel help [{{ "" }}topic{{ "" }}]` prints only a
+By default, `bazel help [topic]` prints only a
summary of the relevant options for a topic. If
the `--long` option is specified, the type, default value
and full description of each option is also printed.
-### `shutdown` {:#shutdown}
+### `shutdown` {#shutdown}
Bazel server processes may be stopped by using the `shutdown`
command. This command causes the Bazel server to exit as soon as it
@@ -1927,7 +1926,7 @@ useful for scripts that initiate a lot of builds, as any memory
leaks in the Bazel server could cause it to crash spuriously on
occasion; performing a conditional restart preempts this condition.
-### `info` {:#info}
+### `info` {#info}
The `info` command prints various values associated with
the Bazel server instance, or with a specific build configuration.
@@ -1935,12 +1934,12 @@ the Bazel server instance, or with a specific build configuration.
The `info` command also permits a single (optional)
argument, which is the name of one of the keys in the list below.
-In this case, `bazel info {{ "" }}key{{ "" }}` will print only
+In this case, `bazel info key` will print only
the value for that one key. (This is especially convenient when
scripting Bazel, as it avoids the need to pipe the result
through `sed -ne /key:/s/key://p`:
-#### Configuration-independent data {:#configuration-independent-data}
+#### Configuration-independent data {#configuration-independent-data}
* `release`: the release label for this Bazel
instance, or "development version" if this is not a released
@@ -1994,11 +1993,12 @@ through `sed -ne /key:/s/key://p`:
Example: the process ID of the Bazel server.
-% bazel info server_pid +``` +% bazel info server_pid 1285 -+``` -#### Configuration-specific data {:#configuration-specific-data} +#### Configuration-specific data {#configuration-specific-data} These data may be affected by the configuration options passed to `bazel info`, for @@ -2028,23 +2028,24 @@ Example: the C++ compiler for the current configuration. This is the `$(CC)` variable in the "Make" environment, so the `--show_make_env` flag is needed. -
+``` % bazel info --show_make_env -c opt COMPILATION_MODE opt -+``` Example: the `bazel-bin` output directory for the current configuration. This is guaranteed to be correct even in cases where the `bazel-bin` symlink cannot be created for some reason (such as if you are building from a read-only directory). -
% bazel info --cpu=piii bazel-bin +``` +% bazel info --cpu=piii bazel-bin /var/tmp/_bazel_johndoe/fbd0e8a34f61ce5d491e3da69d959fe6/execroot/io_bazel/bazel-out/piii-opt/bin % bazel info --cpu=k8 bazel-bin /var/tmp/_bazel_johndoe/fbd0e8a34f61ce5d491e3da69d959fe6/execroot/io_bazel/bazel-out/k8-opt/bin -+``` -### `version` and `--version` {:#version} +### `version` and `--version` {#version} The version command prints version details about the built Bazel binary, including the changelist at which it was built and the date. @@ -2063,7 +2064,7 @@ are: a Bazel server or unpacking the server archive. `bazel --version` can be run from anywhere - it does not require a workspace directory. -### `mobile-install` {:#mobile-install} +### `mobile-install` {#mobile-install} The `mobile-install` command installs apps to mobile devices. Currently only Android devices running ART are supported. @@ -2077,7 +2078,7 @@ transparent to the app. The following options are supported: -#### `--incremental` {:#incremental} +#### `--incremental` {#incremental} If set, Bazel tries to install the app incrementally, that is, only those parts that have changed since the last build. This cannot update resources @@ -2091,23 +2092,23 @@ when a full install is needed. If you are using a device with Marshmallow or later, consider the [`--split_apks`](#split-apks) flag. -#### `--split_apks` {:#split-apks} +#### `--split_apks` {#split-apks} Whether to use split apks to install and update the application on the device. Works only with devices with Marshmallow or later. Note that the [`--incremental`](#incremental) flag is not necessary when using `--split_apks`. -#### `--start_app` {:#start-app} +#### `--start_app` {#start-app} Starts the app in a clean state after installing. Equivalent to `--start=COLD`. -#### `--debug_app` {:#debug-app} +#### `--debug_app` {#debug-app} Waits for debugger to be attached before starting the app in a clean state after installing. Equivalent to `--start=DEBUG`. -#### `--start=_start_type_` {:#start} +#### `--start=_start_type_` {#start} How the app should be started after installing it. Supported _start_type_s are: @@ -2120,34 +2121,35 @@ How the app should be started after installing it. Supported _start_type_s are: Note: If more than one of `--start=_start_type_`, `--start_app` or `--debug_app` is set, the last value is used. -#### `--adb={{ "" }}path{{ "" }}` {:#adb} +#### `--adb=path` {#adb} Indicates the `adb` binary to be used. The default is to use the adb in the Android SDK specified by [`--android_sdk`](#android-sdk). -#### `--adb_arg={{ "" }}serial{{ "" }}` {:#adb-arg} +#### `--adb_arg=serial` {#adb-arg} Extra arguments to `adb`. These come before the subcommand in the command line and are typically used to specify which device to install to. For example, to select the Android device or emulator to use: -
% bazel mobile-install --adb_arg=-s --adb_arg=deadbeef -+``` +% bazel mobile-install --adb_arg=-s --adb_arg=deadbeef +``` invokes `adb` as -
+``` adb -s deadbeef install ... -+``` -#### `--incremental_install_verbosity={{ "" }}number{{ "" }}` {:#incremental-install-verbosity} +#### `--incremental_install_verbosity=number` {#incremental-install-verbosity} The verbosity for incremental install. Set to 1 for debug logging to be printed to the console. -### `dump` {:#dump} +### `dump` {#dump} The `dump` command prints to stdout a dump of the internal state of the Bazel server. This command is intended @@ -2170,7 +2172,7 @@ Following options are supported: [pprof](https://github.com/google/pprof) compatible .gz file to the specified path. You must enable memory tracking for this to work. -#### Memory tracking {:#memory-tracking} +#### Memory tracking {#memory-tracking} Some `dump` commands require memory tracking. To turn this on, you have to pass startup flags to Bazel: @@ -2187,7 +2189,7 @@ restart. Example: -
+```
% bazel --host_jvm_args=-javaagent:$BAZEL/third_party/allocation_instrumenter/java-allocation-instrumenter-3.3.4.jar \
--host_jvm_args=-DRULE_MEMORY_TRACKER=1 \
build --nobuild <targets>
@@ -2202,15 +2204,15 @@ Example:
--host_jvm_args=-DRULE_MEMORY_TRACKER=1 \
dump --skylark_memory=$HOME/prof.gz
% pprof -flame $HOME/prof.gz
-
+```
-### `analyze-profile` {:#analyze-profile}
+### `analyze-profile` {#analyze-profile}
The `analyze-profile` command analyzes a
[JSON trace profile](/versions/9.1.0/advanced/performance/json-trace-profile) previously
gathered during a Bazel invocation.
-### `canonicalize-flags` {:#canonicalize-flags}
+### `canonicalize-flags` {#canonicalize-flags}
The [`canonicalize-flags`](/versions/9.1.0/reference/command-line-reference#canonicalize-flags-options)
command, which takes a list of options for a Bazel command and returns a list of
@@ -2227,13 +2229,13 @@ _does not_ expand flags from `--config`.
As an example:
-+``` % bazel canonicalize-flags -- --config=any_name --test_tag_filters="-lint" --config=any_name --test_tag_filters=-lint -+``` -### Startup options {:#startup-options} +### Startup options {#startup-options} The options described in this section affect the startup of the Java virtual machine used by Bazel server process, and they apply to all @@ -2246,7 +2248,7 @@ All of the options described in this section must be specified using the syntax. Also, these options must appear _before_ the name of the Bazel command. Use `startup --key=value` to list these in a `.bazelrc` file. -#### `--output_base={{ "" }}dir{{ "" }}` {:#output-base} +#### `--output_base=dir` {#output-base} This option requires a path argument, which must specify a writable directory. Bazel will use this location to write all its @@ -2267,10 +2269,10 @@ workspace directory by varying the output base. For example: -
+```
OUTPUT_BASE=/var/tmp/google/_bazel_johndoe/custom_output_base
% bazel --output_base ${OUTPUT_BASE}1 build //foo & bazel --output_base ${OUTPUT_BASE}2 build //bar
-
+```
In this command, the two Bazel commands run concurrently (because of
the shell `&` operator), each using a different Bazel
@@ -2283,13 +2285,13 @@ by an incremental build of `//bar`.
Note: We recommend you do not use an NFS or similar networked file system for the root
directory, as the higher access latency will cause noticeably slower builds.
-#### `--output_user_root={{ "" }}dir{{ "" }}` {:#output-user-root}
+#### `--output_user_root=dir` {#output-user-root}
Points to the root directory where output and install bases are created. The directory
must either not exist or be owned by the calling user. In the past,
this was allowed to point to a directory shared among various users
but it's not allowed any longer. This may be allowed once
-[issue #11100](https://github.com/bazelbuild/bazel/issues/11100){: .external} is addressed.
+[issue #11100](https://github.com/bazelbuild/bazel/issues/11100) is addressed.
If the `--output_base` option is specified, it overrides
using `--output_user_root` to calculate the output base.
@@ -2305,15 +2307,15 @@ base) if there is a better location in your filesystem layout.
Note: We recommend you do not use an NFS or similar networked file system for the root
directory, as the higher access latency will cause noticeably slower builds.
-#### `--server_javabase={{ "" }}dir{{ "" }}` {:#server-javabase}
+#### `--server_javabase=dir` {#server-javabase}
Specifies the Java virtual machine in which _Bazel itself_ runs. The value must be a path to
the directory containing a JDK or JRE. It should not be a label.
This option should appear before any Bazel command, for example:
-+``` % bazel --server_javabase=/usr/local/buildtools/java/jdk build //foo -+``` This flag does _not_ affect the JVMs used by Bazel subprocesses such as applications, tests, tools, and so on. Use build options [--javabase](#javabase) or @@ -2324,14 +2326,14 @@ This flag was previously named `--host_javabase` (sometimes referred to as the build flag [--host_javabase](#host-javabase) (sometimes referred to as the 'right-hand side' `--host_javabase`). -#### `--host_jvm_args={{ "" }}string{{ "" }}` {:#host-jvm-args} +#### `--host_jvm_args=string` {#host-jvm-args} Specifies a startup option to be passed to the Java virtual machine in which _Bazel itself_ runs. This can be used to set the stack size, for example: -
+``` % bazel --host_jvm_args="-Xss256K" build //foo -+``` This option can be used multiple times with individual arguments. Note that setting this flag should rarely be needed. You can also pass a space-separated list of strings, @@ -2346,7 +2348,7 @@ the `--jvm_flags` argument which all `java_binary` and `java_test` programs support. Alternatively for tests, use `bazel test --test_arg=--jvm_flags=foo ...`. -#### `--host_jvm_debug` {:#host-java-debug} +#### `--host_jvm_debug` {#host-java-debug} This option causes the Java virtual machine to wait for a connection from a JDWP-compliant debugger before @@ -2356,14 +2358,14 @@ intended for use by Bazel developers. Note: This does _not_ affect any JVMs used by subprocesses of Bazel: applications, tests, tools, etc. -#### `--autodetect_server_javabase` {:#autodetect-server-javabase} +#### `--autodetect_server_javabase` {#autodetect-server-javabase} This option causes Bazel to automatically search for an installed JDK on startup, and to fall back to the installed JRE if the embedded JRE isn't available. `--explicit_server_javabase` can be used to pick an explicit JRE to run Bazel with. -#### `--batch` {:#batch} +#### `--batch` {#batch} Batch mode causes Bazel to not use the [standard client/server mode](/versions/9.1.0/run/client-server), but instead runs a bazel @@ -2390,7 +2392,7 @@ for the purpose of build isolation, you should use the command option in-memory state is kept between builds. In order to restart the Bazel server and JVM after a build, please explicitly do so using the "shutdown" command. -#### `--max_idle_secs={{ "" }}n{{ "" }}` {:#max-idle-secs} +#### `--max_idle_secs=n` {#max-idle-secs} This option specifies how long, in seconds, the Bazel server process should wait after the last client request, before it exits. The @@ -2418,7 +2420,7 @@ there was already a server running, that server will continue to run until it has been idle for the usual time. Of course, the existing server's idle timer will be reset. -#### `--[no]shutdown_on_low_sys_mem` {:#shutdown-on-low-sys-mem} +#### `--[no]shutdown_on_low_sys_mem` {#shutdown-on-low-sys-mem} If enabled and `--max_idle_secs` is set to a positive duration, after the build server has been idle for a while, shut down the server when the system is @@ -2428,7 +2430,7 @@ In addition to running an idle check corresponding to max_idle_secs, the build s starts monitoring available system memory after the server has been idle for some time. If the available system memory becomes critically low, the server will exit. -#### `--[no]block_for_lock` {:#block-for-lock} +#### `--[no]block_for_lock` {#block-for-lock} If enabled, Bazel will wait for other Bazel commands holding the server lock to complete before progressing. If disabled, Bazel will @@ -2438,27 +2440,27 @@ proceed. Developers might use this in presubmit checks to avoid long waits caused by another Bazel command in the same client. -#### `--io_nice_level={{ "" }}n{{ "" }}` {:#io-nice-level} +#### `--io_nice_level=n` {#io-nice-level} Sets a level from 0-7 for best-effort IO scheduling. 0 is highest priority, 7 is lowest. The anticipatory scheduler may only honor up to priority 4. Negative values are ignored. -#### `--batch_cpu_scheduling` {:#batch-cpu-scheduling} +#### `--batch_cpu_scheduling` {#batch-cpu-scheduling} Use `batch` CPU scheduling for Bazel. This policy is useful for workloads that are non-interactive, but do not want to lower their nice value. See 'man 2 sched_setscheduler'. This policy may provide for better system interactivity at the expense of Bazel throughput. -### Miscellaneous options {:#misc-options} +### Miscellaneous options {#misc-options} -#### `--[no]announce_rc` {:#announce-rc} +#### `--[no]announce_rc` {#announce-rc} Controls whether Bazel announces startup options and command options read from the bazelrc files when starting up. -#### `--color (yes|no|auto)` {:#color} +#### `--color (yes|no|auto)` {#color} This option determines whether Bazel will use colors to highlight its output on the screen. @@ -2471,7 +2473,7 @@ If this option is set to `no`, color output is disabled, regardless of whether the output is going to a terminal and regardless of the setting of the TERM environment variable. -#### `--config={{ "" }}name{{ "" }}` {:#config} +#### `--config=name` {#config} Selects additional config section from [the rc files](/versions/9.1.0/run/bazelrc#bazelrc-file-locations); for the current `command`, @@ -2479,7 +2481,7 @@ it also pulls in the options from `command:name` if such a section exists. Can b specified multiple times to add flags from several config sections. Expansions can refer to other definitions (for example, expansions can be chained). -#### `--curses (yes|no|auto)` {:#curses} +#### `--curses (yes|no|auto)` {#curses} This option determines whether Bazel will use cursor controls in its screen output. This results in less scrolling data, and a more @@ -2491,7 +2493,7 @@ If this option is set to `no`, use of cursor controls is disabled. If this option is set to `auto`, use of cursor controls will be enabled under the same conditions as for `--color=auto`. -#### `--[no]show_timestamps` {:#show-timestamps} +#### `--[no]show_timestamps` {#show-timestamps} If specified, a timestamp is added to each message generated by Bazel specifying the time at which the message was displayed. diff --git a/versions/9.1.0/extending/config.mdx b/versions/9.1.0/extending/config.mdx index d9dd6927..86aa680e 100644 --- a/versions/9.1.0/extending/config.mdx +++ b/versions/9.1.0/extending/config.mdx @@ -21,9 +21,9 @@ This makes it possible to: and more, all completely from .bzl files (no Bazel release required). See the `bazelbuild/examples` repo for -[examples](https://github.com/bazelbuild/examples/tree/HEAD/configurations){: .external}. +[examples](https://github.com/bazelbuild/examples/tree/HEAD/configurations). -## User-defined build settings {:#user-defined-build-settings} +## User-defined build settings {#user-defined-build-settings} A build setting is a single piece of [configuration](/versions/9.1.0/extending/rules#configurations) @@ -41,11 +41,11 @@ register changes). They also can be set via the command line (if they're designated as `flags`, see more below), but can also be set via [user-defined transitions](#user-defined-transitions). -### Defining build settings {:#defining-build-settings} +### Defining build settings {#defining-build-settings} -[End to end example](https://github.com/bazelbuild/examples/tree/HEAD/configurations/basic_build_setting){: .external} +[End to end example](https://github.com/bazelbuild/examples/tree/HEAD/configurations/basic_build_setting) -#### The `build_setting` `rule()` parameter {:#rule-parameter} +#### The `build_setting` `rule()` parameter {#rule-parameter} Build settings are rules like any other rule and are differentiated using the Starlark `rule()` function's `build_setting` @@ -74,7 +74,7 @@ writer have some debug mode that you'd like to turn on inside test rules, you don't want to give users the ability to indiscriminately turn on that feature inside other non-test rules. -#### Using ctx.build_setting_value {:#ctx-build-setting-value} +#### Using ctx.build_setting_value {#ctx-build-setting-value} Like all rules, build setting rules have [implementation functions](/versions/9.1.0/extending/rules#implementation-function). The basic Starlark-type value of the build settings can be accessed via the @@ -110,7 +110,7 @@ But all other references to the value of the build setting (such as in transitio will see its basic Starlark-typed value, not this post implementation function value. -#### Defining multi-set string flags {:#multi-set-string-flags} +#### Defining multi-set string flags {#multi-set-string-flags} String settings have an additional `allow_multiple` parameter which allows the flag to be set multiple times on the command line or in bazelrcs. Their default @@ -143,7 +143,7 @@ $ bazel build //my/target --//example:roasts=blonde \ The above is parsed to `{"//example:roasts": ["blonde", "medium,dark"]}` and `ctx.build_setting_value` returns the list `["blonde", "medium,dark"]`. -#### Instantiating build settings {:#instantiating-build-settings} +#### Instantiating build settings {#instantiating-build-settings} Rules defined with the `build_setting` parameter have an implicit mandatory `build_setting_default` attribute. This attribute takes on the same type as @@ -171,12 +171,12 @@ flavor( ) ``` -### Predefined settings {:#predefined-settings} +### Predefined settings {#predefined-settings} -[End to end example](https://github.com/bazelbuild/examples/tree/HEAD/configurations/use_skylib_build_setting){: .external} +[End to end example](https://github.com/bazelbuild/examples/tree/HEAD/configurations/use_skylib_build_setting) The -[Skylib](https://github.com/bazelbuild/bazel-skylib){: .external} +[Skylib](https://github.com/bazelbuild/bazel-skylib) library includes a set of predefined settings you can instantiate without having to write custom Starlark. @@ -193,11 +193,11 @@ string_flag( ``` For a complete list, see -[Common build setting rules](https://github.com/bazelbuild/bazel-skylib/blob/main/rules/common_settings.bzl){: .external}. +[Common build setting rules](https://github.com/bazelbuild/bazel-skylib/blob/main/rules/common_settings.bzl). -### Using build settings {:#using-build-settings} +### Using build settings {#using-build-settings} -#### Depending on build settings {:#depending-on-build-settings} +#### Depending on build settings {#depending-on-build-settings} If a target would like to read a piece of configuration information, it can directly depend on the build setting via a regular attribute dependency. @@ -262,7 +262,7 @@ kotlin_binary = rule( ``` -#### Using build settings on the command line {:#build-settings-command-line} +#### Using build settings on the command line {#build-settings-command-line} Similar to most native flags, you can use the command line to set build settings [that are marked as flags](#rule-parameter). The build @@ -280,7 +280,7 @@ $ bazel build //my/target --//example:boolean_flag $ bazel build //my/target --no//example:boolean_flag ``` -#### Using build setting aliases {:#using-build-setting-aliases} +#### Using build setting aliases {#using-build-setting-aliases} You can set an alias for your build setting target path to make it easier to read on the command line. Aliases function similarly to native flags and also make use @@ -312,9 +312,9 @@ $ bazel build //my/target --//experimental/user/starlark_configurations/basic_bu Best Practice: While it possible to set aliases on the command line, leaving them in a `.bazelrc` reduces command line clutter. -### Label-typed build settings {:#label-typed-build-settings} +### Label-typed build settings {#label-typed-build-settings} -[End to end example](https://github.com/bazelbuild/examples/tree/HEAD/configurations/label_typed_build_setting){: .external} +[End to end example](https://github.com/bazelbuild/examples/tree/HEAD/configurations/label_typed_build_setting) Unlike other build settings, label-typed settings cannot be defined using the `build_setting` rule parameter. Instead, bazel has two built-in rules: @@ -366,9 +366,9 @@ label_flag( ) ``` -### Build settings and select() {:#build-settings-and-select} +### Build settings and select() {#build-settings-and-select} -[End to end example](https://github.com/bazelbuild/examples/tree/HEAD/configurations/select_on_build_setting){: .external} +[End to end example](https://github.com/bazelbuild/examples/tree/HEAD/configurations/select_on_build_setting) Users can configure attributes on build settings by using [`select()`](/versions/9.1.0/reference/be/functions#select). Build setting targets can be passed to the `flag_values` attribute of @@ -384,7 +384,7 @@ config_setting( ) ``` -## User-defined transitions {:#user-defined-transitions} +## User-defined transitions {#user-defined-transitions} A configuration [transition](/versions/9.1.0/rules/lib/builtins/transition#transition) @@ -393,7 +393,7 @@ build graph. Important: Transitions have [memory and performance impact](#memory-performance-considerations). -### Defining {:#defining} +### Defining {#defining} Transitions define configuration changes between rules. For example, a request like "compile my dependency for a different CPU than its parent" is handled by a @@ -424,7 +424,7 @@ hot_chocolate_transition = transition( The `transition()` function takes in an implementation function, a set of build settings to read(`inputs`), and a set of build settings to write (`outputs`). The implementation function has two parameters, `settings` and -`attr`. `settings` is a dictionary {`String`:`Object`} of all settings declared +`attr`. `settings` is a dictionary `{String:Object}` of all settings declared in the `inputs` parameter to `transition()`. `attr` is a dictionary of attributes and values of the rule to which the @@ -452,9 +452,9 @@ parameter of the transition function. This is true even if a build setting is not actually changed over the course of the transition - its original value must be explicitly passed through in the returned dictionary. -### Defining 1:2+ transitions {:#defining-1-2-transitions} +### Defining 1:2+ transitions {#defining-1-2-transitions} -[End to end example](https://github.com/bazelbuild/examples/tree/HEAD/configurations/multi_arch_binary){: .external} +[End to end example](https://github.com/bazelbuild/examples/tree/HEAD/configurations/multi_arch_binary) [Outgoing edge transition](#outgoing-edge-transitions) can map a single input configuration to two or more output configurations. This is useful for defining @@ -497,9 +497,9 @@ multi_arch_transition = transition( ) ``` -### Attaching transitions {:#attaching-transitions} +### Attaching transitions {#attaching-transitions} -[End to end example](https://github.com/bazelbuild/examples/tree/HEAD/configurations/attaching_transitions_to_rules){: .external} +[End to end example](https://github.com/bazelbuild/examples/tree/HEAD/configurations/attaching_transitions_to_rules) Transitions can be attached in two places: incoming edges and outgoing edges. Effectively this means rules can transition their own configuration (incoming @@ -511,7 +511,7 @@ If you need to do this, contact bazel-discuss@googlegroups.com for help with figuring out workarounds. -### Incoming edge transitions {:#incoming-edge-transitions} +### Incoming edge transitions {#incoming-edge-transitions} Incoming edge transitions are activated by attaching a `transition` object (created by `transition()`) to `rule()`'s `cfg` parameter: @@ -527,7 +527,7 @@ drink_rule = rule( Incoming edge transitions must be 1:1 transitions. -### Outgoing edge transitions {:#outgoing-edge-transitions} +### Outgoing edge transitions {#outgoing-edge-transitions} Outgoing edge transitions are activated by attaching a `transition` object (created by `transition()`) to an attribute's `cfg` parameter: @@ -545,9 +545,9 @@ Outgoing edge transitions can be 1:1 or 1:2+. See [Accessing attributes with transitions](#accessing-attributes-with-transitions) for how to read these keys. -### Transitions on native options {:#transitions-native-options} +### Transitions on native options {#transitions-native-options} -[End to end example](https://github.com/bazelbuild/examples/tree/HEAD/configurations/transition_on_native_flag){: .external} +[End to end example](https://github.com/bazelbuild/examples/tree/HEAD/configurations/transition_on_native_flag) Starlark transitions can also declare reads and writes on native build configuration options via a special prefix to the option name. @@ -564,7 +564,7 @@ cpu_transition = transition( outputs = ["//command_line_option:cpu"] ``` -#### Unsupported native options {:#unsupported-native-options} +#### Unsupported native options {#unsupported-native-options} Bazel doesn't support transitioning on `--define` with `"//command_line_option:define"`. Instead, use a custom @@ -584,7 +584,7 @@ As a workaround, you can explicitly itemize the flags that *are* part of the configuration in your transition. This requires maintaining the `--config`'s expansion in two places, which is a known UI blemish. -### Transitions on allow multiple build settings {:#transitions-multiple-build-settings} +### Transitions on allow multiple build settings {#transitions-multiple-build-settings} When setting build settings that [allow multiple values](#defining-multi-set-string-flags), the value of the @@ -617,7 +617,7 @@ coffee_transition = transition( ) ``` -### No-op transitions {:#no-op-transitions} +### No-op transitions {#no-op-transitions} If a transition returns `{}`, `[]`, or `None`, this is shorthand for keeping all settings at their original values. This can be more convenient than explicitly @@ -646,9 +646,9 @@ hot_chocolate_transition = transition( ) ``` -### Accessing attributes with transitions {:#accessing-attributes-with-transitions} +### Accessing attributes with transitions {#accessing-attributes-with-transitions} -[End to end example](https://github.com/bazelbuild/examples/tree/HEAD/configurations/read_attr_in_transition){: .external} +[End to end example](https://github.com/bazelbuild/examples/tree/HEAD/configurations/read_attr_in_transition) When [attaching a transition to an outgoing edge](#outgoing-edge-transitions) (regardless of whether the transition is a 1:1 or 1:2+ transition), `ctx.attr` is forced to be a list @@ -715,14 +715,14 @@ multi_arch_rule = rule( See [complete example](https://github.com/bazelbuild/examples/tree/main/configurations/multi_arch_binary) here. -## Integration with platforms and toolchains {:#integration-platforms-toolchains} +## Integration with platforms and toolchains {#integration-platforms-toolchains} Many native flags today, like `--cpu` and `--crosstool_top` are related to toolchain resolution. In the future, explicit transitions on these types of flags will likely be replaced by transitioning on the [target platform](/versions/9.1.0/extending/platforms). -## Memory and performance considerations {:#memory-performance-considerations} +## Memory and performance considerations {#memory-performance-considerations} Adding transitions, and therefore new configurations, to your build comes at a cost: larger build graphs, less comprehensible build graphs, and slower @@ -730,7 +730,7 @@ builds. It's worth considering these costs when considering using transitions in your build rules. Below is an example of how a transition might create exponential growth of your build graph. -### Badly behaved builds: a case study {:#badly-behaved-builds} +### Badly behaved builds: a case study {#badly-behaved-builds}  @@ -781,9 +781,9 @@ corresponding memory and performance consequences. TODO: Add strategies for measurement and mitigation of these issues. -## Further reading {:#further-reading} +## Further reading {#further-reading} For more details on modifying build configurations, see: - * [Starlark Build Configuration](https://docs.google.com/document/d/1vc8v-kXjvgZOdQdnxPTaV0rrLxtP2XwnD2tAZlYJOqw/edit?usp=sharing){: .external} - * Full [set](https://github.com/bazelbuild/examples/tree/HEAD/configurations){: .external} of end to end examples + * [Starlark Build Configuration](https://docs.google.com/document/d/1vc8v-kXjvgZOdQdnxPTaV0rrLxtP2XwnD2tAZlYJOqw/edit?usp=sharing) + * Full [set](https://github.com/bazelbuild/examples/tree/HEAD/configurations) of end to end examples diff --git a/versions/9.1.0/extending/platforms.mdx b/versions/9.1.0/extending/platforms.mdx index 0b07c52e..f6749058 100644 --- a/versions/9.1.0/extending/platforms.mdx +++ b/versions/9.1.0/extending/platforms.mdx @@ -70,18 +70,18 @@ builds target the same machine Bazel runs on. Build rules can [@platforms/cpu](https://github.com/bazelbuild/platforms/blob/main/cpu/BUILD) constraints. -## Generally useful constraints and platforms {:#useful-constraints-platforms} +## Generally useful constraints and platforms {#useful-constraints-platforms} To keep the ecosystem consistent, Bazel team maintains a repository with constraint definitions for the most popular CPU architectures and operating systems. These are all defined in -[https://github.com/bazelbuild/platforms](https://github.com/bazelbuild/platforms){: .external}. +[https://github.com/bazelbuild/platforms](https://github.com/bazelbuild/platforms). Bazel ships with the following special platform definition: `@platforms//host` (aliased as `@bazel_tools//tools:host_platform`). This auto-detects the OS and CPU properties of the machine Bazel runs on. -## Defining constraints {:#constraints} +## Defining constraints {#constraints} Constraints are modeled with the [`constraint_setting`][constraint_setting] and [`constraint_value`][constraint_value] build rules. @@ -111,7 +111,7 @@ the `x86` constraint as `//cpus:x86`. If visibility allows, you can extend an existing `constraint_setting` by defining your own value for it. -## Defining platforms {:#platforms} +## Defining platforms {#platforms} The [`platform`](/versions/9.1.0/reference/be/platforms-and-toolchains#platform) build rule defines a platform as a collection of `constraint_value`s: @@ -133,7 +133,7 @@ Platforms may only have one `constraint_value` for a given `constraint_setting`. This means, for example, a platform can't have two CPUs unless you create another `constraint_setting` type to model the second value. -## Skipping incompatible targets {:#skipping-incompatible-targets} +## Skipping incompatible targets {#skipping-incompatible-targets} When building for a specific target platform it is often desirable to skip targets that will never work on that platform. For example, your Windows device @@ -163,7 +163,7 @@ incompatible with all else. Incompatibility is transitive. Any targets that transitively depend on an incompatible target are themselves considered incompatible. -### When are targets skipped? {:#when-targets-skipped} +### When are targets skipped? {#when-targets-skipped} Targets are skipped when they are considered incompatible and included in the build as part of a target pattern expansion. For example, the following two @@ -198,7 +198,7 @@ FAILED: Build did NOT complete successfully Incompatible explicit targets are silently skipped if `--skip_incompatible_explicit_targets` is enabled. -### More expressive constraints {:#expressive-constraints} +### More expressive constraints {#expressive-constraints} For more flexibility in expressing constraints, use the `@platforms//:incompatible` @@ -233,8 +233,8 @@ The above can be interpreted as follows: deemed incompatible. To make your constraints more readable, use -[skylib](https://github.com/bazelbuild/bazel-skylib){: .external}'s -[`selects.with_or()`](https://github.com/bazelbuild/bazel-skylib/blob/main/docs/selects_doc.md#selectswith_or){: .external}. +[skylib](https://github.com/bazelbuild/bazel-skylib)'s +[`selects.with_or()`](https://github.com/bazelbuild/bazel-skylib/blob/main/docs/selects_doc.md#selectswith_or). You can express inverse compatibility in a similar way. The following example describes a library that is compatible with everything _except_ for ARM. @@ -250,7 +250,7 @@ cc_library( ) ``` -### Detecting incompatible targets using `bazel cquery` {:#cquery-incompatible-target-detection} +### Detecting incompatible targets using `bazel cquery` {#cquery-incompatible-target-detection} You can use the [`IncompatiblePlatformProvider`](/versions/9.1.0/rules/lib/providers/IncompatiblePlatformProvider) diff --git a/versions/9.1.0/external/images/mod_exampleBefore.svg b/versions/9.1.0/external/images/mod_exampleBefore.svg new file mode 100644 index 00000000..66f01303 --- /dev/null +++ b/versions/9.1.0/external/images/mod_exampleBefore.svg @@ -0,0 +1,175 @@ + + + + + \ No newline at end of file diff --git a/versions/9.1.0/external/images/mod_exampleResolved.svg b/versions/9.1.0/external/images/mod_exampleResolved.svg new file mode 100644 index 00000000..224b694c --- /dev/null +++ b/versions/9.1.0/external/images/mod_exampleResolved.svg @@ -0,0 +1,151 @@ + + + + + \ No newline at end of file diff --git a/versions/9.1.0/external/lockfile.mdx b/versions/9.1.0/external/lockfile.mdx index c975a62a..c110ecb4 100644 --- a/versions/9.1.0/external/lockfile.mdx +++ b/versions/9.1.0/external/lockfile.mdx @@ -1,5 +1,3 @@ -keywords: product:Bazel,lockfile,Bzlmod - --- title: 'Bazel Lockfile' --- diff --git a/versions/9.1.0/external/migration_tool.mdx b/versions/9.1.0/external/migration_tool.mdx index 4203cc36..ed2250c9 100644 --- a/versions/9.1.0/external/migration_tool.mdx +++ b/versions/9.1.0/external/migration_tool.mdx @@ -1,10 +1,3 @@ -keywords: bzlmod - -{# disableFinding(LINE_OVER_80_LINK) #} -{# disableFinding(SNIPPET_NO_LANG) #} -{# disableFinding(LINK_MISSING_ID) #} -{# disableFinding("repo") #} - --- title: 'Bzlmod Migration Tool' --- @@ -19,7 +12,7 @@ management system. **Note**: If you want to try out the AI driven Bzlmod migration, check [Bzlmod Migration Agent Setup][gemini_cli_setup]. -## Core Functionality {:#migration-tool-core-functionality} +## Core Functionality {#migration-tool-core-functionality} The script's primary functions are: @@ -57,7 +50,7 @@ The migration tool supports: recommendations for correctness. * Use the migration tool with Bazel 7 (not supported with Bazel 8). -## How to Use the Migration Tool {:#migration-tool-how-to-use} +## How to Use the Migration Tool {#migration-tool-how-to-use} Before you begin: @@ -70,7 +63,7 @@ Before you begin: bazel build --nobuild --enable_workspace --noenable_bzlmod
somepath(S1 + S2, E), one possible result.somepath(S1 + S2, E), another possible result.allpaths(S1 + S2, E)
@@ -1342,7 +1341,7 @@ are specified, respectively. |
test_suite convention; suite of large testsmanual *:..., :*, or :all
+ src="/versions/9.1.0/docs/images/dyn-trace-alldynamic.png" />
+ src="/versions/9.1.0/docs/images/dyn-trace-javaconly.png" />
Authorization field of the HTTP request.
Example attribute and netrc for a http download to an oauth2 enabled API using a bearer token:
-
+```
auth_patterns = {
- "storage.cloudprovider.com": "Bearer <password>"
+ "storage.cloudprovider.com": "Bearer "
}
-
+```
netrc:
@@ -637,11 +637,11 @@ as the value for the Authorization field of the HTTP request.
Example attribute and netrc for a http download to an oauth2 enabled API using a bearer token:
-
+```
auth_patterns = {
- "storage.cloudprovider.com": "Bearer <password>"
+ "storage.cloudprovider.com": "Bearer "
}
-
+```
netrc:
@@ -885,11 +885,11 @@ as the value for the Authorization field of the HTTP request.
Example attribute and netrc for a http download to an oauth2 enabled API using a bearer token:
-
+```
auth_patterns = {
- "storage.cloudprovider.com": "Bearer <password>"
+ "storage.cloudprovider.com": "Bearer "
}
-
+```
netrc:
diff --git a/versions/9.1.0/run/build.mdx b/versions/9.1.0/run/build.mdx
index d463481a..282166df 100644
--- a/versions/9.1.0/run/build.mdx
+++ b/versions/9.1.0/run/build.mdx
@@ -5,7 +5,7 @@ title: 'Build programs with Bazel'
This page covers how to build a program with Bazel, build command syntax, and
target pattern syntax.
-## Quickstart {:#quickstart}
+## Quickstart {#quickstart}
To run Bazel, go to your base [workspace](/versions/9.1.0/concepts/build-ref#workspace) directory
or any of its subdirectories and type `bazel`. See [build](#bazel-build) if you
@@ -13,11 +13,11 @@ need to make a new workspace.
```posix-terminal
bazel help
- [Bazel release bazel {{ "" }}version{{ "" }}]
-Usage: bazel {{ "" }}command{{ "" }} {{ "" }}options{{ "" }} ...
+ [Bazel release bazel version]
+Usage: bazel command options ...
```
-### Available commands {:#available-commands}
+### Available commands {#available-commands}
* [`analyze-profile`](/versions/9.1.0/docs/user-manual#analyze-profile): Analyzes build profile data.
* [`aquery`](/versions/9.1.0/docs/user-manual#aquery): Executes a query on the [post-analysis](#analysis) action graph.
@@ -36,10 +36,10 @@ Usage: bazel {{ "" }}command{{ "" }} {{ "" }}options{{ ""
* [`test`](/versions/9.1.0/docs/user-manual#running-tests): Builds and runs the specified test targets.
* [`version`](/versions/9.1.0/docs/user-manual#version): Prints version information for Bazel.
-### Getting help {:#getting-help}
+### Getting help {#getting-help}
-* `bazel help {{ '' }}command{{ '' }}`: Prints help and options for
- `{{ '' }}command{{ '' }}`.
+* `bazel help command`: Prints help and options for
+ `command`.
* `bazel help `[`startup_options`](/versions/9.1.0/docs/user-manual#startup-options): Options for the JVM hosting Bazel.
* `bazel help `[`target-syntax`](#specifying-build-targets): Explains the syntax for specifying targets.
* `bazel help info-keys`: Displays a list of keys used by the info command.
@@ -48,7 +48,7 @@ The `bazel` tool performs many functions, called commands. The most commonly
used ones are `bazel build` and `bazel test`. You can browse the online help
messages using `bazel help`.
-### Building one target {:#bazel-build}
+### Building one target {#bazel-build}
Before you can start a build, you need a _workspace_. A workspace is a
directory tree that contains all the source files needed to build your
@@ -108,7 +108,7 @@ and no build steps to execute. If something changed in 'foo' or its
dependencies, Bazel would re-execute some build actions, or complete an
_incremental build_.
-### Building multiple targets {:#specifying-build-targets}
+### Building multiple targets {#specifying-build-targets}
Bazel allows a number of ways to specify the targets to be built. Collectively,
these are known as _target patterns_. This syntax is used in commands like
@@ -179,7 +179,8 @@ current _working directory_. These examples assume a working directory of `foo`:
bar/wiz//foo/bar/wiz:wiz if foo/bar/wiz is a package//foo/bar:wiz if foo/bar is a package