- Starlark supports type annotations
- Executable targets return
RunInfo
next toDefaultInfo
.RunInfo
can define the arguments (including inputs). - Buck2 has transitive-sets
tset
instead ofdepset
. To usetset
s you must define projections up-front on the specific transitive set type. Projections turn values in thetset
intocmd_args
or JSON values. Transitive sets also support reductions, which must also be defined up-front. And they support ad-hoc iteration, however, this is an escape hatch and has anO(set)
performance penalty. At the moment the ordering is non-configurable. - Use
cmd_args
instead ofctx.actions.args
to collect arguments to a command to run. - Use
ctx.actions.run([..., input, output.as_output()])
instead ofctx.actions.run(..., inputs = .., outputs = ...)
. I.e. inputs and outputs are part of thecmd_args
object.cmd.hidden
to add inputs and outputs that don’t appear in the command-line itself.
- Prefer Python scripts for complex build actions over shell scripts. In particular, there is no
ctx.actions.run_shell
. ctx.actions.download_file
can be used to download a file in a regular build action.- Buck2 supports (scoped) dynamic dependencies via
ctx.actions.dynamic_output
. - Buck2 supports incremental actions, i.e. actions that take previous outputs as inputs.
- Targets can define a default platform to build them for. C.f. this Bazel proposal proposing to add this to Bazel.
- Build files are often called
TARGET
(for Buck v1&v2) orTARGET.v2
(for Buck v2 only) instead ofBUILD
. However, the name can be configured in.buckconfig
. - Buck2 does not have external workspaces, instead it has "Cells". A Cell is a subdirectory of the project and can be referenced via a cell-alias that can be defined for each cell in
.buckconfig
.
-
-
Save aherrmann/da5db753b827ff013b09bdf691ec9827 to your computer and use it in GitHub Desktop.
Buck2-Bazel-differences
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment