Declares that implementation creates a file with the given filename within the specified directory.Remember that in addition to declaring a file, you must separately create an action that emits the file. Creating that action will require passing the returned File object to the action’s construction function.
sequence; or depset; or None; default is None List or depset of any tools needed by the action. Tools are executable inputs that may have their own runfiles which are automatically made available to the action. When a list is provided, it can be a heterogenous collection of: * Files * FilesToRunProvider instances * depsets of Files Files from ctx.executable and FilesToRunProviders which are directly in the list will have their runfiles automatically added. All tools are implicitly added as inputs.
arguments
sequence; default is [] Command line arguments of the action. Must be a list of strings or actions.args() objects.
progress_message
string; or None; default is None Progress message to show to the user during the build.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Bazel Documentation","colors":{"primary":"#44a047","light":"#77d275","dark":"#004300"},"logo":{"light":"https://mintcdn.com/bazel/h7ma40U5Tjz5Hf-j/logo/light.svg?fit=max\u0026auto=format\u0026n=h7ma40U5Tjz5Hf-j\u0026q=85\u0026s=fe755972fa71b3fc4db1ccda7a78cb9d","dark":"https://mintcdn.com/bazel/h7ma40U5Tjz5Hf-j/logo/Bazel_logo.svg?fit=max\u0026auto=format\u0026n=h7ma40U5Tjz5Hf-j\u0026q=85\u0026s=78e05337ead4a8dc5dabb4819732eb25"},"favicon":"https://mintcdn.com/bazel/ZgDLXOcGz0vxy0Ai/favicon.png?fit=max\u0026auto=format\u0026n=ZgDLXOcGz0vxy0Ai\u0026q=85\u0026s=80c032647b8ae1fba9de31dfc428994e","navbar":{"links":[{"icon":"book-open-cover","href":"https://registry.bazel.build","label":"Module Registry"},{"icon":"newspaper","href":"https://blog.bazel.build/","label":"Blog"},{"icon":"github","href":"https://github.com/bazelbuild/bazel","label":"Github"}]},"footer":{"socials":{"x":"https://x.com/bazelbuild","github":"https://github.com/bazelbuild","reddit":"https://reddit.com/r/bazel"},"links":[{"header":"About","items":[{"label":"Who's using Bazel","href":"https://bazel.build/community/users"},{"label":"Contribute","href":"https://bazel.build/contribute"},{"label":"Governance model","href":"https://bazel.build/contribute/policy"},{"label":"Release model","href":"https://bazel.build/release"},{"label":"Brand guidelines","href":"https://bazel.build/brand"}]},{"header":"Stay Connected","items":[{"label":"Blog","href":"https://blog.bazel.build/"},{"label":"GitHub","href":"https://github.com/bazelbuild/bazel"},{"label":"Twitter","href":"https://twitter.com/bazelbuild"},{"label":"YouTube","href":"https://youtube.com/user/googleOSPO"}]},{"header":"Support","items":[{"label":"Support","href":"https://bazel.build/help"},{"label":"Issue tracker","href":"https://github.com/bazelbuild/bazel/issues"},{"label":"Slack","href":"https://slack.bazel.build/"},{"label":"Stack Overflow","href":"https://stackoverflow.com/questions/tagged/bazel"}]},{"header":"Legal","items":[{"label":"Privacy Policy","href":"https://policies.google.com/privacy"},{"label":"Terms of Service","href":"https://policies.google.com/terms"}]}]},"integrations":{"ga4":{"measurementId":"G-V5WZVG5WF1"}},"banner":{"content":"Please take the [Bazel user survey](/survey) to help us improve Bazel.","dismissible":true},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"bazel","hasAudioNarration":false,"actualSubdomain":"bazel","customDomains":["bazel.build"],"gitSource":{"type":"github","owner":"bazel-contrib","repo":"bazel-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ad8577e90ac75c5b8c8dc8c","collectionId":"3cf2ec88-f8be-4fd9-94bf-a60d99782efe","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ad8577e90ac75c5b8c8dc8c"},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ad8577e90ac75c5b8c8dc8c","clientVersion":"0.0.3908","searchFilterCounts":[{"language":"en","tag":"Extending","count":937},{"language":"en","tag":"User guide","count":663},{"language":"en","tag":"Getting started","count":301},{"language":"en","tag":"Community","count":264},{"language":"en","tag":"Starlark Builtins","count":250},{"language":"en","tag":"Remote Execution","count":240},{"language":"en","tag":"Reference","count":203},{"language":"en","tag":"Contributing","count":168},{"language":"en","tag":"About Bazel","count":164},{"language":"en","tag":"Install","count":151}],"searchSettings":{"isFiltersEnabled":true,"maxResults":15}},"assistantConfig":{},"hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-branches-v2-autocommit","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-branches-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"teamspace","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"client-snapshot-docs-config","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"privacy":{"consentBanner":{"enabled":true}},"isAtlas":false,"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"versions/9.1.0/rules/lib/builtins/template_ctx","slug":"/versions/9.1.0/rules/lib/builtins/template_ctx","pageMetadata":{"title":"template_ctx","description":null,"href":"/versions/9.1.0/rules/lib/builtins/template_ctx"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`A context object that is passed to the action template expansion function.`}),`\n`,_jsx(Heading,{level:`2`,id:`members`,children:`Members`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`#args`,children:`args`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`#declare_file`,children:`declare_file`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`#run`,children:`run`})}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`args`,children:`args`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Args template_ctx.args()`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Returns an Args object that can be used to build memory-efficient command lines.`}),`\n`,_jsx(Heading,{level:`2`,id:`declare_file`,children:`declare_file`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`File template_ctx.declare_file(filename, *, directory)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Declares that implementation creates a file with the given filename within the specified directory.`}),`\n`,_jsxs(_components.p,{children:[`Remember that in addition to declaring a file, you must separately create an action that emits the file. Creating that action will require passing the returned `,_jsx(_components.code,{children:`File`}),` object to the action’s construction function.`]}),`\n`,_jsx(Heading,{level:`3`,id:`parameters`,children:`Parameters`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Parameter`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`filename`})}),_jsxs(_components.td,{children:[_jsx(_components.a,{href:`/versions/9.1.0/rules/lib/core/string`,children:`string`}),`; required The relative path of the file within the directory.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`directory`})}),_jsxs(_components.td,{children:[_jsx(_components.a,{href:`/versions/9.1.0/rules/lib/builtins/File`,children:`File`}),`; required The directory in which the file should be created.`]})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`run`,children:`run`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`None template_ctx.run(*, outputs, inputs=[], executable, tools=None, arguments=[], progress_message=None)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Creates an action that runs an executable.`}),`\n`,_jsx(Heading,{level:`3`,id:`parameters-2`,children:`Parameters`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Parameter`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`outputs`})}),_jsxs(_components.td,{children:[_jsx(_components.a,{href:`/versions/9.1.0/rules/lib/core/list`,children:`sequence`}),` of `,_jsx(_components.a,{href:`/versions/9.1.0/rules/lib/builtins/File`,children:`File`}),`s; required List of the output files of the action.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`inputs`})}),_jsxs(_components.td,{children:[_jsx(_components.a,{href:`/versions/9.1.0/rules/lib/core/list`,children:`sequence`}),` of `,_jsx(_components.a,{href:`/versions/9.1.0/rules/lib/builtins/File`,children:`File`}),`s; or `,_jsx(_components.a,{href:`/versions/9.1.0/rules/lib/builtins/depset`,children:`depset`}),`; default is `,_jsx(_components.code,{children:`[]`}),` List or depset of the input files of the action.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`executable`})}),_jsxs(_components.td,{children:[_jsx(_components.a,{href:`/versions/9.1.0/rules/lib/builtins/File`,children:`File`}),`; or `,_jsx(_components.a,{href:`/versions/9.1.0/rules/lib/core/string`,children:`string`}),`; or `,_jsx(_components.a,{href:`/versions/9.1.0/rules/lib/providers/FilesToRunProvider`,children:`FilesToRunProvider`}),`; required The executable file to be called by the action.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`tools`})}),_jsxs(_components.td,{children:[_jsx(_components.a,{href:`/versions/9.1.0/rules/lib/core/list`,children:`sequence`}),`; or `,_jsx(_components.a,{href:`/versions/9.1.0/rules/lib/builtins/depset`,children:`depset`}),`; or `,_jsx(_components.code,{children:`None`}),`; default is `,_jsx(_components.code,{children:`None`}),` List or `,_jsx(_components.a,{href:`/versions/9.1.0/rules/lib/builtins/depset`,children:_jsx(_components.code,{children:`depset`})}),` of any tools needed by the action. Tools are executable inputs that may have their own runfiles which are automatically made available to the action. When a list is provided, it can be a heterogenous collection of: * `,_jsx(_components.code,{children:`File`}),`s * `,_jsx(_components.code,{children:`FilesToRunProvider`}),` instances * `,_jsx(_components.code,{children:`depset`}),`s of `,_jsx(_components.code,{children:`File`}),`s `,_jsx(_components.code,{children:`File`}),`s from `,_jsx(_components.a,{href:`/versions/9.1.0/rules/lib/builtins/ctx#executable`,children:_jsx(_components.code,{children:`ctx.executable`})}),` and `,_jsx(_components.code,{children:`FilesToRunProvider`}),`s which are directly in the list will have their runfiles automatically added. All tools are implicitly added as inputs.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`arguments`})}),_jsxs(_components.td,{children:[_jsx(_components.a,{href:`/versions/9.1.0/rules/lib/core/list`,children:`sequence`}),`; default is `,_jsx(_components.code,{children:`[]`}),` Command line arguments of the action. Must be a list of strings or `,_jsx(_components.a,{href:`#args`,children:_jsx(_components.code,{children:`actions.args()`})}),` objects.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`progress_message`})}),_jsxs(_components.td,{children:[_jsx(_components.a,{href:`/versions/9.1.0/rules/lib/core/string`,children:`string`}),`; or `,_jsx(_components.code,{children:`None`}),`; default is `,_jsx(_components.code,{children:`None`}),` Progress message to show to the user during the build.`]})]})]})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"template_ctx","description":null,"href":"/versions/9.1.0/rules/lib/builtins/template_ctx"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Members","slug":"members","depth":2,"children":[]},{"title":"args","slug":"args","depth":2,"children":[]},{"title":"declare_file","slug":"declare_file","depth":2,"children":[{"title":"Parameters","slug":"parameters","depth":3,"children":[]}]},{"title":"run","slug":"run","depth":2,"children":[{"title":"Parameters","slug":"parameters-2","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":[],"subdomain":"bazel","siteName":"Bazel Documentation","title":"template_ctx - Bazel Documentation","navMaps":{"firstHrefInVersion":{"HEAD":{"href":"/versions/9.1.0/rules/lib/builtins/template_ctx","matchLevel":0},"9.3":{"href":"/versions/9.3.0/rules/lib/builtins/template_ctx","matchLevel":1},"9.2":{"href":"/versions/9.2.0/rules/lib/builtins/template_ctx","matchLevel":1},"9.1":{"href":"/versions/9.1.0/about/intro","matchLevel":4},"9.0":{"href":"/versions/9.0.0/about/intro","matchLevel":4},"8.8":{"href":"/versions/8.8.1/about/intro","matchLevel":4},"8.7":{"href":"/versions/8.7.0/about/intro","matchLevel":4},"8.6":{"href":"/versions/8.6.0/about/intro","matchLevel":4},"8.5":{"href":"/versions/8.5.1/about/intro","matchLevel":4},"8.4":{"href":"/versions/8.4.2/about/intro","matchLevel":4},"8.3":{"href":"/versions/8.3.1/about/intro","matchLevel":4},"8.2":{"href":"/versions/8.2.1/about/intro","matchLevel":4},"8.1":{"href":"/versions/8.1.1/about/intro","matchLevel":4},"8.0":{"href":"/versions/8.0.1/about/intro","matchLevel":4},"7.7":{"href":"/versions/7.7.1/about/intro","matchLevel":4}},"firstHrefInLanguage":{"en":{"href":"/versions/9.1.0/rules/lib/builtins/template_ctx","matchLevel":0}}},"lastModified":"2026-10-20T15:33:32.795Z","originalFileLocation":"versions/9.1.0/rules/lib/builtins/template_ctx.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Bazel Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/bazel/PruV1ugoTEmyjX-1/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/bazel/PruV1ugoTEmyjX-1/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/bazel/PruV1ugoTEmyjX-1/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/bazel/PruV1ugoTEmyjX-1/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/bazel/PruV1ugoTEmyjX-1/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/bazel/PruV1ugoTEmyjX-1/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/bazel/PruV1ugoTEmyjX-1/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/bazel/PruV1ugoTEmyjX-1/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/bazel/PruV1ugoTEmyjX-1/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"template_ctx - Bazel Documentation\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Bazel Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://bazel.build/versions/9.1.0/rules/lib/builtins/template_ctx\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"template_ctx - Bazel Documentation\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/bazel/PruV1ugoTEmyjX-1/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Bazel Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#44a047\">\u003clink data-mint-head rel=\"canonical\" href=\"https://bazel.build/versions/9.1.0/rules/lib/builtins/template_ctx\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/versions/9.1.0/rules/lib/builtins/template_ctx.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Bazel Documentation\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Bazel Documentation","nav":{"global":null,"versions":[{"version":"HEAD","languages":[{"language":"en","tabs":[{"tab":"About Bazel","groups":[{"group":"Why Bazel?","pages":[{"title":"Intro to Bazel","href":"/about/intro"},{"title":"Why Bazel?","href":"/about/why"},{"title":"Bazel Vision","href":"/about/vision"},{"title":"FAQ","href":"/about/faq"}]},{"group":"Build system basics","pages":[{"title":"Build Basics","href":"/basics/index"},{"title":"Why a Build System?","href":"/basics/build-systems"},{"title":"Task-Based Build Systems","href":"/basics/task-based-builds"},{"title":"Artifact-Based Build Systems","href":"/basics/artifact-based-builds"},{"title":"Distributed Builds","href":"/basics/distributed-builds"},{"title":"Dependency Management","href":"/basics/dependencies"},{"title":"Hermeticity","href":"/basics/hermeticity"}]}]},{"tab":"Getting started","groups":[{"group":"Install","pages":[{"title":"Installing Bazel","href":"/install"},{"title":"Installing / Updating Bazel using Bazelisk","href":"/install/bazelisk"},{"title":"Installing Bazel on macOS","href":"/install/os-x"},{"title":"Installing Bazel on Windows","href":"/install/windows"},{"title":"Installing Bazel on Ubuntu","href":"/install/ubuntu"},{"title":"Installing Bazel on openSUSE Tumbleweed \u0026 Leap","href":"/install/suse"},{"title":"Installing Bazel with mise","href":"/install/mise"},{"title":"Getting Started with Bazel Docker Container","href":"/install/docker-container"},{"title":"Compiling Bazel from Source","href":"/install/compile-source"},{"title":"Command-Line Completion","href":"/install/completion"},{"title":"Integrating Bazel with IDEs","href":"/install/ide"}]},{"group":"First build tutorials","pages":[{"title":"Bazel Tutorial: Build a C++ Project","href":"/start/cpp"},{"title":"Bazel Tutorial: Build a Java Project","href":"/start/java"},{"title":"Bazel Tutorial: Build a Go Project","href":"/start/go"},{"title":"Bazel Tutorial: Build an Android App","href":"/start/android-app"},{"title":"Bazel Tutorial: Build an iOS App","href":"/start/ios-app"}]},{"group":"Concepts","pages":[{"title":"Repositories, workspaces, packages, and targets","href":"/concepts/build-ref"},{"title":"Labels","href":"/concepts/labels"},{"title":"BUILD files","href":"/concepts/build-files"},{"title":"Dependencies","href":"/concepts/dependencies"},{"title":"Visibility","href":"/concepts/visibility"},{"title":"Platforms","href":"/concepts/platforms"},{"title":"Runfiles","href":"/concepts/runfiles"}]}]},{"tab":"User guide","groups":[{"group":"Releases","pages":[{"title":"Release Model","href":"/release"},{"title":"Rolling Releases","href":"/release/rolling"},{"title":"Backward Compatibility","href":"/release/backward-compatibility"},{"title":"Rule Compatibility","href":"/release/rule-compatibility"}]},{"group":"Basics","pages":[{"title":"BUILD Style Guide","href":"/build/style-guide"},{"title":"Sharing Variables","href":"/build/share-variables"},{"title":"Recommended Rules","href":"/community/recommended-rules"},{"title":"Build programs with Bazel","href":"/run/build"},{"title":"Write bazelrc configuration files","href":"/run/bazelrc"},{"title":"Client/server implementation","href":"/run/client-server"},{"title":"Calling Bazel from scripts","href":"/run/scripts"}]},{"group":"Advanced","pages":[{"title":"Configurable Build Attributes","href":"/configure/attributes"},{"title":"Integrating with C++ Rules","href":"/configure/integrate-cpp"},{"title":"Code coverage with Bazel","href":"/configure/coverage"},{"title":"Best Practices","href":"/configure/best-practices"},{"title":"Using Bazel on Windows","href":"/configure/windows"},{"title":"Extracting build performance metrics","href":"/advanced/performance/build-performance-metrics"},{"title":"Breaking down build performance","href":"/advanced/performance/build-performance-breakdown"},{"title":"JSON Trace Profile","href":"/advanced/performance/json-trace-profile"},{"title":"Optimize Memory","href":"/advanced/performance/memory"},{"title":"Optimize Iteration Speed","href":"/advanced/performance/iteration-speed"}]},{"group":"Remote Execution","pages":[{"title":"Remote Execution Overview","href":"/remote/rbe"},{"title":"Adapting Bazel Rules for Remote Execution","href":"/remote/rules"},{"title":"Configuring Bazel CI to Test Rules for Remote Execution","href":"/remote/ci"},{"title":"Dynamic Execution","href":"/remote/dynamic"},{"title":"Remote Caching","href":"/remote/caching"},{"title":"Troubleshooting Bazel Remote Execution with Docker Sandbox","href":"/remote/sandbox"},{"title":"Finding Non-Hermetic Behavior in WORKSPACE Rules","href":"/remote/workspace"},{"title":"Debugging Remote Cache Hits for Remote Execution","href":"/remote/cache-remote"},{"title":"Debugging Remote Cache Hits for Local Execution","href":"/remote/cache-local"},{"title":"Output Directory Layout","href":"/remote/output-directories"},{"title":"Persistent Workers","href":"/remote/persistent"},{"title":"Multiplex Workers (Experimental Feature)","href":"/remote/multiplex"},{"title":"Creating Persistent Workers","href":"/remote/creating"},{"title":"Build Event Protocol","href":"/remote/bep"},{"title":"Build Event Protocol Examples","href":"/remote/bep-examples"},{"title":"Build Event Protocol Glossary","href":"/remote/bep-glossary"}]},{"group":"Platform guides","pages":[{"title":"C++ and Bazel","href":"/docs/bazel-and-cpp"},{"title":"Java and Bazel","href":"/docs/bazel-and-java"},{"title":"JavaScript and Bazel","href":"/docs/bazel-and-javascript"},{"title":"Apple Apps and Bazel","href":"/docs/bazel-and-apple"},{"title":"Android and Bazel","href":"/docs/bazel-and-android"},{"title":"Using the Android Native Development Kit with Bazel","href":"/docs/android-ndk"},{"title":"Android Instrumentation Tests","href":"/docs/android-instrumentation-test"},{"title":"Android Build Performance","href":"/docs/android-build-performance"},{"title":"C++ Toolchain Configuration","href":"/docs/cc-toolchain-config-reference"},{"title":"Configurable Build Attributes","href":"/docs/configurable-attributes"},{"title":"bazel mobile-install","href":"/docs/mobile-install"},{"title":"Sandboxing","href":"/docs/sandboxing"},{"title":"Commands and Options","href":"/docs/user-manual"}]},{"group":"Tutorials","pages":[{"title":"Common C++ Build Use Cases","href":"/tutorials/cpp-use-cases"},{"title":"Bazel Tutorial: Configure C++ Toolchains","href":"/tutorials/ccp-toolchain-config"},{"title":"Review the dependency graph","href":"/tutorials/cpp-dependency"},{"title":"Use labels to reference targets","href":"/tutorials/cpp-labels"}]},{"group":"Migrate","pages":[{"title":"Migrating to Bazel","href":"/migrate/index"},{"title":"Migrating from Maven to Bazel","href":"/migrate/maven"},{"title":"Migrating from Xcode to Bazel","href":"/migrate/xcode"}]}]},{"tab":"Reference","groups":[{"group":"Build encyclopedia","pages":[{"title":"Bazel BUILD Encyclopedia of Functions","href":"/reference/be/overview"},{"title":"Common definitions","href":"/reference/be/common-definitions"},{"title":"Make Variables","href":"/reference/be/make-variables"},{"title":"Functions","href":"/reference/be/functions"},{"title":"Platforms and Toolchains Rules","href":"/reference/be/platforms-and-toolchains"}]},{"group":"Command line reference","pages":[{"title":null,"href":"/reference/command-line-reference"}]},{"group":"Query Language","pages":[{"title":"The Bazel Query Reference","href":"/query/language"},{"title":"Query quickstart","href":"/query/quickstart"},{"title":"Query guide","href":"/query/guide"},{"title":"Configurable Query (cquery)","href":"/query/cquery"},{"title":"Action Graph Query (aquery)","href":"/query/aquery"}]},{"group":"Build Encyclopedia","pages":[{"title":"Bazel BUILD Encyclopedia of Functions","href":"/reference/be/overview"},{"title":"Common definitions","href":"/reference/be/common-definitions"},{"title":"Make Variables","href":"/reference/be/make-variables"},{"title":"Functions","href":"/reference/be/functions"},{"title":"Platforms and Toolchains Rules","href":"/reference/be/platforms-and-toolchains"},{"title":"General Rules","href":"/reference/be/general"},{"title":"C / C++ Rules","href":"/reference/be/c-cpp"},{"title":"Java Rules","href":"/reference/be/java"},{"title":"Objective-C Rules","href":"/reference/be/objective-c"},{"title":"Protocol Buffer Rules","href":"/reference/be/protocol-buffer"},{"title":"Python Rules","href":"/reference/be/python"},{"title":"Shell Rules","href":"/reference/be/shell"},{"title":"Extra Actions Rules","href":"/reference/be/extra-actions"},{"title":null,"href":"/reference/be/be-nav"}]},{"group":"Glossary","pages":[{"title":"Bazel Glossary","href":"/reference/glossary"},{"title":"Test encyclopedia","href":"/reference/test-encyclopedia"}]},{"group":"Flag cheatsheet","pages":[{"title":"Bazel flag cheat sheet","href":"/reference/flag-cheatsheet"}]},{"group":"Skyframe","pages":[{"title":"Skyframe","href":"/reference/skyframe"},{"title":null,"href":"/reference/skyframe-debugging"}]}]},{"tab":"Extending","groups":[{"group":"Concepts","pages":[{"title":"Extension Overview","href":"/extending/concepts"},{"title":"Depsets","href":"/extending/depsets"},{"title":"Macros","href":"/extending/macros"},{"title":"Legacy Macros","href":"/extending/legacy-macros"},{"title":"Aspects","href":"/extending/aspects"},{"title":"Rules","href":"/extending/rules"},{"title":"Configurations","href":"/extending/config"},{"title":"Execution Groups","href":"/extending/exec-groups"},{"title":"Automatic Execution Groups (AEGs)","href":"/extending/auto-exec-groups"}]},{"group":"Writing rules","pages":[{"title":"Rules Tutorial","href":"/rules/rules-tutorial"},{"title":"Creating a Symbolic Macro","href":"/rules/macro-tutorial"},{"title":"Creating a Legacy Macro","href":"/rules/legacy-macro-tutorial"},{"title":"Using Macros to Create Custom Verbs","href":"/rules/verbs-tutorial"},{"title":"Starlark Language","href":"/rules/language"},{"title":".bzl style guide","href":"/rules/bzl-style"},{"title":"Challenges of Writing Rules","href":"/rules/challenges"},{"title":"Writing Rules on Windows","href":"/rules/windows"}]},{"group":"Distributing rules","pages":[{"title":"Testing","href":"/rules/testing"},{"title":"Optimizing Performance","href":"/rules/performance"},{"title":"Deploying Rules","href":"/rules/deploying"}]},{"group":"Platforms \u0026 toolchains","pages":[{"title":"Platforms","href":"/concepts/platforms"},{"title":"Toolchains","href":"/extending/toolchains"}]},{"group":"API Reference Overview","pages":[{"title":"One-Page Overview","href":"/rules/lib/overview"},{"title":"Rules","href":"/rules/index"},{"title":"Frequently Asked Questions","href":"/rules/faq"}]},{"group":"Starlark Builtins","pages":[{"title":"Error: Variable x is read only","href":"/rules/errors/read-only-variable"},{"title":"Built-in Types","href":"/rules/lib/builtins"},{"title":"Action","href":"/rules/lib/builtins/Action"},{"title":"actions","href":"/rules/lib/builtins/actions"},{"title":"Args","href":"/rules/lib/builtins/Args"},{"title":"Aspect","href":"/rules/lib/builtins/Aspect"},{"title":"Attribute","href":"/rules/lib/builtins/Attribute"},{"title":"BuildSetting","href":"/rules/lib/builtins/BuildSetting"},{"title":"CcCompilationOutputs","href":"/rules/lib/builtins/CcCompilationOutputs"},{"title":"CcLinkingOutputs","href":"/rules/lib/builtins/CcLinkingOutputs"},{"title":"CompilationContext","href":"/rules/lib/builtins/CompilationContext"},{"title":"DirectoryExpander","href":"/rules/lib/builtins/DirectoryExpander"},{"title":"DottedVersion","href":"/rules/lib/builtins/DottedVersion"},{"title":"ExecGroupCollection","href":"/rules/lib/builtins/ExecGroupCollection"},{"title":"ExecGroupContext","href":"/rules/lib/builtins/ExecGroupContext"},{"title":"ExecTransitionFactory","href":"/rules/lib/builtins/ExecTransitionFactory"},{"title":"ExpandedDirectory","href":"/rules/lib/builtins/ExpandedDirectory"},{"title":"Facts","href":"/rules/lib/builtins/Facts"},{"title":"FeatureConfiguration","href":"/rules/lib/builtins/FeatureConfiguration"},{"title":"File","href":"/rules/lib/builtins/File"},{"title":"Label","href":"/rules/lib/builtins/Label"},{"title":"LateBoundDefault","href":"/rules/lib/builtins/LateBoundDefault"},{"title":"LibraryToLink","href":"/rules/lib/builtins/LibraryToLink"},{"title":"License","href":"/rules/lib/builtins/License"},{"title":"LinkerInput","href":"/rules/lib/builtins/LinkerInput"},{"title":"LinkingContext","href":"/rules/lib/builtins/LinkingContext"},{"title":"Provider","href":"/rules/lib/builtins/Provider"},{"title":"Subrule","href":"/rules/lib/builtins/Subrule"},{"title":"SymlinkEntry","href":"/rules/lib/builtins/SymlinkEntry"},{"title":"Target","href":"/rules/lib/builtins/Target"},{"title":"TemplateDict","href":"/rules/lib/builtins/TemplateDict"},{"title":"ToolchainContext","href":"/rules/lib/builtins/ToolchainContext"},{"title":"apple_platform","href":"/rules/lib/builtins/apple_platform"},{"title":"bazel_module","href":"/rules/lib/builtins/bazel_module"},{"title":"bazel_module_tags","href":"/rules/lib/builtins/bazel_module_tags"},{"title":"configuration","href":"/rules/lib/builtins/configuration"},{"title":"ctx","href":"/rules/lib/builtins/ctx"},{"title":"depset","href":"/rules/lib/builtins/depset"},{"title":"exec_result","href":"/rules/lib/builtins/exec_result"},{"title":"extension_metadata","href":"/rules/lib/builtins/extension_metadata"},{"title":"fragments","href":"/rules/lib/builtins/fragments"},{"title":"java_annotation_processing","href":"/rules/lib/builtins/java_annotation_processing"},{"title":"java_output","href":"/rules/lib/builtins/java_output"},{"title":"macro","href":"/rules/lib/builtins/macro"},{"title":"mapped_root","href":"/rules/lib/builtins/mapped_root"},{"title":"module_ctx","href":"/rules/lib/builtins/module_ctx"},{"title":"path","href":"/rules/lib/builtins/path"},{"title":"propagation_ctx","href":"/rules/lib/builtins/propagation_ctx"},{"title":"repo_metadata","href":"/rules/lib/builtins/repo_metadata"},{"title":"repository_ctx","href":"/rules/lib/builtins/repository_ctx"},{"title":"repository_os","href":"/rules/lib/builtins/repository_os"},{"title":"repository_rule","href":"/rules/lib/builtins/repository_rule"},{"title":"root","href":"/rules/lib/builtins/root"},{"title":"rule","href":"/rules/lib/builtins/rule"},{"title":"rule_attributes","href":"/rules/lib/builtins/rule_attributes"},{"title":"runfiles","href":"/rules/lib/builtins/runfiles"},{"title":"struct","href":"/rules/lib/builtins/struct"},{"title":"subrule_ctx","href":"/rules/lib/builtins/subrule_ctx"},{"title":"tag_class","href":"/rules/lib/builtins/tag_class"},{"title":"template_ctx","href":"/rules/lib/builtins/template_ctx"},{"title":"toolchain_type","href":"/rules/lib/builtins/toolchain_type"},{"title":"transition","href":"/rules/lib/builtins/transition"},{"title":"wasm_exec_result","href":"/rules/lib/builtins/wasm_exec_result"},{"title":"wasm_module","href":"/rules/lib/builtins/wasm_module"}]},{"group":"Core Types","pages":[{"title":"Core Starlark data types","href":"/rules/lib/core"},{"title":"bool","href":"/rules/lib/core/bool"},{"title":"builtin_function_or_method","href":"/rules/lib/core/builtin_function_or_method"},{"title":"dict","href":"/rules/lib/core/dict"},{"title":"float","href":"/rules/lib/core/float"},{"title":"function","href":"/rules/lib/core/function"},{"title":"int","href":"/rules/lib/core/int"},{"title":"json","href":"/rules/lib/core/json"},{"title":"list","href":"/rules/lib/core/list"},{"title":"range","href":"/rules/lib/core/range"},{"title":"set","href":"/rules/lib/core/set"},{"title":"string","href":"/rules/lib/core/string"},{"title":"tuple","href":"/rules/lib/core/tuple"}]},{"group":"Providers","pages":[{"title":"Providers","href":"/rules/lib/providers"},{"title":"AnalysisTestResultInfo","href":"/rules/lib/providers/AnalysisTestResultInfo"},{"title":"CcInfo","href":"/rules/lib/providers/CcInfo"},{"title":"CcToolchainConfigInfo","href":"/rules/lib/providers/CcToolchainConfigInfo"},{"title":"CcToolchainInfo","href":"/rules/lib/providers/CcToolchainInfo"},{"title":"ConstraintCollection","href":"/rules/lib/providers/ConstraintCollection"},{"title":"ConstraintSettingInfo","href":"/rules/lib/providers/ConstraintSettingInfo"},{"title":"ConstraintValueInfo","href":"/rules/lib/providers/ConstraintValueInfo"},{"title":"DebugPackageInfo","href":"/rules/lib/providers/DebugPackageInfo"},{"title":"DefaultInfo","href":"/rules/lib/providers/DefaultInfo"},{"title":"ExecutionInfo","href":"/rules/lib/providers/ExecutionInfo"},{"title":"FeatureFlagInfo","href":"/rules/lib/providers/FeatureFlagInfo"},{"title":"FilesToRunProvider","href":"/rules/lib/providers/FilesToRunProvider"},{"title":"IncompatiblePlatformProvider","href":"/rules/lib/providers/IncompatiblePlatformProvider"},{"title":"InstrumentedFilesInfo","href":"/rules/lib/providers/InstrumentedFilesInfo"},{"title":"JavaInfo","href":"/rules/lib/providers/JavaInfo"},{"title":"JavaPluginInfo","href":"/rules/lib/providers/JavaPluginInfo"},{"title":"JavaRuntimeInfo","href":"/rules/lib/providers/JavaRuntimeInfo"},{"title":"JavaToolchainInfo","href":"/rules/lib/providers/JavaToolchainInfo"},{"title":"MaterializedDepsInfo","href":"/rules/lib/providers/MaterializedDepsInfo"},{"title":"ObjcProvider","href":"/rules/lib/providers/ObjcProvider"},{"title":"OutputGroupInfo","href":"/rules/lib/providers/OutputGroupInfo"},{"title":"PackageSpecificationInfo","href":"/rules/lib/providers/PackageSpecificationInfo"},{"title":"PlatformInfo","href":"/rules/lib/providers/PlatformInfo"},{"title":"RunEnvironmentInfo","href":"/rules/lib/providers/RunEnvironmentInfo"},{"title":"TemplateVariableInfo","href":"/rules/lib/providers/TemplateVariableInfo"},{"title":"ToolchainInfo","href":"/rules/lib/providers/ToolchainInfo"},{"title":"ToolchainTypeInfo","href":"/rules/lib/providers/ToolchainTypeInfo"},{"title":"file_provider","href":"/rules/lib/providers/file_provider"},{"title":"java_compilation_info","href":"/rules/lib/providers/java_compilation_info"},{"title":"java_output_jars","href":"/rules/lib/providers/java_output_jars"}]},{"group":"Global Functions","pages":[{"title":"Global functions","href":"/rules/lib/globals"},{"title":"All Bazel files","href":"/rules/lib/globals/all"},{"title":"BUILD files","href":"/rules/lib/globals/build"},{"title":"REPO.bazel files","href":"/rules/lib/globals/repo"},{"title":"VENDOR.bazel files","href":"/rules/lib/globals/vendor"},{"title":".bzl files","href":"/rules/lib/globals/bzl"},{"title":"MODULE.bazel files","href":"/rules/lib/globals/module"}]},{"group":"Configuration Fragments","pages":[{"title":"Configuration Fragments","href":"/rules/lib/fragments"},{"title":"apple","href":"/rules/lib/fragments/apple"},{"title":"bazel_android","href":"/rules/lib/fragments/bazel_android"},{"title":"coverage","href":"/rules/lib/fragments/coverage"},{"title":"cpp","href":"/rules/lib/fragments/cpp"},{"title":"java","href":"/rules/lib/fragments/java"},{"title":"objc","href":"/rules/lib/fragments/objc"},{"title":"platform","href":"/rules/lib/fragments/platform"},{"title":"proto","href":"/rules/lib/fragments/proto"}]},{"group":"Toplevel APIs","pages":[{"title":"Top-level Modules","href":"/rules/lib/toplevel"},{"title":"apple_common","href":"/rules/lib/toplevel/apple_common"},{"title":"attr","href":"/rules/lib/toplevel/attr"},{"title":"cc_common","href":"/rules/lib/toplevel/cc_common"},{"title":"config","href":"/rules/lib/toplevel/config"},{"title":"config_common","href":"/rules/lib/toplevel/config_common"},{"title":"coverage_common","href":"/rules/lib/toplevel/coverage_common"},{"title":"java_common","href":"/rules/lib/toplevel/java_common"},{"title":"native","href":"/rules/lib/toplevel/native"},{"title":"platform_common","href":"/rules/lib/toplevel/platform_common"},{"title":"proto","href":"/rules/lib/toplevel/proto"},{"title":"testing","href":"/rules/lib/toplevel/testing"}]},{"group":"Repo rules","pages":[{"title":"Repository Rules","href":"/rules/lib/repo/index"},{"title":"cache repository rules","href":"/rules/lib/repo/cache"},{"title":"git repository rules","href":"/rules/lib/repo/git"},{"title":"http repository rules","href":"/rules/lib/repo/http"},{"title":"local repository rules","href":"/rules/lib/repo/local"},{"title":"utils repository rules","href":"/rules/lib/repo/utils"}]},{"group":"Module system","pages":[{"title":"External dependencies overview","href":"/external/overview"},{"title":"Bazel modules","href":"/external/module"},{"title":"Module extensions","href":"/external/extension"},{"title":"Bazel registries","href":"/external/registry"},{"title":"Bazel Lockfile","href":"/external/lockfile"},{"title":"Vendor Mode","href":"/external/vendor"},{"title":"Repository Rules","href":"/external/repo"},{"title":null,"href":"/external/mod-command"},{"title":"Bzlmod Migration Guide","href":"/external/migration"},{"title":null,"href":"/external/migration_tool"},{"title":"Frequently asked questions","href":"/external/faq"}]}]},{"tab":"Community","groups":[{"group":"Contributing","pages":[{"title":"Contributing to Bazel","href":"/contribute"},{"title":null,"href":"/contribute/policy"},{"title":"Patch Acceptance Process","href":"/contribute/patch-acceptance"},{"title":"Guide for Bazel Maintainers","href":"/contribute/maintainers-guide"},{"title":"The Bazel codebase","href":"/contribute/codebase"},{"title":"Searching the codebase","href":"/contribute/search"},{"title":"A Guide to Skyframe `StateMachine`s","href":"/contribute/statemachine-guide"},{"title":"Contribute to Bazel documentation","href":"/contribute/docs"},{"title":"Bazel docs style guide","href":"/contribute/docs-style-guide"},{"title":"Docs contribution workflow","href":"/contribute/docs-contribution-workflow"},{"title":"Update the docs navigation","href":"/contribute/docs-navigation"},{"title":"Design Documents","href":"/contribute/design-documents"},{"title":"Writing release notes","href":"/contribute/release-notes"},{"title":"Guide for rolling out breaking changes","href":"/contribute/breaking-changes"},{"title":"Naming a Bazel related project","href":"/contribute/naming"},{"title":"Maintaining Bazel Chocolatey package on Windows","href":"/contribute/windows-chocolatey-maintenance"},{"title":"Maintaining Bazel Scoop package on Windows","href":"/contribute/windows-scoop-maintenance"}]},{"group":"Programs","pages":[{"title":"Bazel Special Interest Groups","href":"/community/sig"},{"title":"Bazel Community Experts","href":"/community/experts"},{"title":"Bazel Product Partners","href":"/community/partners"},{"title":"Who's Using Bazel","href":"/community/users"},{"title":"Recommended Rules","href":"/community/recommended-rules"},{"title":"Remote Execution Services","href":"/community/remote-execution-services"}]},{"group":"Getting help","pages":[{"title":"Getting Help","href":"/help"},{"title":null,"href":"/contribute/policy"}]},{"group":"Brand","pages":[{"title":"Bazel Brand Guidelines","href":"/brand/index"}]}]}]}]},{"version":"9.3","pages":[{"title":"9.3","href":"/versions/9.3.0/rules/lib/builtins/template_ctx"}]},{"version":"9.2","pages":[{"title":"9.2","href":"/versions/9.2.0/rules/lib/builtins/template_ctx"}]},{"version":"9.1","pages":[{"title":"9.1","href":"/versions/9.1.0/about/intro"}]},{"version":"9.0","pages":[{"title":"9.0","href":"/versions/9.0.0/about/intro"}]},{"version":"8.8","pages":[{"title":"8.8","href":"/versions/8.8.1/about/intro"}]},{"version":"8.7","pages":[{"title":"8.7","href":"/versions/8.7.0/about/intro"}]},{"version":"8.6","pages":[{"title":"8.6","href":"/versions/8.6.0/about/intro"}]},{"version":"8.5","pages":[{"title":"8.5","href":"/versions/8.5.1/about/intro"}]},{"version":"8.4","pages":[{"title":"8.4","href":"/versions/8.4.2/about/intro"}]},{"version":"8.3","pages":[{"title":"8.3","href":"/versions/8.3.1/about/intro"}]},{"version":"8.2","pages":[{"title":"8.2","href":"/versions/8.2.1/about/intro"}]},{"version":"8.1","pages":[{"title":"8.1","href":"/versions/8.1.1/about/intro"}]},{"version":"8.0","pages":[{"title":"8.0","href":"/versions/8.0.1/about/intro"}]},{"version":"7.7","pages":[{"title":"7.7","href":"/versions/7.7.1/about/intro"}]}]},"title":"template_ctx - Bazel Documentation","buildId":"dpl_CUnGQP1HgFUzoxatVC37y4zP83Vx","deploymentId":"dpl_CUnGQP1HgFUzoxatVC37y4zP83Vx","dynamics":["10e4515597"],"chunks":["BannerMarkdown-D8Bv1Qka.js","dist-C1mdUKmc.js","lib-DnkIZQB2.js","lib-q-9GBWeW.js","clsx-D_lcEXjg.js","html-void-elements-mCSPHezU.js","katex-Cnv50rb0.js","marked.esm-BKo0Hl1x.js"]}