Skip to content

Update buck2 to 2025-05-06 #10742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/docker/ci_commit_pins/buck2.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-12-16
2025-05-06
2 changes: 1 addition & 1 deletion third-party/prelude
Submodule prelude updated 1519 files
48 changes: 13 additions & 35 deletions tools/cmake/resolve_buck.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from dataclasses import dataclass
from pathlib import Path
from typing import Sequence, Union
from typing import Union

import buck_util
import zstd
Expand Down Expand Up @@ -46,54 +46,34 @@ def _buck_version_path() -> Path:
@dataclass
class BuckInfo:
archive_name: str
target_versions: Sequence[str]


# Mapping of os family and architecture to buck2 binary versions. The
# target version is the hash given by running 'buck2 --version'. The
# Mapping of os family and architecture to buck2 archive name. The target version is the
# hash given by running 'buck2 --version', which is now consistent across platforms. The
# archive name is the archive file name to download, as seen under
# https://github.com/facebook/buck2/releases/.
#
# To add or update versions, download the appropriate version of buck2
# and run 'buck2 --version'. Add the corresponding entry to the platform
# map below, and if adding new os families or architectures, update the
# platform detection logic in resolve_buck2().
#
# Some platforms (linux) provide multiple binaries (GNU and MUSL). All
# versions in the list are accepted when validating a user-provided or
# system buck2.
# To update Buck2, download the appropriate version of buck2 for your platform, run
# 'buck2 --version', and update BUCK_TARGET_VERSION. To add a new platform, add the
# corresponding entry to the platform map below, and if adding new os families or
# architectures, update the platform detection logic in resolve_buck2().
BUCK_TARGET_VERSION = "2025-05-06-201beb86106fecdc84e30260b0f1abb5bf576988"

BUCK_PLATFORM_MAP = {
("linux", "x86_64"): BuckInfo(
archive_name="buck2-x86_64-unknown-linux-musl.zst",
target_versions=[
# MUSL
"edae27cfca00053d9c5f7c7be81b6b0d7d07573a50be374ce53a9d8692afa5fc",
# GNU
"10334cb20cb7c321",
],
),
("linux", "aarch64"): BuckInfo(
archive_name="buck2-aarch64-unknown-linux-gnu.zst",
target_versions=[
# MUSL
"5d7af382acbe0dde70f0e9b0a0bc36deea906077ec1ffe80d3fa280490109051",
# GNU
"08d4382de22fab275978abc7c27c001d7823eb2f",
],
),
("darwin", "aarch64"): BuckInfo(
archive_name="buck2-aarch64-apple-darwin.zst",
target_versions=["f3b7a37732803ed090cd8a37f00cc000"],
),
("darwin", "x86_64"): BuckInfo(
archive_name="buck2-x86_64-apple-darwin.zst",
target_versions=["9c9a583658d43e82b41f3fc9d369a9b0"],
),
("windows", "x86_64"): BuckInfo(
archive_name="buck2-x86_64-pc-windows-msvc.exe.zst",
target_versions=[
"c7d378f3f307e9590f0b29a5f7f1b21b8e784f4e4bd30a0160b2a69df50d2ee0"
],
),
}

Expand Down Expand Up @@ -160,13 +140,13 @@ def resolve_buck2(args: argparse.Namespace) -> Union[str, int]:
# If we have an explicit buck2 arg, check the version and fail if
# there is a mismatch.
ver = buck_util.get_buck2_version(args.buck2)
if ver in buck_info.target_versions:
if ver == BUCK_TARGET_VERSION:
return args.buck2
else:
print(
f'The provided buck2 binary "{args.buck2}" reports version '
f'"{ver}", but ExecuTorch needs version '
f'"{buck_info.target_versions[0]}". Ensure that the correct buck2'
f'"{BUCK_TARGET_VERSION}". Ensure that the correct buck2'
" version is installed or avoid explicitly passing the BUCK2 "
"version to automatically download the correct version.",
file=sys.stderr,
Expand All @@ -181,7 +161,7 @@ def resolve_buck2(args: argparse.Namespace) -> Union[str, int]:
# Look for system buck2 and check version. Note that this can return
# None.
ver = buck_util.get_buck2_version("buck2")
if ver in buck_info.target_versions:
if ver == BUCK_TARGET_VERSION:
# Use system buck2.
return "buck2"
else:
Expand All @@ -190,9 +170,7 @@ def resolve_buck2(args: argparse.Namespace) -> Union[str, int]:
os.makedirs(cache_dir, exist_ok=True)

buck2_local_path = (
(cache_dir / f"buck2-{buck_info.target_versions[0]}")
.absolute()
.as_posix()
(cache_dir / f"buck2-{BUCK_TARGET_VERSION}").absolute().as_posix()
)

# Check for a previously cached buck2 binary. The filename includes
Expand Down
Loading