| --- |
| layout: documentation |
| title: Build Encyclopedia |
| --- |
| |
| <h1>Bazel BUILD Encyclopedia of Functions</h1> |
| <h2>Concepts and terminology</h2> |
| |
| <ul> |
| <li> |
| <a href="$expander.expandRef("common-definitions")">Common definitions</a> |
| <ul> |
| <li><a href="$expander.expandRef("common-definitions#sh-tokenization")">Bourne shell tokenization</a></li> |
| <li><a href="$expander.expandRef("common-definitions#label-expansion")">Label expansion</a></li> |
| <li><a href="$expander.expandRef("common-definitions#common-attributes")">Common attributes</a></li> |
| <li><a href="$expander.expandRef("common-definitions#common-attributes-tests")">Common attributes for tests</a></li> |
| <li><a href="$expander.expandRef("common-definitions#common-attributes-binaries")">Common attributes for binaries</a></li> |
| <li><a href="$expander.expandRef("common-definitions#configurable-attributes")">Configurable attributes</a></li> |
| <li><a href="$expander.expandRef("common-definitions#implicit-outputs")">Implicit output targets</a></li> |
| </ul> |
| </li> |
| <li> |
| <a href="$expander.expandRef("make-variables")">"Make" variables</a> |
| <ul class="be-toc"> |
| <li><a href="$expander.expandRef("make-variables#make-var-substitution")">"Make" variable substitution</a></li> |
| |
| </ul> |
| </li> |
| </ul> |
| |
| <h2>Functions</h2> |
| |
| <ul class="be-toc"> |
| <li><a href="$expander.expandRef("package")">package</a></li> |
| <li><a href="$expander.expandRef("package_group")">package_group</a></li> |
| |
| <li><a href="$expander.expandRef("licenses")">licenses</a></li> |
| <li><a href="$expander.expandRef("exports_files")">exports_files</a></li> |
| <li><a href="$expander.expandRef("glob")">glob</a></li> |
| <li><a href="$expander.expandRef("select")">select</a></li> |
| <li><a href="$expander.expandRef("workspace")">workspace</a></li> |
| </ul> |
| |
| <h2>Rules</h2> |
| |
| Native rules ship with the Bazel binary and do not require a <code>load</code> statement. |
| Native rules are available globally in BUILD files. In .bzl files, you can find them in |
| the <code>native</code> module. |
| |
| <h3>Language-specific native rules</h3> |
| |
| #macro(summaryLink $page $heading) |
| #if ($singlePage)#${heading}#else${page}.html#${heading}#end |
| #end |
| |
| #macro(summaryTable $ruleFamilies) |
| <tbody> |
| #foreach($ruleFamily in $ruleFamilies) |
| #if($ruleFamily.size() > 0) |
| <tr> |
| <td class="lang">${ruleFamily.name}</td> |
| #set( $ruleTypes = [$ruleFamily.binaryRules, $ruleFamily.libraryRules, $ruleFamily.testRules, $ruleFamily.otherRules1, $ruleFamily.otherRules2] ) |
| #foreach($ruleType in $ruleTypes) |
| <td> |
| #foreach($ruleDoc in $ruleType) |
| <a href="#summaryLink(${ruleFamily.id}, ${ruleDoc.ruleName})"#if($ruleDoc.isDeprecated()) class="deprecated"#end>${ruleDoc.ruleName}</a> |
| <br /> |
| #end |
| </td> |
| #end |
| </tr> |
| #end |
| #end |
| </tbody> |
| #end |
| |
| <table class="table table-condensed table-striped" summary="Table of rules sorted by language"> |
| <colgroup span="6" width="20%"></colgroup> |
| <thead> |
| <tr> |
| <th>Language</th> |
| <th>Binary rules</th> |
| <th>Library rules</th> |
| <th>Test rules</th> |
| <th>Other rules</th> |
| <th></th> |
| </tr> |
| </thead> |
| #summaryTable($langSpecificRuleFamilies) |
| |
| </table> |
| <h3>Native rules that do not apply to a specific programming language</h3> |
| |
| <table class="table table-condensed table-striped" summary="Table of rules not specific to a programming language"> |
| <colgroup span="6" width="20%"></colgroup> |
| #summaryTable($genericRuleFamilies) |
| |
| </table> |
| |
| |
| <h3>Embedded non-native rules</h3> |
| |
| Bazel also embeds additional rules written in Starlark. Those can be loaded |
| from the <tt>@bazel_tools</tt> built-in external repository. |
| |
| <ul> |
| <li><a href="../repo/index.html">repository rules</a> |
| <li><a href="pkg.html">package rules</a> |
| </ul> |
| |
| |
| <h3>Additional rules</h3> |
| |
| <p>Non-native rules extend Bazel's capabilities. Rules for many popular languages |
| have been created and are being maintained outside of Bazel. Contact the respective |
| rule set's maintainers regarding issues and feature requests.</p> |
| |
| <p>To find more Bazel rules, use a search engine or look on |
| <a href="https://github.com/search?o=desc&q=bazel+rules&s=stars&type=Repositories">GitHub</a>. |
| </p> |
| |
| <p>Here is a selection of popular rules:</p> |
| |
| <ul> |
| <li><a href="https://github.com/bazelbuild/rules_android">Android</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_apple">Apple platforms</a></li> |
| <li><a href="https://github.com/nelhage/rules_boost">Boost</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_dotnet">C#</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_closure">Closure</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_docker">Docker</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_go">Go</a></li> |
| <li><a href="https://github.com/tweag/rules_haskell">Haskell</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_jsonnet">Jsonnet</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_kotlin">Kotlin</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_k8s">Kubernetes</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_nodejs">NodeJS</a></li> |
| <li><a href="https://github.com/pubref/rules_protobuf">Protobuf</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_python">Python</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_rust">Rust</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_scala">Scala</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_swift">Swift</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_typescript">Typescript</a></li> |
| <li><a href="https://github.com/bazelbuild/rules_webtesting">Webtesting</a> (Webdriver)</li> |
| </ul> |
| |
| <p>The repository |
| <a href="https://github.com/bazelbuild/bazel-skylib">Skylib</a> |
| contains additional functions that can be useful when writing new rules |
| and new macros.</p> |
| |