Skip to content

Commit

Permalink
pass platform_deps_aliases along
Browse files Browse the repository at this point in the history
Summary:
`platform_*` attrs in cxx rules are matched against both the current toolchain's
`CxxPlatformInfo` provider `name` and anything in `deps_aliases`.

This diff pipes `platform_deps_aliases` from the `cxx_toolchain` macro down to
the function that creates the underlying provider, just like how
`platform_name` is passed. This enables a cxx toolchain (such as D67764044) to
add these aliases.

Best I could find in the way of documentation for this
> platform_preprocessor_flags: Platform specific preprocessor flags. These
> should be specified as a list of pairs where the first element is an
> un-anchored regex (in java.util.regex.Pattern syntax) against which the
> platform name is matched, and the second element is a list of flags to use
> when preprocessing the target's sources. See preprocessor_flags for more
> information.

Reviewed By: athmasagar

Differential Revision: D68285192

fbshipit-source-id: 1e3ea5fba3aee68addd0cc9c66a2f14b7aa12f34
  • Loading branch information
vmagro authored and facebook-github-bot committed Jan 17, 2025
1 parent b12f1c6 commit 3033ba2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion prelude/cxx/cxx_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def cxx_toolchain_impl(ctx):
] + cxx_toolchain_infos(
internal_tools = ctx.attrs._internal_tools[CxxInternalTools],
platform_name = platform_name,
platform_deps_aliases = ctx.attrs.platform_deps_aliases,
linker_info = linker_info,
binary_utilities_info = utilities_info,
bolt_enabled = value_or(ctx.attrs.bolt_enabled, False),
Expand Down Expand Up @@ -247,7 +248,9 @@ def cxx_toolchain_extra_attributes(is_toolchain_rule):
# Useful when fat and thin toolchahins share the same underlying tools via `command_alias()`,
# which requires setting up separate platform-specific aliases with the correct constraints.
"placeholder_tool": attrs.option(dep_type(providers = [RunInfo]), default = None),
# Used for resolving any 'platform_*' attributes.
# Used for regex matching any 'platform_*' attributes.
"platform_deps_aliases": attrs.option(attrs.list(attrs.string()), default = None),
# Used for regex matching any 'platform_*' attributes.
"platform_name": attrs.option(attrs.string(), default = None),
"private_headers_symlinks_enabled": attrs.bool(default = True),
"public_headers_symlinks_enabled": attrs.bool(default = True),
Expand Down

0 comments on commit 3033ba2

Please sign in to comment.