Page Not Found
We could not find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/404.html b/404.html new file mode 100644 index 0000000000000..785e31e991e36 --- /dev/null +++ b/404.html @@ -0,0 +1,20 @@ + + +
+ + +We could not find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
.buckconfig
",id:"re-configuration-in-buckconfig",level:2},{value:"RE platform configuration",id:"re-platform-configuration",level:2}];function d(e){const n={a:"a",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",ul:"ul",...(0,s.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.p,{children:["Buck2 can use services that expose\n",(0,t.jsx)(n.a,{href:"https://github.com/bazelbuild/remote-apis",children:"Bazel's remote execution API"})," in\norder to run actions remotely."]}),"\n",(0,t.jsxs)(n.p,{children:["Buck2 projects have been successfully tested for remote execution against\n",(0,t.jsx)(n.a,{href:"https://www.engflow.com/",children:"EngFlow"}),",\n",(0,t.jsx)(n.a,{href:"https://github.com/buildbarn/bb-remote-execution",children:"BuildBarn"})," and\n",(0,t.jsx)(n.a,{href:"https://www.buildbuddy.io",children:"BuildBuddy"}),". Sample project configurations for those\nproviders are available under\n",(0,t.jsx)(n.a,{href:"https://github.com/facebook/buck2/tree/main/examples/remote_execution",children:"examples/remote_execution"}),"."]}),"\n",(0,t.jsxs)(n.h2,{id:"re-configuration-in-buckconfig",children:["RE configuration in ",(0,t.jsx)(n.code,{children:".buckconfig"})]}),"\n",(0,t.jsxs)(n.p,{children:["Configuration for remote execution can be found under ",(0,t.jsx)(n.code,{children:"[buck2_re_client]"})," in\n",(0,t.jsx)(n.code,{children:".buckconfig"}),"."]}),"\n",(0,t.jsx)(n.p,{children:"Keys supported include:"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"engine_address"})," - address to your RE's engine."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"action_cache_address"})," - address to your action cache endpoint."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"cas_address"})," - address to your content-addressable storage (CAS) endpoint."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"tls_ca_certs"})," - path to a CA certificates bundle. This must be PEM-encoded.\nIf none is set, a default bundle will be used. This path contains environment\nvariables using shell interpolation syntax (i.e. $VAR). They will be\nsubstituted before reading the file."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"tls_client_cert"})," - path to a client certificate (and intermediate chain), as\nwell as its associated private key. This must be PEM-encoded. This path can\ncontain environment variables using shell interpolation syntax (i.e. $VAR).\nThey will be substituted before reading the file."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"http_headers"})," - HTTP headers to inject in all requests to RE. This is a\ncomma-separated list of ",(0,t.jsx)(n.code,{children:"Header: Value"})," pairs. Minimal validation of those\nheaders is done here. This can contain environment variables using shell\ninterpolation syntax ($VAR). They will be substituted before reading the file."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"instance_name"})," - an instance name to pass on execution, action cache, and CAS\nrequests."]}),"\n"]}),"\n",(0,t.jsxs)(n.p,{children:["Buck2 uses ",(0,t.jsx)(n.code,{children:"SHA256"})," for all its hashing by default. If your RE engine requires\nsomething else, this can be configured in ",(0,t.jsx)(n.code,{children:".buckconfig"})," as follows:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-ini",children:"[buck2]\n# Accepts BLAKE3, SHA1, or SHA256\ndigest_algorithms = BLAKE3\n"})}),"\n",(0,t.jsx)(n.h2,{id:"re-platform-configuration",children:"RE platform configuration"}),"\n",(0,t.jsxs)(n.p,{children:["Next, your build will need an\n",(0,t.jsx)(n.a,{href:"https://buck2.build/docs/concepts/glossary/#execution-platform",children:"execution platform"}),"\nthat specifies how and where actions should be executed. For a sample platform\ndefinition that sets up an execution platform to utilize RE, take a look at the\n",(0,t.jsx)(n.a,{href:"https://github.com/facebook/buck2/blob/main/examples/remote_execution/engflow/platforms/defs.bzl",children:"EngFlow example"}),",\n",(0,t.jsx)(n.a,{href:"https://github.com/facebook/buck2/blob/main/examples/remote_execution/buildbarn/platforms/defs.bzl",children:"BuildBarn example"}),",\nor the\n",(0,t.jsx)(n.a,{href:"https://github.com/facebook/buck2/blob/main/examples/remote_execution/buildbuddy/platforms/defs.bzl",children:"BuildBuddy example"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["To enable remote execution, configure the following fields in\n",(0,t.jsx)(n.a,{href:"https://buck2.build/docs/api/build/globals/#commandexecutorconfig",children:"CommandExecutorConfig"}),"\nas follows:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"remote_enabled"})," - set to ",(0,t.jsx)(n.code,{children:"True"}),"."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"local_enabled"})," - set to ",(0,t.jsx)(n.code,{children:"True"})," if you also want to run actions locally."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"use_limited_hybrid"})," - set to ",(0,t.jsx)(n.code,{children:"False"})," unless you want to exclusively run\nremotely when possible."]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"remote_execution_properties"})," - other additional properties.","\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["If the RE engine requires a container image, this can be done by setting\n",(0,t.jsx)(n.code,{children:"container-image"})," to an image URL, as is done in the example above."]}),"\n"]}),"\n"]}),"\n"]})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},28453:(e,n,i)=>{i.d(n,{R:()=>r,x:()=>c});var t=i(96540);const s={},o=t.createContext(s);function r(e){const n=t.useContext(o);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:r(e.components),t.createElement(o.Provider,{value:n},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/0d303d7c.b0946604.js b/assets/js/0d303d7c.b0946604.js
new file mode 100644
index 0000000000000..7a1732b2220dd
--- /dev/null
+++ b/assets/js/0d303d7c.b0946604.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6365],{17589:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>g,frontMatter:()=>a,metadata:()=>d,toc:()=>c});var n=r(74848),s=r(28453),i=r(28774);const a={},o="TargetUniverse",d={id:"api/bxl/TargetUniverse",title:"TargetUniverse",description:"Target universe in BXL. Used for looking up valid configured targets to use in cquery. This is not needed for uquery.",source:"@site/../docs/api/bxl/TargetUniverse.md",sourceDirName:"api/bxl",slug:"/api/bxl/TargetUniverse",permalink:"/docs/api/bxl/TargetUniverse",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{},sidebar:"apiSidebar",previous:{title:"SelectDict",permalink:"/docs/api/bxl/SelectDict"},next:{title:"UnconfiguredTargetNode",permalink:"/docs/api/bxl/UnconfiguredTargetNode"}},l={},c=[{value:"TargetUniverse.lookup",id:"targetuniverselookup",level:2},{value:"TargetUniverse.target_set",id:"targetuniversetarget_set",level:2},{value:"TargetUniverse.universe_target_set",id:"targetuniverseuniverse_target_set",level:2}];function u(e){const t={h1:"h1",h2:"h2",header:"header",hr:"hr",p:"p",...(0,s.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.header,{children:(0,n.jsx)(t.h1,{id:"targetuniverse",children:"TargetUniverse"})}),"\n",(0,n.jsx)(t.p,{children:"Target universe in BXL. Used for looking up valid configured targets to use in cquery. This is not needed for uquery."}),"\n",(0,n.jsx)(t.h2,{id:"targetuniverselookup",children:"TargetUniverse.lookup"}),"\n",(0,n.jsx)("pre",{class:"language-python",children:(0,n.jsxs)("code",{children:["def TargetUniverse.lookup(\ntargets: ",(0,n.jsx)(i.default,{to:"/docs/api/bxl/UnconfiguredTargetNode",children:"bxl.UnconfiguredTargetNode"})," | ",(0,n.jsx)(i.default,{to:"/docs/api/starlark/str",children:"str"})," | ",(0,n.jsx)(i.default,{to:"/docs/api/build/TargetLabel",children:"target_label"})," | ",(0,n.jsx)(i.default,{to:"/docs/api/bxl/UnconfiguredTargetSet",children:"target_set"})," | list[",(0,n.jsx)(i.default,{to:"/docs/api/bxl/UnconfiguredTargetNode",children:"bxl.UnconfiguredTargetNode"})," | ",(0,n.jsx)(i.default,{to:"/docs/api/starlark/str",children:"str"})," | ",(0,n.jsx)(i.default,{to:"/docs/api/build/TargetLabel",children:"target_label"}),"],\n) -> ",(0,n.jsx)(i.default,{to:"/docs/api/bxl/ConfiguredTargetSet",children:"target_set"})]})}),"\n",(0,n.jsx)(t.p,{children:"Looks up valid configured target nodes within the universe. The targets passed in are either string literals, unconfigured target nodes, or unconfigured target labels."}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h2,{id:"targetuniversetarget_set",children:"TargetUniverse.target_set"}),"\n",(0,n.jsx)("pre",{class:"language-python",children:(0,n.jsxs)("code",{children:["def TargetUniverse.target_set(\n) -> ",(0,n.jsx)(i.default,{to:"/docs/api/bxl/ConfiguredTargetSet",children:"target_set"})]})}),"\n",(0,n.jsx)(t.p,{children:"The target set of the nodes used to construct the target universe."}),"\n",(0,n.jsx)(t.hr,{}),"\n",(0,n.jsx)(t.h2,{id:"targetuniverseuniverse_target_set",children:"TargetUniverse.universe_target_set"}),"\n",(0,n.jsx)("pre",{class:"language-python",children:(0,n.jsxs)("code",{children:["def TargetUniverse.universe_target_set(\n) -> ",(0,n.jsx)(i.default,{to:"/docs/api/bxl/ConfiguredTargetSet",children:"target_set"})]})}),"\n",(0,n.jsx)(t.p,{children:"The target set of the entire target universe."})]})}function g(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(u,{...e})}):u(e)}},28453:(e,t,r)=>{r.d(t,{R:()=>a,x:()=>o});var n=r(96540);const s={},i=n.createContext(s);function a(e){const t=n.useContext(i);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),n.createElement(i.Provider,{value:t},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/0f079156.9b6eb93e.js b/assets/js/0f079156.9b6eb93e.js
new file mode 100644
index 0000000000000..309b4ff283371
--- /dev/null
+++ b/assets/js/0f079156.9b6eb93e.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9713],{6619:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>f,contentTitle:()=>c,default:()=>u,frontMatter:()=>o,metadata:()=>a,toc:()=>i});var s=n(74848),r=n(28453);const o={},c="RFC: TestInfo v2",a={id:"rfcs/drafts/test-info-v2",title:"RFC: TestInfo v2",description:"A stub RFC for TestInfo v2 to track lessons learned about TestInfo v1. The stack",source:"@site/../docs/rfcs/drafts/test-info-v2.md",sourceDirName:"rfcs/drafts",slug:"/rfcs/drafts/test-info-v2",permalink:"/docs/rfcs/drafts/test-info-v2",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{}},f={},i=[];function d(t){const e={a:"a",h1:"h1",header:"header",p:"p",...(0,r.R)(),...t.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(e.header,{children:(0,s.jsx)(e.h1,{id:"rfc-testinfo-v2",children:"RFC: TestInfo v2"})}),"\n",(0,s.jsxs)(e.p,{children:["A stub RFC for TestInfo v2 to track lessons learned about TestInfo v1. The stack\nstarting"," ",(0,s.jsx)(e.a,{href:"https://internalfb.com/D36339960",children:"D36339960"})," ","contains the original code for the TestInfo and templated\ntest API experiment."]})]})}function u(t={}){const{wrapper:e}={...(0,r.R)(),...t.components};return e?(0,s.jsx)(e,{...t,children:(0,s.jsx)(d,{...t})}):d(t)}},28453:(t,e,n)=>{n.d(e,{R:()=>c,x:()=>a});var s=n(96540);const r={},o=s.createContext(r);function c(t){const e=s.useContext(o);return s.useMemo((function(){return"function"==typeof t?t(e):{...e,...t}}),[e,t])}function a(t){let e;return e=t.disableParentContext?"function"==typeof t.components?t.components(r):t.components||r:c(t.components),s.createElement(o.Provider,{value:e},t.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/0fa06060.7d265d4c.js b/assets/js/0fa06060.7d265d4c.js
new file mode 100644
index 0000000000000..2afc8715453da
--- /dev/null
+++ b/assets/js/0fa06060.7d265d4c.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1502],{75768:(e,i,n)=>{n.r(i),n.d(i,{assets:()=>d,contentTitle:()=>t,default:()=>u,frontMatter:()=>l,metadata:()=>a,toc:()=>c});var s=n(74848),r=n(28453);const l={id:"build_rule",title:"Build Rule"},t="Build Rule",a={id:"concepts/build_rule",title:"Build Rule",description:"A build rule is a procedure for producing output files from a set of input",source:"@site/../docs/concepts/build_rule.md",sourceDirName:"concepts",slug:"/concepts/build_rule",permalink:"/docs/concepts/build_rule",draft:!1,unlisted:!1,tags:[],version:"current",frontMatter:{id:"build_rule",title:"Build Rule"},sidebar:"main",previous:{title:"Concept Map",permalink:"/docs/concepts/concept_map"},next:{title:"Build File",permalink:"/docs/concepts/build_file"}},d={},c=[{value:"Buck2's collection of build rules",id:"buck2s-collection-of-build-rules",level:2},{value:"Source files as inputs to build rules",id:"source-files-as-inputs-to-build-rules",level:2},{value:"Package boundaries and access to source files",id:"package-boundaries-and-access-to-source-files",level:3},{value:"Symlinks: Use with caution if at all",id:"symlinks-use-with-caution-if-at-all",level:5},{value:"Dependencies: Output from one rule as input to another rule",id:"dependencies-output-from-one-rule-as-input-to-another-rule",level:2},{value:"Required dependencies are always built first",id:"required-dependencies-are-always-built-first",level:3},{value:"Visibility",id:"visibility",level:3},{value:"Dependencies define a graph",id:"dependencies-define-a-graph",level:3},{value:"How to handle special cases: genrules and macros",id:"how-to-handle-special-cases-genrules-and-macros",level:2},{value:"Multiple output files with genrules",id:"multiple-output-files-with-genrules",level:3},{value:"Macros",id:"macros",level:3},{value:"String parameter macros",id:"string-parameter-macros",level:2}];function o(e){const i={a:"a",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",h5:"h5",header:"header",li:"li",p:"p",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.header,{children:(0,s.jsx)(i.h1,{id:"build-rule",children:"Build Rule"})}),"\n",(0,s.jsxs)(i.p,{children:["A ",(0,s.jsx)(i.em,{children:"build rule"})," is a procedure for producing output files from a set of input\nfiles in the context of a specified build configuration. Build rules are\nspecified in ",(0,s.jsx)(i.a,{href:"/docs/concepts/build_file",children:"build file"}),"s\u2014typically named BUCK. ",(0,s.jsx)(i.strong,{children:"Note:"})," A\nbuild rule must explicitly specify, in its arguments, all of its required inputs\nin order for Buck2 to be able to build the rule's output in a way that is\ndeterministic and reproducible."]}),"\n",(0,s.jsx)(i.h2,{id:"buck2s-collection-of-build-rules",children:"Buck2's collection of build rules"}),"\n",(0,s.jsxs)(i.p,{children:["Buck2 comes with a collection of built-in build rules for many common build\nprocedures. For example, compiling Java code against the Android SDK is a common\nprocedure, so Buck2 provides the build rule\n",(0,s.jsx)(i.a,{href:"../../prelude/globals#android_library",children:(0,s.jsx)(i.code,{children:"android_library"})})," to do that.\nSimilarly, the final product of most Android development is an APK, so you can\nuse the build rule ",(0,s.jsx)(i.a,{href:"../../prelude/globals#android_binary",children:(0,s.jsx)(i.code,{children:"android_binary"})})," to\ncreate an APK."]}),"\n",(0,s.jsx)(i.h2,{id:"source-files-as-inputs-to-build-rules",children:"Source files as inputs to build rules"}),"\n",(0,s.jsxs)(i.p,{children:["Most build rules specify source files as inputs. For example, a\n",(0,s.jsx)(i.a,{href:"../../prelude/globals#cxx_library",children:(0,s.jsx)(i.code,{children:"cxx_library"})})," rule would specify ",(0,s.jsx)(i.code,{children:".cpp"}),"\nfiles as inputs. To support specifying these files, a ",(0,s.jsx)(i.code,{children:"cxx_library"})," rule\nprovides the ",(0,s.jsx)(i.code,{children:"srcs"})," argument. Some languages, such as C++, use header files as\nwell. To specify these, ",(0,s.jsx)(i.code,{children:"cxx_library"})," provides a ",(0,s.jsx)(i.code,{children:"headers"})," argument. In addition\nto ",(0,s.jsx)(i.code,{children:"srcs"})," and ",(0,s.jsx)(i.code,{children:"headers"}),", some rules provide variants of these arguments, such as\n",(0,s.jsx)(i.code,{children:"platform_srcs"})," and ",(0,s.jsx)(i.code,{children:"platform_headers"}),". These arguments support groups of source\nfiles that should be used as inputs only when building for specific platforms."]}),"\n",(0,s.jsx)(i.h3,{id:"package-boundaries-and-access-to-source-files",children:"Package boundaries and access to source files"}),"\n",(0,s.jsxs)(i.p,{children:["In Buck2, a BUCK file defines a ",(0,s.jsx)(i.em,{children:"package"}),", which corresponds ",(0,s.jsx)(i.em,{children:"roughly"})," to the\ndirectory that contains the BUCK file and those subdirectories that do not\nthemselves contain BUCK files. (To learn more, see the\n",(0,s.jsx)(i.a,{href:"/docs/concepts/key_concepts",children:"Key Concepts"})," topic.) A rule in a BUCK file cannot specify a\nsource file as an input unless that source file is in that BUCK file's package.\nAn exception to this restriction exists for header files, but only if a rule in\nthe package that contains the header file ",(0,s.jsx)(i.em,{children:"exports"})," that header file using the\n",(0,s.jsx)(i.code,{children:"exported_headers"})," argument. For more details, see the description for\n",(0,s.jsx)(i.code,{children:"exported_headers"})," in, for example, the\n",(0,s.jsx)(i.a,{href:"../../prelude/globals#cxx_library",children:(0,s.jsx)(i.code,{children:"cxx_library"})})," topic. More commonly though,\nthe package for a BUCK file contains all the source files required for the rules\ndefined in that BUCK file. Functionality in source files from other packages is\nmade available through the artifacts produced by the rules in the BUCK files for\nthose packages. For example, a ",(0,s.jsx)(i.a,{href:"../../prelude/globals/#cxx_binary",children:(0,s.jsx)(i.code,{children:"cxx_binary"})}),"\nmight use the functionality in a ",(0,s.jsx)(i.code,{children:"cxx_library"})," that is defined in another\npackage. To access that functionality, the ",(0,s.jsx)(i.code,{children:"cxx_binary"})," would take that\n",(0,s.jsx)(i.code,{children:"cxx_library"})," as a ",(0,s.jsx)(i.em,{children:"dependency"}),"."]}),"\n",(0,s.jsx)(i.h5,{id:"symlinks-use-with-caution-if-at-all",children:"Symlinks: Use with caution if at all"}),"\n",(0,s.jsxs)(i.p,{children:["We recommend that you do ",(0,s.jsx)(i.em,{children:"not"})," use symlinks\u2014either absolute or relative\u2014to\nspecify input files to build rules. Although using symlinks in this context does\nsometimes work, it can lead to unexpected behavior and errors."]}),"\n",(0,s.jsx)(i.h2,{id:"dependencies-output-from-one-rule-as-input-to-another-rule",children:"Dependencies: Output from one rule as input to another rule"}),"\n",(0,s.jsxs)(i.p,{children:["A build rule can use the output from another build rule as one of its inputs by\nspecifying that rule as a ",(0,s.jsx)(i.em,{children:"dependency"}),". Typically, a build rule specifies its\ndependencies as a list of ",(0,s.jsx)(i.a,{href:"/docs/concepts/build_target",children:"build target"}),"s in its ",(0,s.jsx)(i.code,{children:"deps"}),"\nargument. However, the rule can also specify dependencies\u2014as build targets\u2014in\nother arguments, such as ",(0,s.jsx)(i.code,{children:"srcs"}),". ",(0,s.jsx)(i.strong,{children:"Example:"})," The output of a\n",(0,s.jsx)(i.a,{href:"../../prelude/globals/#java_library",children:(0,s.jsx)(i.code,{children:"java_library"})})," rule is a JAR file. If a\n",(0,s.jsx)(i.code,{children:"java_library"})," rule specifies another ",(0,s.jsx)(i.code,{children:"java_library"})," rule as a dependency, the\nJAR file produced by the specified rule is added to the classpath for the\n",(0,s.jsx)(i.code,{children:"java_library"})," that depends on it. ",(0,s.jsx)(i.strong,{children:"Example:"})," If a\n",(0,s.jsx)(i.a,{href:"../../prelude/globals/#java_binary",children:(0,s.jsx)(i.code,{children:"java_binary"})})," rule specifies a\n",(0,s.jsx)(i.code,{children:"java_library"})," rule as a dependency, the JAR file for the specified\n",(0,s.jsx)(i.code,{children:"java_library"})," is available on the classpath for the ",(0,s.jsx)(i.code,{children:"java_binary"}),". In addition,\nin the case of ",(0,s.jsx)(i.code,{children:"java_binary"}),", the JAR files for any dependencies of the\n",(0,s.jsx)(i.code,{children:"java_library"})," rule ",(0,s.jsx)(i.em,{children:"are also"})," made available to the ",(0,s.jsx)(i.code,{children:"java_binary"})," rule\u2014and if\nthose dependencies have dependencies of their own, they are added as well. This\nexhaustive cascade of dependencies is referred to as the rule's ",(0,s.jsx)(i.em,{children:"transitive\nclosure"}),"."]}),"\n",(0,s.jsx)(i.h3,{id:"required-dependencies-are-always-built-first",children:"Required dependencies are always built first"}),"\n",(0,s.jsxs)(i.p,{children:["Buck2 guarantees that any dependencies that a rule lists that are required in\norder to build that rule are built successfully ",(0,s.jsx)(i.em,{children:"before"})," Buck2 builds the rule\nitself. Note though that there can be special cases\u2014such as\n",(0,s.jsx)(i.a,{href:"../../prelude/globals/#apple_bundle",children:(0,s.jsx)(i.code,{children:"apple_bundle"})}),"\u2014where a rule's listed\ndependencies do not actually need to be built before the rule."]}),"\n",(0,s.jsx)(i.h3,{id:"visibility",children:"Visibility"}),"\n",(0,s.jsxs)(i.p,{children:["In order for a build rule to take a dependency on another build rule, the build\nrule on which the dependency is taken must be ",(0,s.jsx)(i.em,{children:"visible"})," to the build rule taking\nthe dependency. A build rule's ",(0,s.jsx)(i.code,{children:"visibility"})," argument is a list of\n",(0,s.jsx)(i.a,{href:"/docs/concepts/target_pattern",children:"build target pattern"}),"s that specify the rules that can take\nthat rule as a dependency. For more information about the concept of visibility\nin Buck2, see the ",(0,s.jsx)(i.a,{href:"/docs/concepts/visibility",children:"Visibility"})," topic."]}),"\n",(0,s.jsx)(i.h3,{id:"dependencies-define-a-graph",children:"Dependencies define a graph"}),"\n",(0,s.jsx)(i.p,{children:"Build rules and their dependencies define a directed acyclic graph (DAG). Buck2\nrequires this graph to be acyclic to make it possible to build independent\nsubgraphs in parallel."}),"\n",(0,s.jsx)(i.h2,{id:"how-to-handle-special-cases-genrules-and-macros",children:"How to handle special cases: genrules and macros"}),"\n",(0,s.jsxs)(i.p,{children:['Although Buck2 provides a rich set of built-in build rules for developers, it is\nnot able to address all possible needs. As an "escape hatch," Buck2 provides a\ncategory of generic build rules called ',(0,s.jsx)(i.em,{children:"genrules"}),". With genrules, you can\nperform arbitrary operations using shell scripts. The genrules supported by\nBuck2 are:"]}),"\n",(0,s.jsxs)(i.ul,{children:["\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.a,{href:"../../prelude/globals/#genrule",children:(0,s.jsx)(i.code,{children:"genrule"})})}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.a,{href:"../../prelude/globals/#apk_genrule",children:(0,s.jsx)(i.code,{children:"apk_genrule"})})}),"\n",(0,s.jsx)(i.li,{children:(0,s.jsx)(i.a,{href:"../../prelude/globals/#cxx_genrule",children:(0,s.jsx)(i.code,{children:"cxx_genrule"})})}),"\n"]}),"\n",(0,s.jsx)(i.h3,{id:"multiple-output-files-with-genrules",children:"Multiple output files with genrules"}),"\n",(0,s.jsxs)(i.p,{children:["In most cases, a build rule produces exactly one output file. However, with\ngenrules, you can specify an output ",(0,s.jsx)(i.em,{children:"directory"})," and write arbitrary files to\nthat directory."]}),"\n",(0,s.jsx)(i.h3,{id:"macros",children:"Macros"}),"\n",(0,s.jsx)(i.p,{children:"Finally, note that you can define functions that generate build rules. In\ngeneral, this should not be something that you need to do, but taking advantage\nof this option might help you add needed functionality to Buck2's without\nediting its source code."}),"\n",(0,s.jsx)(i.h2,{id:"string-parameter-macros",children:"String parameter macros"}),"\n",(0,s.jsxs)(i.p,{children:["It is also possible to expand references to other rules within the ",(0,s.jsx)(i.code,{children:"cmd"}),", using\nthe builtin ",(0,s.jsx)(i.a,{href:"/docs/concepts/string_parameter_macros",children:(0,s.jsx)(i.code,{children:"string parameter macros"})}),". All build\nrules expanded in the command are automatically considered to be dependencies of\nthe ",(0,s.jsx)(i.code,{children:"genrule()"}),"."]})]})}function u(e={}){const{wrapper:i}={...(0,r.R)(),...e.components};return i?(0,s.jsx)(i,{...e,children:(0,s.jsx)(o,{...e})}):o(e)}},28453:(e,i,n)=>{n.d(i,{R:()=>t,x:()=>a});var s=n(96540);const r={},l=s.createContext(r);function t(e){const i=s.useContext(l);return s.useMemo((function(){return"function"==typeof e?e(i):{...i,...e}}),[i,e])}function a(e){let i;return i=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:t(e.components),s.createElement(l.Provider,{value:i},e.children)}}}]);
\ No newline at end of file
diff --git a/assets/js/104.af22fbcf.js b/assets/js/104.af22fbcf.js
new file mode 100644
index 0000000000000..a6bf05c481197
--- /dev/null
+++ b/assets/js/104.af22fbcf.js
@@ -0,0 +1,14887 @@
+exports.id = 104;
+exports.ids = [104];
+exports.modules = {
+
+/***/ 62954:
+/***/ ((module) => {
+
+(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=undefined;if(!f&&c)return require(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=undefined,i=0;i