bazel: support platform-based Darwin architecture selection - #46637
Open
dio wants to merge 4 commits into
Open
Conversation
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
dio
marked this pull request as ready for review
August 12, 2026 02:52
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Member
Author
|
/retest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit Message: bazel: support platform-based Darwin architecture selection
Additional Description: Fixes #46572. Migrates the existing
darwin_arm64anddarwin_x86_64settings from legacycpuvalues to macOS platform constraints. The public labels and their consumers remain unchanged.Why
constraint_values:values = {"cpu": ...}matches Bazel's legacy--cpuoption. A build that selects its target with--platformsdoes not necessarily set that legacy value, so aselect()can miss the Darwin branch and silently use its default.constraint_valuesmatches constraints on the Bazel target platform. Requiring both the macOS OS constraint and the appropriate CPU constraint makes the setting follow the platform selected by--platforms.linux_x86_64andlinux_aarch64settings and the constraints already declared by//bazel/platforms:macos_x86_64and//bazel/platforms:macos_arm64.//bazel:darwin_x86_64and//bazel:darwin_arm64labels remain stable. Their meaning moves from matching standalone legacy--cpuvalues to matching the configured target platform.Homebrew compatibility: The current Homebrew Core formula builds Envoy with
--config=macosand does not pass an explicit--platformsor legacy Darwin--cpuvalue. Bazel derives the native macOS host platform, which supplies the OS and CPU constraints matched by these settings. This command shape was validated on native GitHub-hosted ARM64 and Intel x86_64 runners.Risk Level: Low
Testing:
tools/local_fix_format.sharm64andx86_64runnersbazel cquery //tools/protoc:protocwith its matching--platformsvalue, both without and with--cpu=k8, selected the matching prebuiltprotoc//tools/protoc:protoc,//source/extensions/network/dns_resolver/apple:config, and//source/extensions/geoip_providers/maxmind:configwith its matching--platformsvalue, both without and with--cpu=k8--config=macospath, without an explicit--platformsor legacy Darwin--cpu, selected the matching prebuiltprotocand built the same targetsDocs Changes: N/A. Native macOS and Homebrew build commands are unchanged.
Release Notes: N/A
AI assistance: AI assisted with code exploration, the initial spike, and verification. I reviewed and understand the proposed change and remain responsible for the contribution.