Skip to content

Commit

Permalink
pw_build: Provide HOST_PLATFORMS tuple
Browse files Browse the repository at this point in the history
Allow other parts of the build to refer to "host platforms" consistently
with host_backend_alias. This allows a module to, for example, set a
a backend for the host and a default backend for non-host platforms.

Change-Id: If04893aa83ea238503283119908b8f046cf0a431
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/260518
Pigweed-Auto-Submit: Wyatt Hepler <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
Presubmit-Verified: CQ Bot Account <[email protected]>
Reviewed-by: Ted Pudlik <[email protected]>
Docs-Not-Needed: Wyatt Hepler <[email protected]>
Lint: Lint 🤖 <[email protected]>
  • Loading branch information
255 authored and CQ Bot Account committed Jan 15, 2025
1 parent 5da0586 commit d178cae
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions pw_build/compatibility.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@

load("@bazel_skylib//lib:selects.bzl", "selects")

HOST_PLATFORMS = (
"@platforms//os:android",
"@platforms//os:chromiumos",
"@platforms//os:linux",
"@platforms//os:macos",
"@platforms//os:windows",
)

def host_backend_alias(name, backend):
"""An alias that resolves to the backend for host platforms."""
native.alias(
name = name,
actual = selects.with_or({
(
"@platforms//os:android",
"@platforms//os:chromiumos",
"@platforms//os:linux",
"@platforms//os:macos",
"@platforms//os:windows",
): backend,
HOST_PLATFORMS: backend,
"//conditions:default": str(Label("//pw_build:unspecified_backend")),
}),
)
Expand Down

0 comments on commit d178cae

Please sign in to comment.